/* ============================================================
   Enqood Client Portal — Dark Theme (RTL)
   ============================================================ */

:root {
  --bg-body:       #0D1526;
  --bg-surface:    #141c2e;
  --bg-card:       #1A2332;
  --bg-card-hover: #222d42;
  --bg-elevated:   #252f42;
  --bg-input:      #141c2e;

  --border:        #2D3A52;
  --border-light:  #3A4a65;

  --accent:        #0043CE;
  --accent-hover:  #0039B0;
  --accent-muted:  rgba(0,67,206,.12);
  --accent-light:  #C2D6FF;

  --secondary:     #0066FF;
  --secondary-hover:#0052CC;

  --text-primary:  #FFFFFF;
  --text-secondary:#B8B8D0;
  --text-muted:    #6E6E8A;

  --success:       #0066FF;
  --success-bg:    rgba(0,102,255,.1);
  --warning:       #FFB84D;
  --warning-bg:    rgba(255,184,77,.1);
  --danger:        #e53e3e;
  --danger-bg:     rgba(229,62,62,.1);
  --info:          #0043CE;
  --info-bg:       rgba(0,67,206,.1);
  --frozen:        #764ba2;
  --frozen-bg:     rgba(118,75,162,.1);

  --radius-sm:     6px;
  --radius:        10px;
  --radius-lg:     16px;
  --radius-xl:     24px;

  --shadow:        0 1px 3px rgba(0,0,0,.4), 0 1px 2px rgba(0,0,0,.3);
  --shadow-lg:     0 10px 25px rgba(0,0,0,.5);

  --font:          'Almarai', 'DM Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --transition:    180ms ease;
}

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html { font-size: 15px; }

body {
  font-family: var(--font);
  background: var(--bg-body);
  color: var(--text-primary);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}

a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-hover); }

.hidden { display: none !important; }

/* ── Buttons ────────────────────────────────────────── */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-family: var(--font);
  font-weight: 500;
  font-size: .875rem;
  padding: 10px 20px;
  border-radius: var(--radius);
  border: 1px solid transparent;
  cursor: pointer;
  transition: all var(--transition);
  white-space: nowrap;
  line-height: 1;
}

.btn:disabled {
  opacity: .45;
  cursor: not-allowed;
}

.btn-primary {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}
.btn-primary:hover:not(:disabled) {
  background: var(--accent-hover);
  border-color: var(--accent-hover);
  box-shadow: 0 0 20px rgba(0,67,206,.35);
}

.btn-danger {
  background: var(--danger);
  color: #fff;
  border-color: var(--danger);
}
.btn-danger:hover:not(:disabled) {
  background: #dc2626;
  border-color: #dc2626;
}

.btn-warning {
  background: transparent;
  color: var(--warning);
  border-color: var(--warning);
}
.btn-warning:hover:not(:disabled) {
  background: var(--warning-bg);
}

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
  border-color: var(--border);
}
.btn-ghost:hover:not(:disabled) {
  color: var(--text-primary);
  border-color: var(--border-light);
  background: var(--bg-elevated);
}

.btn-sm {
  font-size: .8rem;
  padding: 6px 14px;
  border-radius: var(--radius-sm);
}

.btn-xs {
  font-size: .75rem;
  padding: 5px 10px;
  border-radius: var(--radius-sm);
}

.btn-block { width: 100%; }

.btn-icon {
  width: 34px;
  height: 34px;
  padding: 0;
  border-radius: var(--radius-sm);
}

/* ── Spinner ────────────────────────────────────────── */

.spinner {
  display: inline-block;
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255,255,255,.25);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin .6s linear infinite;
}

.spinner-lg {
  width: 36px;
  height: 36px;
  border: 3px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin .7s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ── Login Page ─────────────────────────────────────── */

.login-page {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  background:
    linear-gradient(135deg, rgba(0,67,206,.08) 0%, rgba(0,102,255,.06) 100%),
    var(--bg-body);
}

.login-container {
  width: 100%;
  max-width: 420px;
  padding: 20px;
}

.login-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 40px 36px;
  box-shadow: var(--shadow-lg);
}

.login-brand {
  text-align: center;
  margin-bottom: 36px;
}

.brand-icon {
  display: inline-flex;
  margin-bottom: 16px;
}

.brand-logo {
  height: 40px;
  width: auto;
}

.header-logo {
  height: 28px;
  width: auto;
}

.login-brand h1 {
  font-size: 1.6rem;
  font-weight: 700;
  letter-spacing: -.02em;
}

.brand-subtitle {
  color: var(--text-muted);
  font-size: .9rem;
  margin-top: 4px;
}

.form-group {
  margin-bottom: 20px;
}

.form-group label {
  display: block;
  font-size: .85rem;
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: 8px;
}

.form-group input {
  width: 100%;
  padding: 12px 16px;
  font-family: var(--font);
  font-size: .95rem;
  color: var(--text-primary);
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  outline: none;
  transition: border-color var(--transition), box-shadow var(--transition);
}

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

.form-group input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-muted);
}

.btn-text,
.btn-loader { display: inline-flex; align-items: center; gap: 8px; }

.login-message {
  text-align: center;
  padding: 20px;
  border-radius: var(--radius);
  margin-top: 20px;
}

.login-message h3 {
  font-size: 1.05rem;
  margin: 10px 0 6px;
}

.login-message p {
  font-size: .88rem;
  color: var(--text-secondary);
  line-height: 1.5;
}

.success-icon { color: var(--success); }

.login-expired-message {
  background: var(--warning-bg);
  border: 1px solid rgba(245,158,11,.2);
}

.login-expired-message p { color: var(--warning); }

.error-message {
  background: var(--danger-bg);
  border: 1px solid rgba(239,68,68,.2);
}

.error-message p { color: var(--danger); }

.login-footer {
  text-align: center;
  margin-top: 24px;
  font-size: .8rem;
  color: var(--text-muted);
}

/* ── Dashboard Header ───────────────────────────────── */

.header {
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 50;
}

.header-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 24px;
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.header-brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.header-title {
  font-weight: 700;
  font-size: 1.15rem;
  letter-spacing: -.015em;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 20px;
}

.header-user {
  display: flex;
  align-items: center;
  gap: 16px;
}

.user-email {
  font-size: .85rem;
  color: var(--text-secondary);
}

/* ── Language switcher ─────────────────────────────── */

.lang-switcher-wrap {
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: var(--bg-elevated);
}

.lang-btn {
  font-family: var(--font);
  font-size: .8rem;
  padding: 6px 12px;
  border: none;
  background: transparent;
  color: var(--text-secondary);
  cursor: pointer;
  transition: color var(--transition), background var(--transition);
}

.lang-btn:hover {
  color: var(--text-primary);
  background: var(--bg-card-hover);
}

.lang-btn.active {
  color: var(--text-primary);
  background: var(--accent);
  color: #fff;
}

.login-lang-row {
  display: flex;
  justify-content: center;
  margin-top: 20px;
}

/* ── Tab Navigation ─────────────────────────────────── */

.tabs-nav {
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border);
}

.tabs-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 24px;
  display: flex;
  gap: 4px;
}

.tab {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font);
  font-size: .875rem;
  font-weight: 500;
  color: var(--text-muted);
  background: none;
  border: none;
  padding: 14px 18px;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  transition: all var(--transition);
}

.tab:hover {
  color: var(--text-secondary);
}

.tab.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

.tab svg {
  opacity: .6;
  transition: opacity var(--transition);
}

.tab.active svg,
.tab:hover svg { opacity: 1; }

/* ── Main Content ───────────────────────────────────── */

.main {
  padding: 32px 0 60px;
}

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 24px;
}

.section-header {
  margin-bottom: 24px;
}

.section-header h2 {
  font-size: 1.35rem;
  font-weight: 700;
  letter-spacing: -.01em;
}

.section-desc {
  color: var(--text-muted);
  font-size: .9rem;
  margin-top: 4px;
}

/* ── States ─────────────────────────────────────────── */

.loading-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  padding: 60px 20px;
  color: var(--text-muted);
  font-size: .9rem;
}

.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  padding: 60px 20px;
  color: var(--text-muted);
  font-size: .9rem;
}

.empty-state svg { opacity: .3; }

.error-state {
  background: var(--danger-bg);
  border: 1px solid rgba(239,68,68,.2);
  border-radius: var(--radius);
  padding: 16px 20px;
  color: var(--danger);
  font-size: .9rem;
}

/* ── Data Table ─────────────────────────────────────── */

.table-wrap {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

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

.data-table thead {
  background: var(--bg-elevated);
}

.data-table th {
  padding: 12px 16px;
  text-align: left;
  font-weight: 600;
  font-size: .78rem;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
}

.data-table td {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

.data-table tbody tr:last-child td {
  border-bottom: none;
}

.data-table tbody tr {
  transition: background var(--transition);
}

.data-table tbody tr:hover {
  background: var(--bg-card-hover);
}

.cell-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

/* ── Invoice Detail Row ─────────────────────────────── */

.invoice-detail-row td {
  padding: 0;
  background: var(--bg-surface);
}

.invoice-detail-row:hover {
  background: var(--bg-surface) !important;
}

.invoice-detail {
  padding: 20px 24px;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
}

.detail-item label {
  display: block;
  font-size: .75rem;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--text-muted);
  margin-bottom: 4px;
}

.detail-item span {
  font-size: .9rem;
  color: var(--text-primary);
}

.detail-items-section {
  grid-column: 1 / -1;
  margin-top: 4px;
}

.detail-items-section > label {
  display: block;
  font-size: .75rem;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--text-muted);
  margin-bottom: 8px;
}

.items-table {
  width: 100%;
  border-collapse: collapse;
  font-size: .85rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
}

.items-table th {
  text-align: start;
  padding: 8px 12px;
  font-size: .7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--text-muted);
  background: var(--bg-elevated);
  border-bottom: 1px solid var(--border);
}

.items-table td {
  padding: 8px 12px;
  color: var(--text-primary);
  border-bottom: 1px solid var(--border);
}

.items-table tbody tr:last-child td {
  border-bottom: none;
}

.items-table tbody tr:hover {
  background: var(--bg-card-hover);
}

/* ── Badges ─────────────────────────────────────────── */

.badge {
  display: inline-flex;
  align-items: center;
  font-size: .75rem;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 100px;
  letter-spacing: .02em;
  text-transform: capitalize;
}

.badge-paid,
.badge-succeeded,
.badge-active   { background: var(--success-bg); color: var(--success); }
.badge-pending   { background: var(--warning-bg); color: var(--warning); }
.badge-overdue,
.badge-failed    { background: var(--danger-bg);  color: var(--danger); }
.badge-refunded  { background: var(--info-bg);    color: var(--info); }
.badge-frozen,
.badge-paused    { background: var(--frozen-bg);  color: var(--frozen); }
.badge-cancelled,
.badge-canceled  { background: var(--danger-bg);  color: var(--danger); }
.badge-draft     { background: rgba(100,116,139,.1); color: var(--text-muted); }

/* ── Subscription Cards ─────────────────────────────── */

.sub-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: 16px;
}

.sub-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px;
  transition: border-color var(--transition), box-shadow var(--transition);
}

.sub-card:hover {
  border-color: var(--border-light);
  box-shadow: var(--shadow);
}

.sub-card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 20px;
}

.sub-plan-name {
  font-size: 1.05rem;
  font-weight: 600;
}

.sub-meta {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  margin-bottom: 20px;
}

.sub-meta-item label {
  display: block;
  font-size: .72rem;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--text-muted);
  margin-bottom: 2px;
}

.sub-meta-item span {
  font-size: .9rem;
  color: var(--text-primary);
  font-weight: 500;
}

.sub-card-actions {
  display: flex;
  gap: 8px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}

/* ── Modal ──────────────────────────────────────────── */

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.6);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 20px;
}

.modal {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 480px;
  box-shadow: var(--shadow-lg);
  animation: modalIn .2s ease;
}

@keyframes modalIn {
  from { opacity: 0; transform: translateY(10px) scale(.97); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px;
  border-bottom: 1px solid var(--border);
}

.modal-header h3 {
  font-size: 1.05rem;
  font-weight: 600;
}

.modal-close {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 1.5rem;
  cursor: pointer;
  line-height: 1;
  padding: 4px;
  transition: color var(--transition);
}

.modal-close:hover { color: var(--text-primary); }

.modal-body {
  padding: 24px;
}

.modal-body .form-group {
  margin-bottom: 16px;
}

.modal-body .form-group:last-child {
  margin-bottom: 0;
}

.modal-footer {
  padding: 16px 24px;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

/* ── Toast Notifications ────────────────────────────── */

.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  z-index: 200;
}

.toast {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 20px;
  font-size: .875rem;
  box-shadow: var(--shadow-lg);
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 280px;
  max-width: 420px;
  animation: toastIn .25s ease;
}

.toast-success { border-left: 3px solid var(--success); }
.toast-error   { border-left: 3px solid var(--danger); }
.toast-info    { border-left: 3px solid var(--info); }

@keyframes toastIn {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0); }
}

.toast-exit {
  animation: toastOut .2s ease forwards;
}

@keyframes toastOut {
  to { opacity: 0; transform: translateY(-8px); }
}

/* ── Responsive ─────────────────────────────────────── */

@media (max-width: 768px) {
  html { font-size: 14px; }

  .header-inner {
    padding: 0 16px;
    height: 52px;
  }

  .header-actions { gap: 10px; }

  .header-hide-mobile { display: none; }

  .tabs-inner {
    padding: 0 16px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
  .tabs-inner::-webkit-scrollbar { display: none; }

  .container { padding: 0 16px; }

  .tab { padding: 12px 14px; font-size: .82rem; white-space: nowrap; }

  .user-email { display: none; }

  .sub-grid { grid-template-columns: 1fr; }

  .data-table { font-size: .82rem; }
  .data-table th, .data-table td { padding: 10px 12px; }

  .table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .table-wrap .data-table { min-width: 560px; }

  .invoice-detail { grid-template-columns: 1fr 1fr; }

  .login-card { padding: 28px 24px; }
  .login-container { padding: 16px; }

  .section-header h2 { font-size: 1.15rem; }
  .section-desc { font-size: .82rem; }

  .main { padding: 24px 0 40px; }

  .modal { max-width: calc(100vw - 32px); }
}

@media (max-width: 480px) {
  .invoice-detail { grid-template-columns: 1fr; }
  .cell-actions { flex-direction: column; }
  .sub-card-actions { flex-wrap: wrap; }

  .header-inner { gap: 8px; }
  .lang-switcher-wrap { order: 10; }

  .btn { padding: 12px 18px; font-size: .82rem; min-height: 44px; }
  .btn-sm { padding: 8px 14px; min-height: 36px; }
  .btn-xs { padding: 6px 10px; min-height: 32px; }

  .form-group input { padding: 14px 16px; font-size: 1rem; }
  .form-group label { font-size: .82rem; }

  .loading-state, .empty-state { padding: 40px 16px; }
}

/* ── Safe-area & Smooth Scroll ─────────────────────── */

html { scroll-behavior: smooth; }

@supports (padding: env(safe-area-inset-bottom)) {
  .cart-drawer-footer,
  .modal-footer { padding-bottom: calc(20px + env(safe-area-inset-bottom)); }
  body { padding-bottom: env(safe-area-inset-bottom); }
}

/* ── RTL Adjustments ────────────────────────────────── */

[dir="rtl"] .toast-container {
  right: auto;
  left: 24px;
}

[dir="rtl"] .toast-success { border-left: none; border-right: 3px solid var(--success); }
[dir="rtl"] .toast-error   { border-left: none; border-right: 3px solid var(--danger); }
[dir="rtl"] .toast-info    { border-left: none; border-right: 3px solid var(--info); }

[dir="rtl"] .data-table th { text-align: right; }

[dir="rtl"] .form-group input[dir="ltr"] {
  text-align: left;
  direction: ltr;
}

/* ============================================================
   Shop — Product Grid, Cards, Cart Drawer
   ============================================================ */

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

.product-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  display: flex;
  flex-direction: column;
  transition: border-color .22s ease, box-shadow .22s ease, transform .22s ease;
  overflow: hidden;
}

.product-card:hover {
  border-color: var(--border-light);
  box-shadow: 0 8px 24px rgba(0,0,0,.25);
  transform: translateY(-2px);
}

.product-card-body {
  padding: 24px 24px 16px;
  flex: 1;
}

.product-card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
}

.product-name {
  font-size: 1.05rem;
  font-weight: 600;
  line-height: 1.3;
}

.product-desc {
  font-size: .85rem;
  color: var(--text-secondary);
  line-height: 1.5;
  margin-bottom: 12px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.product-price {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--accent-light);
}

.product-vat {
  display: block;
  font-size: .75rem;
  color: var(--text-muted);
  margin-top: 2px;
}

.product-card-link {
  display: block;
  color: inherit;
  text-decoration: none;
}

.product-card-link:hover { color: inherit; }

.product-card-footer {
  padding: 0 24px 24px;
}

.product-in-cart-btn {
  color: var(--success) !important;
  border-color: var(--success) !important;
  opacity: .85;
}

/* ── Quantity Stepper (shared by cards + PDP) ────── */

.qty-row,
.card-qty-stepper {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--bg-elevated);
}

.qty-btn {
  width: 40px;
  height: 40px;
  padding: 0;
  border: none !important;
  border-radius: 0 !important;
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text-secondary);
  background: transparent;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: unset;
}

.qty-btn:hover:not(:disabled) {
  background: var(--bg-card-hover);
  color: var(--text-primary);
}

.qty-value {
  min-width: 44px;
  text-align: center;
  font-weight: 600;
  font-size: .95rem;
  color: var(--text-primary);
  user-select: none;
  border-inline-start: 1px solid var(--border);
  border-inline-end: 1px solid var(--border);
  height: 40px;
  line-height: 40px;
}

.pdp-qty-stepper .qty-row {
  margin-bottom: 12px;
}

.pdp-qty-stepper .qty-btn {
  width: 48px;
  height: 48px;
  font-size: 1.25rem;
}

.pdp-qty-stepper .qty-value {
  min-width: 60px;
  height: 48px;
  line-height: 48px;
  font-size: 1.1rem;
}

.pdp-remove-btn {
  color: var(--text-muted) !important;
  font-size: .82rem !important;
  gap: 6px;
}

.pdp-remove-btn:hover:not(:disabled) {
  color: var(--danger) !important;
}

.card-qty-stepper {
  width: 100%;
}

.card-qty-stepper .qty-btn {
  flex: 1;
}

.card-qty-stepper .qty-value {
  flex: 0 0 auto;
}

/* ── Cart Toggle Badge ───────────────────────────── */

.cart-toggle-btn {
  position: relative;
}

.cart-count {
  position: absolute;
  top: -4px;
  right: -4px;
  min-width: 18px;
  height: 18px;
  font-size: .7rem;
  font-weight: 700;
  background: var(--accent);
  color: #fff;
  border-radius: 100px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 5px;
  line-height: 1;
}

[dir="rtl"] .cart-count {
  right: auto;
  left: -4px;
}

/* ── Cart Drawer ─────────────────────────────────── */

.cart-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.5);
  backdrop-filter: blur(3px);
  z-index: 150;
}

.cart-drawer {
  position: fixed;
  top: 0;
  right: 0;
  width: 380px;
  max-width: 90vw;
  height: 100vh;
  background: var(--bg-card);
  border-left: 1px solid var(--border);
  z-index: 160;
  display: flex;
  flex-direction: column;
  transform: translateX(100%);
  transition: transform .25s ease;
}

[dir="rtl"] .cart-drawer {
  right: auto;
  left: 0;
  border-left: none;
  border-right: 1px solid var(--border);
  transform: translateX(-100%);
}

.cart-drawer.open {
  transform: translateX(0);
}

.cart-drawer-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px;
  border-bottom: 1px solid var(--border);
}

.cart-drawer-header h3 {
  font-size: 1.1rem;
  font-weight: 600;
}

.cart-drawer-body {
  flex: 1;
  overflow-y: auto;
  padding: 16px 24px;
}

.cart-empty-msg {
  text-align: center;
  color: var(--text-muted);
  padding: 40px 0;
}

.cart-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
}

.cart-item:last-child {
  border-bottom: none;
}

.cart-item-info {
  flex: 1;
  min-width: 0;
}

.cart-item-name {
  display: block;
  font-size: .9rem;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.cart-item-price {
  font-size: .8rem;
  color: var(--text-secondary);
}

.cart-item-controls {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.cart-item-qty {
  font-size: .85rem;
  font-weight: 600;
  min-width: 20px;
  text-align: center;
}

.cart-drawer-footer {
  padding: 20px 24px;
  border-top: 1px solid var(--border);
  background: var(--bg-surface);
}

.cart-total-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
  font-size: 1rem;
}

.cart-total-row strong {
  font-size: 1.15rem;
  color: var(--accent-light);
}

.cart-checkout-form .form-group {
  margin-bottom: 12px;
}

/* ── Subscribe Modal Summary ──────────────────────── */

.subscribe-summary {
  text-align: center;
  padding: 16px 0 20px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 20px;
}

.subscribe-product-name {
  font-size: 1.1rem;
  font-weight: 600;
  margin-bottom: 4px;
}

.subscribe-price-cycle {
  font-size: .95rem;
  color: var(--accent-light);
}

/* ── Product Detail Page (PDP) ────────────────────── */

.pdp-breadcrumb {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: .85rem;
  color: var(--text-muted);
  margin-bottom: 28px;
}

.pdp-breadcrumb a {
  color: var(--text-secondary);
  transition: color var(--transition);
}

.pdp-breadcrumb a:hover { color: var(--text-primary); }
.pdp-breadcrumb-sep { opacity: .4; }

.pdp-layout {
  display: grid;
  grid-template-columns: 1fr 380px;
  gap: 40px;
  align-items: start;
}

.pdp-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.pdp-title {
  font-size: 1.75rem;
  font-weight: 700;
  letter-spacing: -.02em;
  line-height: 1.2;
}

.pdp-description {
  font-size: .95rem;
  color: var(--text-secondary);
  line-height: 1.7;
  margin-bottom: 28px;
}

.pdp-meta {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.pdp-meta-item {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 14px 16px;
}

.pdp-meta-label {
  display: block;
  font-size: .72rem;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--text-muted);
  margin-bottom: 4px;
}

.pdp-meta-item span:last-child {
  font-size: .9rem;
  font-weight: 500;
}

.pdp-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 28px;
  position: sticky;
  top: 80px;
}

.pdp-price-block {
  margin-bottom: 24px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--border);
}

.pdp-price {
  font-size: 1.6rem;
  font-weight: 700;
  color: var(--accent-light);
  display: block;
}

.pdp-actions {
  margin-bottom: 16px;
}

.pdp-actions .form-group {
  margin-bottom: 12px;
}

.pdp-back-link {
  display: block;
  text-align: center;
  font-size: .85rem;
  color: var(--text-muted);
  padding-top: 16px;
  border-top: 1px solid var(--border);
  transition: color var(--transition);
}

.pdp-back-link:hover { color: var(--text-primary); }

.header-hide-mobile { }

@media (max-width: 900px) {
  .pdp-layout {
    grid-template-columns: 1fr;
    gap: 24px;
  }
  .pdp-card {
    position: static;
  }
}

@media (max-width: 480px) {
  .pdp-title { font-size: 1.35rem; }
  .pdp-price { font-size: 1.3rem; }
  .pdp-meta { grid-template-columns: 1fr; }
  .pdp-card { padding: 20px; }
}

/* ── Plan Card Accent ────────────────────────────── */

.plan-card {
  border-color: var(--accent-muted);
}

.plan-card:hover {
  border-color: var(--accent);
}

/* ── Shop Tab Content ────────────────────────────── */

.shop-tab-content {
  display: none;
}

.shop-tab-content.active {
  display: block;
}

/* ── Shop Responsive ─────────────────────────────── */

@media (max-width: 768px) {
  .products-grid {
    grid-template-columns: 1fr 1fr;
    gap: 14px;
  }
  .product-card-body { padding: 16px 16px 12px; }
  .product-card-footer { padding: 0 16px 16px; }
  .product-name { font-size: .95rem; }
  .product-price { font-size: 1.05rem; }
  .product-desc { font-size: .8rem; margin-bottom: 8px; }

  .cart-drawer {
    width: 100%;
    max-width: 100vw;
  }
}

@media (max-width: 480px) {
  .products-grid {
    grid-template-columns: 1fr;
  }
}
