/**
 * Account dashboard app-shell layout. Loaded ALONGSIDE style.css (not
 * instead of it) — buttons, form fields, and toasts are already
 * defined there and are reused as-is here, not redefined, so the
 * dashboard and the homepage stay visually consistent without
 * duplicating component CSS.
 */

body.green-account-app { background: var(--mint-2); }

/* [hidden] must always win over .account-guest-gate/.account-shell's
   own display rules — same specificity, so without this the guest
   gate and the logged-in shell render simultaneously regardless of
   which one JS marked hidden. */
.account-guest-gate[hidden], .account-shell[hidden] { display: none; }

.account-app { min-height: 100vh; display: flex; flex-direction: column; }

/* ============ Minimal app top bar ============ */
.account-topbar {
  background: #fff; border-bottom: 1px solid var(--border);
  padding: 14px 28px; display: flex; align-items: center; justify-content: space-between;
  position: sticky; top: 0; z-index: 100;
}
.account-topbar-logo img { height: 38px; width: auto; }
.account-topbar-actions { display: flex; align-items: center; gap: 22px; }
.account-back-link { display: flex; align-items: center; gap: 8px; font-size: 13.5px; font-weight: 700; color: var(--dark-green); background: none; }
.account-back-link:hover { color: var(--primary); }
.account-mobile-menu-btn { display: none; width: 40px; height: 40px; border-radius: 50%; background: var(--mint); color: var(--dark-green); font-size: 16px; }

/* ============ Logged-out gate ============ */
.account-guest-gate { flex: 1; display: flex; align-items: center; justify-content: center; padding: 40px 20px; }
.account-guest-card { max-width: 420px; width: 100%; background: #fff; border-radius: var(--radius-lg); box-shadow: var(--shadow); padding: 40px 32px; text-align: center; }
.account-guest-icon { width: 64px; height: 64px; border-radius: 50%; background: var(--mint); color: var(--primary); font-size: 24px; display: flex; align-items: center; justify-content: center; margin: 0 auto 20px; }
.account-guest-card h2 { font-size: 21px; font-weight: 800; color: var(--dark-green); margin-bottom: 8px; }
.account-guest-card p { color: var(--muted); font-size: 13.5px; margin-bottom: 24px; }
.account-guest-card form { text-align: right; }

/* ============ App shell: sidebar + single content region ============ */
.account-shell { flex: 1; display: grid; grid-template-columns: 264px 1fr; align-items: start; }

.account-sidebar {
  background: #fff; border-inline-end: 1px solid var(--border);
  padding: 24px 16px; position: sticky; top: 65px;
  height: calc(100vh - 65px); overflow-y: auto; display: flex; flex-direction: column;
}
.account-profile-card { text-align: center; padding: 18px 10px 22px; border-bottom: 1px solid var(--border); margin-bottom: 16px; }
.account-avatar { width: 62px; height: 62px; border-radius: 50%; background: linear-gradient(135deg, var(--primary), var(--secondary)); color: #fff; font-size: 22px; font-weight: 800; display: flex; align-items: center; justify-content: center; margin: 0 auto 12px; }
.account-profile-card strong { display: block; font-size: 14.5px; color: var(--dark-green); margin-bottom: 3px; }
.account-profile-card span { font-size: 11.5px; color: var(--muted); word-break: break-all; }

.account-nav { list-style: none; flex: 1; }
.account-nav li { margin-bottom: 3px; }
.account-nav a {
  display: flex; align-items: center; gap: 11px; padding: 12px 14px; border-radius: 12px;
  font-size: 13.5px; font-weight: 700; color: var(--muted); transition: all .2s ease; position: relative;
}
.account-nav a i { width: 16px; text-align: center; color: var(--muted); }
.account-nav a:hover { background: var(--mint-2); color: var(--dark-green); }
.account-nav a.active { background: var(--mint); color: var(--primary); }
.account-nav a.active i { color: var(--primary); }
.account-nav-badge { margin-inline-start: auto; min-width: 19px; height: 19px; padding: 0 5px; border-radius: 99px; background: var(--danger); color: #fff; font-size: 10.5px; font-weight: 800; display: flex; align-items: center; justify-content: center; }
.account-nav-logout { display: flex; align-items: center; gap: 11px; padding: 12px 14px; border-radius: 12px; font-size: 13.5px; font-weight: 700; color: var(--danger); margin-top: 12px; }
.account-nav-logout:hover { background: #FEF2F2; }

.account-content { padding: 32px; max-width: 900px; }

/* ============ Shared dashboard content primitives ============ */
.dash-section-head { margin-bottom: 24px; }
.dash-section-head h1 { font-size: 24px; font-weight: 800; color: var(--dark-green); margin-bottom: 4px; }
.dash-section-head p { font-size: 13.5px; color: var(--muted); }

.dash-card { background: #fff; border: 1px solid var(--border); border-radius: var(--radius); padding: 22px; margin-bottom: 18px; }
.dash-card h3 { font-size: 15px; font-weight: 800; color: var(--dark-green); margin-bottom: 16px; }

.dash-stats-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; margin-bottom: 20px; }
.dash-stat { background: #fff; border: 1px solid var(--border); border-radius: var(--radius); padding: 18px; text-align: center; }
.dash-stat .num { font-size: 26px; font-weight: 800; color: var(--primary); display: block; }
.dash-stat .label { font-size: 12px; color: var(--muted); font-weight: 700; }

.dash-field-row { display: flex; justify-content: space-between; align-items: center; padding: 13px 0; border-bottom: 1px solid var(--border); transition: background .2s ease; }
.dash-field-row:hover { background: var(--mint-2); margin: 0 -12px; padding: 13px 12px; border-radius: 8px; }
.dash-field-row:last-child { border-bottom: none; }
.dash-field-row .label { font-size: 12.5px; color: var(--muted); font-weight: 700; }
.dash-field-row .value { font-size: 13.5px; color: var(--dark-green); font-weight: 700; }
.dash-badge { display: inline-flex; align-items: center; gap: 6px; font-size: 11.5px; font-weight: 800; padding: 4px 11px; border-radius: 99px; }
.dash-badge.verified { background: var(--mint); color: var(--dark-green); }
.dash-badge.unverified { background: #FEF3C7; color: #92400E; }

/* Rich empty state — always has a CTA (see green-core-client.js: emptyStateWithCta) */
.dash-empty { text-align: center; padding: 50px 20px; }
.dash-empty-icon { width: 68px; height: 68px; border-radius: 50%; background: var(--mint); color: var(--primary); font-size: 26px; display: flex; align-items: center; justify-content: center; margin: 0 auto 18px; }
.dash-empty h4 { font-size: 16.5px; font-weight: 800; color: var(--dark-green); margin-bottom: 8px; }
.dash-empty p { font-size: 13.5px; color: var(--muted); margin-bottom: 20px; max-width: 320px; margin-inline: auto; }

.dash-order-row { display: flex; justify-content: space-between; align-items: center; padding: 16px; border: 1px solid var(--border); border-radius: 14px; margin-bottom: 10px; cursor: pointer; transition: all .2s ease; }
.dash-order-row:hover { box-shadow: var(--shadow-sm); border-color: transparent; }
.dash-order-row .order-num { font-size: 14px; font-weight: 800; color: var(--dark-green); }
.dash-order-row .order-date { font-size: 11.5px; color: var(--muted); }
.dash-order-row .order-total { font-size: 14px; font-weight: 800; color: var(--primary); }

.dash-notif-row { display: flex; gap: 14px; padding: 14px 0; border-bottom: 1px solid var(--border); }
.dash-notif-row:last-child { border-bottom: none; }
.dash-notif-row.unread { background: var(--mint-2); margin: 0 -12px; padding: 14px 12px; border-radius: 10px; }
.dash-notif-icon { width: 38px; height: 38px; border-radius: 50%; background: var(--mint); color: var(--primary); display: flex; align-items: center; justify-content: center; font-size: 14px; flex-shrink: 0; }
.dash-notif-row p { font-size: 13px; color: var(--text); margin-bottom: 4px; }
.dash-notif-row span { font-size: 11px; color: var(--muted); }

.dash-address-card { border: 1.5px solid var(--border); border-radius: 14px; padding: 16px; margin-bottom: 12px; }
.dash-address-card.is-default { border-color: var(--primary); background: var(--mint-2); }
.dash-address-card h4 { font-size: 13.5px; font-weight: 800; color: var(--dark-green); margin-bottom: 6px; display: flex; align-items: center; gap: 8px; }
.dash-address-card p { font-size: 12.5px; color: var(--muted); margin-bottom: 3px; }
.dash-address-actions { display: flex; gap: 8px; margin-top: 12px; }

.dash-loading { text-align: center; padding: 60px 20px; color: var(--muted); }
.dash-loading i { font-size: 24px; margin-bottom: 10px; animation: dashSpin 1s linear infinite; }
@keyframes dashSpin { to { transform: rotate(360deg); } }

/* Order tracker (reused shape from the old modal's tracker, kept consistent) */
.dash-tracker { display: flex; justify-content: space-between; margin: 24px 0; position: relative; }
.dash-tracker::before { content: ''; position: absolute; top: 15px; left: 5%; right: 5%; height: 3px; background: var(--border); z-index: 0; }
.dash-tracker-step { position: relative; z-index: 1; text-align: center; flex: 1; }
.dash-tracker-dot { width: 32px; height: 32px; border-radius: 50%; background: var(--border); color: #94A3B8; display: flex; align-items: center; justify-content: center; font-size: 13px; margin: 0 auto 8px; }
.dash-tracker-step.done .dash-tracker-dot { background: var(--primary); color: #fff; }
.dash-tracker-step span { font-size: 10.5px; color: var(--muted); font-weight: 700; }

/* ============ Responsive: sidebar becomes a mobile drawer ============ */
@media (max-width: 900px) {
  .account-shell { grid-template-columns: 1fr; }
  .account-mobile-menu-btn { display: flex; align-items: center; justify-content: center; }
  .account-back-link span { display: none; }

  .account-sidebar {
    position: fixed; top: 0; bottom: 0; right: 0; width: min(300px, 82vw); height: 100vh;
    z-index: 200; box-shadow: var(--shadow-lg);
    transform: translateX(100%); transition: transform .3s ease;
  }
  .account-sidebar.open { transform: translateX(0); }

  .account-content { padding: 20px 16px; }
  .dash-stats-grid { grid-template-columns: 1fr; }
  .dash-order-row { flex-wrap: wrap; gap: 6px; }
}

/* Backdrop for the mobile sidebar drawer */
.account-sidebar-backdrop { position: fixed; inset: 0; background: rgba(11,68,41,.5); z-index: 199; opacity: 0; pointer-events: none; transition: opacity .3s ease; }
.account-sidebar-backdrop.open { opacity: 1; pointer-events: auto; }
