/* ===================================================
   Neural Chat AI – Global Stylesheet
   RTL Arabic, Mobile-first, Cyan + Purple AI theme
   =================================================== */

/* === Reset & Base === */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --navy:       #0f1729;
  --navy-light: #151f35;
  --navy-card:  #1a2540;
  --cyan:       #4fd1c5;
  --cyan-bright:#00e5ff;
  --cyan-dark:  #2cb5a8;
  --teal:       var(--cyan);
  --teal-dark:  var(--cyan-dark);
  --purple:     #b83280;
  --purple-light:#d53f8c;
  --magenta:    #c026d3;
  --blue:       #3b82f6;
  --blue-light: #60a5fa;
  --text:       #e8edf5;
  --text-muted: #94a3b8;
  --border:     #2d3f5e;
  --danger:     #ef4444;
  --success:    #22c55e;
  --warning:    #f59e0b;
  --radius:     10px;
  --radius-lg:  16px;
  --shadow:     0 4px 24px rgba(0,0,0,0.4);
  --glow-cyan:  0 0 24px rgba(79, 209, 197, 0.25);
  --glow-purple:0 0 24px rgba(184, 50, 128, 0.2);
  --transition: 0.2s ease;
}

html {
  font-size: 16px;
  scroll-behavior: smooth;
}

body {
  font-family: 'Segoe UI', 'Cairo', 'Inter', 'Tajawal', Arial, sans-serif;
  background:
    radial-gradient(ellipse at 20% 0%, rgba(79, 209, 197, 0.08) 0%, transparent 50%),
    radial-gradient(ellipse at 80% 10%, rgba(184, 50, 128, 0.06) 0%, transparent 45%),
    var(--navy);
  color: var(--text);
  direction: rtl;
  min-height: 100vh;
  line-height: 1.6;
}

a {
  color: var(--teal);
  text-decoration: none;
  transition: color var(--transition);
}

a:hover { color: var(--teal-dark); }

img { max-width: 100%; display: block; }

button, input, select, textarea {
  font-family: inherit;
  font-size: 1rem;
}

/* === Typography === */
h1, h2, h3, h4, h5 {
  font-weight: 700;
  line-height: 1.3;
}
h1 { font-size: clamp(1.8rem, 4vw, 3rem); }
h2 { font-size: clamp(1.4rem, 3vw, 2.2rem); }
h3 { font-size: clamp(1.1rem, 2.5vw, 1.6rem); }
h4 { font-size: 1.1rem; }

.text-muted    { color: var(--text-muted); }
.text-teal     { color: var(--teal); }
.text-danger   { color: var(--danger); }
.text-success  { color: var(--success); }
.text-center   { text-align: center; }
.text-sm       { font-size: 0.875rem; }

/* === Layout === */
.container {
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 1rem;
}

.section { padding: 4rem 0; }
.section-sm { padding: 2rem 0; }

/* === Navbar === */
.navbar {
  background: rgba(11, 17, 32, 0.95);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 1000;
  padding: 0.9rem 0;
}

.navbar-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.navbar-brand {
  display: inline-flex;
  align-items: center;
  gap: 0.65rem;
  font-size: 1.15rem;
  font-weight: 800;
  font-family: 'Inter', 'Cairo', sans-serif;
  color: var(--text) !important;
  white-space: nowrap;
}

.navbar-logo {
  width: 38px;
  height: 38px;
  object-fit: contain;
  border-radius: 50%;
  filter: drop-shadow(var(--glow-cyan));
}

.brand-text {
  letter-spacing: -0.02em;
}

.brand-ai {
  background: linear-gradient(135deg, var(--purple-light), var(--magenta));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.navbar-nav {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  list-style: none;
  flex-wrap: wrap;
}

.navbar-nav a {
  color: var(--text-muted);
  padding: 0.4rem 0.75rem;
  border-radius: var(--radius);
  transition: all var(--transition);
  white-space: nowrap;
  font-size: 0.95rem;
}

.navbar-nav a:hover,
.navbar-nav a.active {
  color: var(--cyan);
  background: rgba(79, 209, 197, 0.1);
}

.navbar-toggle {
  display: none;
  background: none;
  border: 1px solid var(--border);
  color: var(--text);
  padding: 0.4rem 0.6rem;
  border-radius: var(--radius);
  cursor: pointer;
  font-size: 1.2rem;
}

@media (max-width: 768px) {
  .navbar-toggle { display: block; }
  .navbar-nav {
    display: none;
    flex-direction: column;
    align-items: flex-start;
    width: 100%;
    padding: 0.5rem 0;
    gap: 0.2rem;
  }
  .navbar-nav.open { display: flex; }
  .navbar-nav a { width: 100%; }
  .navbar-inner { flex-wrap: wrap; }
}

/* === Sidebar Layout (dashboard) === */
.app-layout {
  display: flex;
  min-height: calc(100vh - 60px);
}

.sidebar {
  width: 240px;
  background: var(--navy-light);
  border-left: 1px solid var(--border);
  padding: 1.5rem 0;
  flex-shrink: 0;
  position: sticky;
  top: 60px;
  height: calc(100vh - 60px);
  overflow-y: auto;
}

.sidebar-nav {
  list-style: none;
}

.sidebar-nav a {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  color: var(--text-muted);
  padding: 0.75rem 1.25rem;
  transition: all var(--transition);
  border-right: 3px solid transparent;
  font-size: 0.95rem;
}

.sidebar-nav a:hover,
.sidebar-nav a.active {
  color: var(--cyan);
  background: rgba(79, 209, 197, 0.08);
  border-right-color: var(--cyan);
}

.sidebar-icon { font-size: 1.1rem; width: 20px; text-align: center; }

.main-content {
  flex: 1;
  padding: 2rem;
  overflow-x: hidden;
}

@media (max-width: 768px) {
  .app-layout { flex-direction: column; }
  .sidebar {
    width: 100%;
    height: auto;
    position: static;
    border-left: none;
    border-bottom: 1px solid var(--border);
    padding: 0.5rem 0;
  }
  .sidebar-nav { display: flex; flex-wrap: wrap; }
  .sidebar-nav a {
    border-right: none;
    border-bottom: 3px solid transparent;
    padding: 0.5rem 1rem;
  }
  .sidebar-nav a:hover,
  .sidebar-nav a.active {
    border-right-color: transparent;
    border-bottom-color: var(--cyan);
  }
  .main-content { padding: 1rem; }
}

/* === Dashboard account summary === */
.dashboard-account-stats {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1rem;
  margin-bottom: 1.5rem;
}

@media (min-width: 520px) {
  .dashboard-account-stats {
    grid-template-columns: repeat(2, 1fr);
  }
}

.account-stat-card {
  display: flex;
  align-items: flex-start;
  gap: 0.85rem;
  background: var(--navy-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1rem 1.15rem;
}

.account-stat-icon {
  font-size: 1.6rem;
  line-height: 1;
  flex-shrink: 0;
}

.account-stat-body {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  min-width: 0;
}

.account-stat-label {
  font-size: 0.82rem;
  color: var(--text-muted);
}

.account-stat-value {
  font-size: 1.2rem;
  font-weight: 700;
}

.account-stat-hint {
  font-size: 0.78rem;
  font-weight: 600;
}

/* === Cards === */
.card {
  background: var(--navy-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  margin-bottom: 1.5rem;
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.25rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--border);
}

.card-title {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text);
}

/* === Buttons === */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  padding: 0.55rem 1.2rem;
  border: none;
  border-radius: var(--radius);
  cursor: pointer;
  font-weight: 600;
  font-size: 0.9rem;
  transition: all var(--transition);
  white-space: nowrap;
  text-decoration: none;
}

.btn-primary {
  background: linear-gradient(135deg, var(--cyan), var(--purple));
  color: #fff;
}
.btn-primary:hover {
  background: linear-gradient(135deg, var(--cyan-dark), var(--purple-light));
  transform: translateY(-1px);
  box-shadow: var(--glow-cyan), var(--glow-purple);
  color: #fff;
}

.btn-secondary {
  background: var(--navy-light);
  border: 1px solid var(--border);
  color: var(--text);
}
.btn-secondary:hover {
  border-color: var(--teal);
  color: var(--teal);
}

.btn-danger {
  background: rgba(239, 68, 68, 0.15);
  border: 1px solid var(--danger);
  color: var(--danger);
}
.btn-danger:hover {
  background: var(--danger);
  color: #fff;
}

.btn-success {
  background: rgba(34, 197, 94, 0.15);
  border: 1px solid var(--success);
  color: var(--success);
}
.btn-success:hover {
  background: var(--success);
  color: #fff;
}

.btn-sm {
  padding: 0.35rem 0.8rem;
  font-size: 0.8rem;
}
.btn-lg {
  padding: 0.8rem 2rem;
  font-size: 1rem;
  border-radius: var(--radius-lg);
}
.btn-block { width: 100%; }

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none !important;
}

.btn-whatsapp {
  background: #25d366;
  color: #fff !important;
  font-size: 1rem;
}
.btn-whatsapp:hover {
  background: #1ebe5d;
  color: #fff;
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(37, 211, 102, 0.4);
}

/* === Forms === */
.form-group {
  margin-bottom: 1.1rem;
}

.form-label {
  display: block;
  margin-bottom: 0.4rem;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-muted);
}

.form-control {
  width: 100%;
  background: var(--navy);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.6rem 0.9rem;
  color: var(--text);
  transition: border-color var(--transition);
  outline: none;
}

.form-control:focus {
  border-color: var(--teal);
  box-shadow: 0 0 0 3px rgba(0, 201, 167, 0.15);
}

.form-control::placeholder { color: var(--text-muted); }

textarea.form-control {
  resize: vertical;
  min-height: 90px;
}

.form-hint {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-top: 0.25rem;
}

.form-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
}

/* === Alerts === */
.alert {
  padding: 0.8rem 1rem;
  border-radius: var(--radius);
  font-size: 0.9rem;
  margin-bottom: 1rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.alert-success { background: rgba(34, 197, 94, 0.15); border: 1px solid var(--success); color: var(--success); }
.alert-danger  { background: rgba(239, 68, 68, 0.15);  border: 1px solid var(--danger);  color: var(--danger); }
.alert-warning { background: rgba(245, 158, 11, 0.15); border: 1px solid var(--warning); color: var(--warning); }
.alert-info    { background: rgba(59, 130, 246, 0.15); border: 1px solid var(--blue);    color: var(--blue-light); }

#global-alert { display: none; }

/* === Tables === */
.table-responsive { overflow-x: auto; -webkit-overflow-scrolling: touch; }

.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

.table th, .table td {
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--border);
  text-align: right;
}

.table th {
  color: var(--text-muted);
  font-weight: 600;
  background: var(--navy-light);
  white-space: nowrap;
}

.table tbody tr:hover { background: rgba(255,255,255,0.03); }

/* === Tags / Badges === */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 0.2rem 0.6rem;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 700;
}
.badge-teal    { background: rgba(0,201,167,0.2); color: var(--teal); }
.badge-blue    { background: rgba(59,130,246,0.2); color: var(--blue-light); }
.badge-danger  { background: rgba(239,68,68,0.2);  color: var(--danger); }
.badge-success { background: rgba(34,197,94,0.2);  color: var(--success); }
.badge-warning { background: rgba(245,158,11,0.2); color: var(--warning); }

/* === Toggle / Switch === */
.toggle-switch {
  position: relative;
  display: inline-block;
  width: 48px;
  height: 26px;
}
.toggle-switch input { opacity: 0; width: 0; height: 0; }
.toggle-slider {
  position: absolute;
  cursor: pointer;
  top: 0; left: 0; right: 0; bottom: 0;
  background: var(--border);
  border-radius: 26px;
  transition: 0.3s;
}
.toggle-slider::before {
  content: "";
  position: absolute;
  height: 20px; width: 20px;
  left: 3px; bottom: 3px;
  background: white;
  border-radius: 50%;
  transition: 0.3s;
}
.toggle-switch input:checked + .toggle-slider { background: var(--teal); }
.toggle-switch input:checked + .toggle-slider::before { transform: translateX(22px); }

/* === Modal === */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.6);
  z-index: 2000;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}
.modal-overlay.open { display: flex; }

.modal {
  background: var(--navy-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 2rem;
  width: 100%;
  max-width: 520px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow);
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.5rem;
}

.modal-close {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 1.4rem;
  cursor: pointer;
  padding: 0.2rem;
  line-height: 1;
}
.modal-close:hover { color: var(--danger); }

/* === Hero section === */
.hero {
  padding: 6rem 0 4rem;
  text-align: center;
  background:
    radial-gradient(ellipse at 50% 0%, rgba(79, 209, 197, 0.12) 0%, transparent 55%),
    radial-gradient(ellipse at 70% 20%, rgba(184, 50, 128, 0.08) 0%, transparent 45%);
}

.hero-badge {
  display: inline-block;
  background: rgba(79, 209, 197, 0.12);
  border: 1px solid rgba(79, 209, 197, 0.35);
  color: var(--cyan);
  padding: 0.3rem 1rem;
  border-radius: 20px;
  font-size: 0.85rem;
  font-weight: 600;
  margin-bottom: 1.5rem;
}

.hero h1 { margin-bottom: 1rem; }
.hero h1 span {
  background: linear-gradient(135deg, var(--cyan-bright), var(--purple-light));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.hero p { font-size: 1.1rem; color: var(--text-muted); max-width: 640px; margin: 0 auto 2rem; }

.hero-actions {
  display: flex;
  gap: 1rem;
  justify-content: center;
  flex-wrap: wrap;
}

/* === Features grid === */
.features-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 1.5rem;
}

.feature-card {
  background: var(--navy-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.8rem;
  transition: all 0.3s;
}

.feature-card:hover {
  border-color: rgba(79, 209, 197, 0.45);
  transform: translateY(-4px);
  box-shadow: var(--glow-cyan);
}

.feature-icon {
  font-size: 2rem;
  margin-bottom: 1rem;
}

.feature-card h3 { margin-bottom: 0.5rem; font-size: 1.1rem; }
.feature-card p { color: var(--text-muted); font-size: 0.9rem; }

/* === Pricing Cards === */
.pricing-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 1.5rem;
}

.pricing-card {
  background: var(--navy-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 2rem;
  text-align: center;
  transition: all 0.3s;
  position: relative;
}

.pricing-card.featured {
  border-color: var(--teal);
  box-shadow: 0 0 30px rgba(0,201,167,0.15);
}

.pricing-card .plan-name { font-size: 1.2rem; font-weight: 700; margin-bottom: 0.5rem; }
.pricing-card .plan-badge {
  position: absolute;
  top: -12px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--teal);
  color: var(--navy);
  padding: 0.2rem 1rem;
  border-radius: 20px;
  font-size: 0.78rem;
  font-weight: 700;
  white-space: nowrap;
}
.pricing-card .plan-price { font-size: 1.8rem; font-weight: 800; color: var(--teal); margin: 1rem 0; }
.pricing-card .plan-features { list-style: none; text-align: right; margin-bottom: 1.5rem; }
.pricing-card .plan-features li { padding: 0.4rem 0; color: var(--text-muted); font-size: 0.9rem; border-bottom: 1px solid var(--border); }
.pricing-card .plan-features li::before { content: "✓ "; color: var(--teal); font-weight: 700; }

/* === Loader === */
.loader {
  display: inline-block;
  width: 20px; height: 20px;
  border: 2px solid rgba(255,255,255,0.2);
  border-top-color: var(--teal);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.loading-row { text-align: center; color: var(--text-muted); padding: 2rem; }

/* === Empty state === */
.empty-state {
  text-align: center;
  padding: 3rem 1rem;
  color: var(--text-muted);
}
.empty-state .empty-icon { font-size: 3rem; margin-bottom: 1rem; }

/* === Item list (tags style) === */
.item-list { display: flex; flex-direction: column; gap: 0.75rem; }

.item-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  background: var(--navy-light);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.75rem 1rem;
  flex-wrap: wrap;
}

.item-row-actions { display: flex; gap: 0.4rem; flex-shrink: 0; }

/* Product modal — branches & instructions on mobile */
.branch-fields-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 5.5rem;
  gap: 0.5rem;
  align-items: center;
}

.branch-desc-input {
  width: 100%;
  min-width: 0;
  font-size: 16px;
  min-height: 44px;
}

.branch-qty-input {
  width: 100%;
  min-width: 0;
  font-size: 16px;
  min-height: 44px;
}

.branch-media-section,
.instruction-media-section {
  margin-top: 0.45rem;
}

.existing-media-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.4rem;
  padding: 0.3rem;
  background: rgba(255, 255, 255, 0.03);
  border-radius: 6px;
}

.product-instruction-text,
.product-qa-text {
  font-size: 16px;
  min-height: 88px;
}

.branch-row > div:first-child,
.inst-row > div:first-child {
  flex: 1;
  min-width: 0;
  width: 100%;
}

@media (max-width: 768px) {
  .branch-fields-grid {
    grid-template-columns: 1fr;
  }

  .branch-qty-input {
    max-width: 10rem;
  }

  #product-modal .modal {
    max-width: 100%;
    margin: 0.5rem;
  }

  #product-modal .item-row {
    flex-direction: column;
    align-items: stretch;
  }

  #product-modal .item-row > .btn-danger {
    align-self: flex-end;
  }
}

/* === Scroll sentinel === */
#scroll-sentinel { height: 1px; }

/* === Page header === */
.page-header {
  margin-bottom: 2rem;
}
.page-header h1 { font-size: 1.6rem; margin-bottom: 0.3rem; }
.page-header p { color: var(--text-muted); }

/* === Footer === */
.footer {
  background: var(--navy-light);
  border-top: 1px solid var(--border);
  padding: 2.5rem 0;
  text-align: center;
  color: var(--text-muted);
  font-size: 0.875rem;
}

.footer-links {
  display: flex;
  justify-content: center;
  gap: 1.5rem;
  flex-wrap: wrap;
  margin-top: 1rem;
}

/* === Auth pages === */
.auth-wrapper {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem 1rem;
  background: radial-gradient(ellipse at 50% 0%, rgba(0,201,167,0.06) 0%, transparent 60%);
}

.auth-box {
  width: 100%;
  max-width: 420px;
  background: var(--navy-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 2.5rem;
  box-shadow: var(--shadow);
}

.auth-logo {
  text-align: center;
  margin-bottom: 2rem;
}

.auth-logo img {
  width: 72px;
  height: 72px;
  object-fit: contain;
  margin: 0 auto 0.75rem;
  filter: drop-shadow(var(--glow-cyan));
}

.auth-logo .brand-title {
  font-size: 1.35rem;
  font-weight: 800;
  font-family: 'Inter', 'Cairo', sans-serif;
  color: var(--text);
}

.auth-logo .brand-title .brand-ai {
  background: linear-gradient(135deg, var(--purple-light), var(--magenta));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

/* === Utility === */
.d-flex        { display: flex; }
.align-center  { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-1         { gap: 0.5rem; }
.gap-2         { gap: 1rem; }
.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.mb-3 { margin-bottom: 1.5rem; }
.w-100 { width: 100%; }

/* === Confirm dialog === */
.confirm-box {
  background: var(--navy-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 2rem;
  width: 100%;
  max-width: 400px;
  text-align: center;
}
.confirm-box h3 { margin-bottom: 0.75rem; }
.confirm-box p  { color: var(--text-muted); margin-bottom: 1.5rem; }
.confirm-actions { display: flex; gap: 1rem; justify-content: center; }

/* === Product card (catalog/products) === */
.product-card {
  background: var(--navy-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  transition: all 0.3s;
}
.product-card:hover {
  border-color: rgba(0,201,167,0.3);
  transform: translateY(-3px);
  box-shadow: 0 8px 24px rgba(0,0,0,0.3);
}
.product-img {
  width: 100%;
  height: 180px;
  object-fit: cover;
  background: var(--navy-light);
}
.product-img-placeholder {
  width: 100%;
  height: 180px;
  background: var(--navy-light);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2.5rem;
  color: var(--border);
}
.product-body { padding: 1.1rem; }
.product-name { font-weight: 700; margin-bottom: 0.3rem; font-size: 1rem; }
.product-price { color: var(--teal); font-weight: 700; font-size: 1.05rem; }
.product-desc { color: var(--text-muted); font-size: 0.85rem; margin-top: 0.4rem; line-height: 1.5; }
.product-focus-badge {
  display: inline-block;
  background: linear-gradient(135deg, var(--teal), var(--blue));
  color: #fff;
  font-size: 0.72rem;
  font-weight: 700;
  padding: 0.15rem 0.6rem;
  border-radius: 10px;
  margin-bottom: 0.5rem;
}

.products-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 1.25rem;
}

/* === Public catalog page (flip cards) === */
.catalog-page .catalog-section {
  padding-top: 1rem;
  padding-bottom: 2.5rem;
}

.catalog-search-bar {
  display: flex;
  gap: 0.65rem;
  margin-bottom: 1.25rem;
  flex-wrap: wrap;
}

.catalog-search-bar .form-control {
  flex: 1;
  min-width: min(100%, 12rem);
}

.catalog-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.25rem;
  justify-items: center;
}

@media (min-width: 520px) {
  .catalog-grid {
    grid-template-columns: repeat(2, 1fr);
    justify-items: stretch;
  }
}

@media (min-width: 960px) {
  .catalog-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

/* بطاقة مربعة/مستطيلة — كل المحتوى يُقلَّب أفقيًا داخلها */
.catalog-flip-card {
  width: 100%;
  max-width: 360px;
  background: var(--navy-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow);
}

.catalog-flip-frame {
  position: relative;
  width: 100%;
  aspect-ratio: 1 / 1;
}

@media (min-width: 520px) {
  .catalog-flip-frame {
    aspect-ratio: 4 / 5;
  }
}

.catalog-flip-viewport {
  position: absolute;
  inset: 0;
  overflow: hidden;
}

.catalog-flip-track {
  display: flex;
  height: 100%;
  width: 100%;
  overflow-x: auto;
  overflow-y: hidden;
  scroll-snap-type: x mandatory;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  direction: ltr;
}

.catalog-flip-track::-webkit-scrollbar {
  display: none;
}

.catalog-flip-slide {
  flex: 0 0 100%;
  width: 100%;
  height: 100%;
  scroll-snap-align: center;
  scroll-snap-stop: always;
  position: relative;
  background: var(--navy-light);
}

.catalog-flip-slide--media img,
.catalog-flip-slide--media video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  background: #000;
}

.catalog-flip-slide--placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  color: var(--text-muted);
  font-size: 2.5rem;
}

.catalog-flip-slide--info,
.catalog-flip-slide--branch-info {
  display: flex;
  flex-direction: column;
  padding: 1rem 1.1rem;
  overflow-y: auto;
  background: linear-gradient(160deg, var(--navy-card) 0%, var(--navy-light) 100%);
  direction: rtl;
  text-align: right;
}

.catalog-flip-tag {
  display: inline-block;
  align-self: flex-start;
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--teal);
  background: rgba(0, 201, 167, 0.12);
  border: 1px solid rgba(0, 201, 167, 0.35);
  padding: 0.15rem 0.5rem;
  border-radius: 6px;
  margin-bottom: 0.5rem;
}

.catalog-flip-focus {
  display: inline-block;
  align-self: flex-start;
  background: linear-gradient(135deg, var(--teal), var(--blue));
  color: #fff;
  font-size: 0.68rem;
  font-weight: 700;
  padding: 0.15rem 0.45rem;
  border-radius: 6px;
  margin-bottom: 0.4rem;
}

.catalog-flip-title {
  font-size: 1.05rem;
  font-weight: 800;
  line-height: 1.35;
  margin-bottom: 0.35rem;
}

.catalog-flip-price {
  color: var(--teal);
  font-weight: 700;
  font-size: 1.05rem;
  margin-bottom: 0.65rem;
}

.catalog-flip-desc {
  color: var(--text-muted);
  font-size: 0.86rem;
  line-height: 1.6;
  flex: 1;
  overflow-y: auto;
  word-break: break-word;
}

.catalog-flip-branch-qty {
  font-size: 0.82rem;
  color: var(--text-muted);
  margin-top: 0.25rem;
}

.catalog-flip-caption {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 0.45rem 0.65rem;
  font-size: 0.75rem;
  color: #fff;
  background: linear-gradient(transparent, rgba(0, 0, 0, 0.75));
  line-height: 1.3;
}

.catalog-flip-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.5rem 0.75rem;
  border-top: 1px solid var(--border);
  background: var(--navy-card);
}

.catalog-flip-counter {
  font-size: 0.78rem;
  color: var(--text-muted);
  white-space: nowrap;
}

.catalog-flip-dots {
  display: flex;
  gap: 0.3rem;
  flex-wrap: wrap;
  justify-content: center;
  flex: 1;
}

.catalog-flip-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  border: none;
  padding: 0;
  background: var(--border);
  cursor: pointer;
  transition: background var(--transition), transform var(--transition);
}

.catalog-flip-dot.is-active {
  background: var(--teal);
  transform: scale(1.2);
}

.catalog-flip-hint {
  font-size: 0.68rem;
  color: var(--text-muted);
  white-space: nowrap;
}

.catalog-flip-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  z-index: 2;
  width: 32px;
  height: 32px;
  border: none;
  border-radius: 50%;
  background: rgba(11, 17, 32, 0.65);
  color: #fff;
  font-size: 1.1rem;
  cursor: pointer;
  display: none;
  align-items: center;
  justify-content: center;
  line-height: 1;
}

@media (min-width: 768px) {
  .catalog-flip-nav {
    display: flex;
  }
}

.catalog-flip-nav--prev { right: 6px; }
.catalog-flip-nav--next { left: 6px; }

/* === Scrollable list === */
.scroll-list-container { max-height: 500px; overflow-y: auto; }

/* === Conversation row === */
.conv-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
}
.conv-row:last-child { border-bottom: none; }
.conv-info { flex: 1; min-width: 0; }
.conv-name { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.conv-page { font-size: 0.82rem; color: var(--text-muted); }
