/* dashboard.css — photographer app: dashboard, events, login, password reset.
   Same visual identity as the landing and guest pages (ivory / navy / champagne). */

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

:root {
  --primary:     #1F2A44;   /* navy — primary actions, active nav */
  --primary-h:   #2B3A5C;
  --on-primary:  #FFFFFF;
  --secondary:   #7D6234;   /* champagne ink — secondary accents (text-safe) */
  --accent:      #B08D57;   /* champagne — lines, icons, progress */
  --bg:          #F8F6F1;
  --bg-card:     #FFFFFF;
  --bg-sidebar:  #FFFFFF;
  --surface-2:   #F2EFE8;
  --text:        #1D2433;
  --muted:       #5A6273;
  --border:      #E5E0D6;
  --border-s:    #D3CCBF;
  --green:       #2E6A4F;
  --green-bg:    #EAF3EE;
  --red:         #A8322D;
  --red-bg:      #FBEDEC;
  --orange:      #8F5A12;
  --orange-bg:   #FBF2E4;
  --radius:      14px;
  --radius-sm:   10px;
  --shadow:      0 1px 2px rgba(29,36,51,.04), 0 8px 24px -14px rgba(29,36,51,.16);
  --ease:        .2s cubic-bezier(.4,0,.2,1);
  --sidebar-w:   252px;
  --font:        "IBM Plex Sans Arabic", "Tajawal", "Segoe UI", system-ui, sans-serif;
}

[data-theme="dark"] {
  --primary:     #B9C6E6;
  --primary-h:   #CFD8EE;
  --on-primary:  #111520;
  --secondary:   #D9C29A;
  --accent:      #C9A96E;
  --bg:          #10131A;
  --bg-card:     #171B24;
  --bg-sidebar:  #141821;
  --surface-2:   #1E2330;
  --text:        #E8EAF0;
  --muted:       #9CA3B3;
  --border:      #282E3B;
  --border-s:    #353C4B;
  --green:       #6CC39A;
  --green-bg:    rgba(108,195,154,.12);
  --red:         #F08B84;
  --red-bg:      rgba(240,139,132,.12);
  --orange:      #E7B26A;
  --orange-bg:   rgba(231,178,106,.12);
  --shadow:      none;
}

html { -webkit-text-size-adjust: 100%; }
html, body {
  min-height: 100%;
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  font-size: 15px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 6px; }
[hidden] { display: none !important; }

/* ── Icons ───────────────────────────────────────────────────────────────── */
.icon { display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; line-height: 1; vertical-align: middle; }
.icon svg { width: 1em; height: 1em; display: block; stroke: currentColor; }
.btn .icon { font-size: 1.05em; }

/* ── Layout ──────────────────────────────────────────────────────────────── */
.layout { min-height: 100vh; }

.sidebar {
  position: fixed; top: 0; right: 0; bottom: 0; z-index: 120;
  width: var(--sidebar-w);
  background: var(--bg-sidebar);
  border-left: 1px solid var(--border);
  display: flex; flex-direction: column;
  overflow-y: auto;
}
.sidebar-brand {
  display: flex; align-items: center; gap: 10px;
  padding: 20px 20px 18px; border-bottom: 1px solid var(--border);
}
.brand-icon {
  width: 34px; height: 34px; border-radius: 50%;
  border: 1px solid var(--accent); color: var(--accent);
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 1.05rem;
}
.brand-name { font-size: 1.05rem; font-weight: 700; color: var(--text); }

.nav-links { list-style: none; padding: 12px 10px; flex: 1; display: flex; flex-direction: column; gap: 2px; }
.nav-links li a {
  display: flex; align-items: center; gap: 12px;
  padding: 11px 14px; border-radius: 10px;
  font-size: .92rem; font-weight: 500; color: var(--muted);
  transition: background var(--ease), color var(--ease);
}
.nav-links li a .nav-icon { font-size: 1.1rem; }
.nav-links li a:hover { color: var(--text); background: var(--surface-2); }
.nav-links li a.active { color: var(--text); background: var(--surface-2); box-shadow: inset -3px 0 0 var(--accent); }

.sidebar-footer { padding: 16px 18px 20px; border-top: 1px solid var(--border); display: grid; gap: 8px; }
.sidebar-user { display: flex; align-items: center; gap: 10px; font-size: .8rem; color: var(--muted); min-width: 0; }
.sidebar-user > div { min-width: 0; }
.sidebar-user strong { display: block; color: var(--text); font-size: .9rem; font-weight: 600; }
.sidebar-user span, .sidebar-user strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sidebar-footer .btn { width: 100%; justify-content: center; }

.content { margin-right: var(--sidebar-w); padding: 36px 40px 72px; max-width: calc(1280px + var(--sidebar-w)); }

/* Mobile top bar + drawer scrim (hidden on desktop) */
.topbar { display: none; }
.scrim { display: none; }

.page-header { margin-bottom: 28px; display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 14px 20px; }
.page-header h1 { font-size: 1.6rem; font-weight: 700; line-height: 1.35; }
.page-header p { font-size: .92rem; color: var(--muted); margin-top: 4px; }

.section-title { font-size: 1.05rem; font-weight: 600; }

/* ── Cards ───────────────────────────────────────────────────────────────── */
.card {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 22px 24px; box-shadow: var(--shadow);
}
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; }

/* ── Stats ───────────────────────────────────────────────────────────────── */
.stats-row { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; margin-bottom: 24px; }
.stat-card {
  background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 18px 20px; display: flex; flex-direction: column; gap: 6px; box-shadow: var(--shadow); min-width: 0;
}
.stat-card .stat-label { font-size: .85rem; color: var(--muted); font-weight: 500; }
.stat-card .stat-value { font-size: 1.9rem; font-weight: 700; color: var(--text); line-height: 1.15; }
.stat-card .stat-sub { font-size: .8rem; color: var(--muted); }

/* ── Plan card + meters ──────────────────────────────────────────────────── */
.plan-card { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); gap: 24px 32px; align-items: center; margin-bottom: 24px; }
.plan-name { font-size: 1.35rem; font-weight: 700; margin: 2px 0 6px; }
.plan-kicker { font-size: .82rem; color: var(--secondary); font-weight: 600; }
.plan-meta { color: var(--muted); font-size: .9rem; display: flex; flex-wrap: wrap; gap: 4px 16px; }
.plan-actions { margin-top: 14px; display: flex; flex-wrap: wrap; gap: 10px; }
.meters { display: grid; gap: 16px; }
.meter-head { display: flex; justify-content: space-between; gap: 10px; font-size: .88rem; margin-bottom: 6px; }
.meter-head span:last-child { color: var(--muted); font-variant-numeric: tabular-nums; }
.meter { height: 8px; border-radius: 99px; background: var(--surface-2); overflow: hidden; }
.meter > span { display: block; height: 100%; border-radius: inherit; background: var(--accent); transition: width .4s ease; }
.meter.warn > span { background: var(--orange); }
.meter.full > span { background: var(--red); }

/* ── Alerts ──────────────────────────────────────────────────────────────── */
.alert {
  display: flex; gap: 12px; align-items: flex-start;
  padding: 14px 16px; border-radius: var(--radius-sm); margin-bottom: 20px;
  font-size: .92rem; line-height: 1.65; border: 1px solid transparent;
}
.alert .icon { font-size: 1.15rem; margin-top: 2px; }
.alert strong { font-weight: 600; }
.alert .alert-body { flex: 1; min-width: 0; }
.alert .alert-actions { margin-top: 8px; display: flex; gap: 8px; flex-wrap: wrap; }
.alert-warn   { background: var(--orange-bg); color: var(--orange); border-color: color-mix(in srgb, var(--orange) 25%, transparent); }
.alert-danger { background: var(--red-bg);    color: var(--red);    border-color: color-mix(in srgb, var(--red) 25%, transparent); }
.alert-info   { background: var(--surface-2); color: var(--text);   border-color: var(--border); }

/* ── Buttons ─────────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 40px; padding: 8px 16px; border-radius: 10px;
  border: 1px solid var(--border-s); background: var(--bg-card);
  font-family: inherit; font-size: .9rem; font-weight: 500; color: var(--text);
  cursor: pointer; white-space: nowrap; text-decoration: none;
  transition: background var(--ease), border-color var(--ease), color var(--ease);
}
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn-primary { background: var(--primary); border-color: var(--primary); color: var(--on-primary); }
.btn-primary:hover:not(:disabled) { background: var(--primary-h); border-color: var(--primary-h); }
.btn-ghost { background: transparent; }
.btn-ghost:hover:not(:disabled) { background: var(--surface-2); border-color: var(--border-s); }
.btn-danger { background: transparent; color: var(--red); border-color: color-mix(in srgb, var(--red) 35%, transparent); }
.btn-danger:hover:not(:disabled) { background: var(--red-bg); }
.btn-sm { min-height: 34px; padding: 5px 12px; font-size: .84rem; }
.btn-icon { width: 40px; padding: 0; }

/* ── Badges ──────────────────────────────────────────────────────────────── */
.badge { display: inline-flex; align-items: center; gap: 5px; padding: 3px 10px; border-radius: 99px; font-size: .78rem; font-weight: 600; white-space: nowrap; }
.badge-active   { background: var(--green-bg);  color: var(--green); }
.badge-upcoming { background: var(--surface-2); color: var(--secondary); }
.badge-done     { background: var(--surface-2); color: var(--muted); }
.badge-warn     { background: var(--orange-bg); color: var(--orange); }
.badge-danger   { background: var(--red-bg);    color: var(--red); }

/* ── Lists ───────────────────────────────────────────────────────────────── */
.list-row { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 13px 0; border-bottom: 1px solid var(--border); }
.list-row:last-child { border-bottom: 0; }
.list-row .title { font-weight: 500; overflow-wrap: anywhere; }
.list-row .sub { font-size: .82rem; color: var(--muted); margin-top: 2px; }
.list-row .end { display: flex; align-items: center; gap: 10px; flex-shrink: 0; }

/* ── Event cards (events page) ───────────────────────────────────────────── */
.events-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 16px; }
.event-card {
  background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 20px 22px; display: flex; flex-direction: column; gap: 14px; box-shadow: var(--shadow);
  transition: border-color var(--ease); min-width: 0;
}
.event-card:hover { border-color: var(--border-s); }
.event-card-header { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; }
.event-card-name { font-size: 1.05rem; font-weight: 600; line-height: 1.4; overflow-wrap: anywhere; }
.event-card-meta { font-size: .84rem; color: var(--muted); display: flex; flex-wrap: wrap; gap: 4px 14px; }
.event-card-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.event-index { font-size: .82rem; color: var(--muted); display: grid; gap: 6px; }
.event-index .meter { height: 6px; }

.event-card-id {
  font-size: .78rem; color: var(--muted); background: var(--surface-2);
  border: 1px solid var(--border); border-radius: 8px; padding: 6px 10px;
  font-family: ui-monospace, "Cascadia Mono", Consolas, monospace; cursor: pointer;
  transition: color var(--ease), border-color var(--ease);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.event-card-id:hover { color: var(--text); border-color: var(--border-s); }

.guest-share { display: flex; align-items: center; gap: 12px; }
.guest-share-actions { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 8px; }
.guest-share-actions .btn { align-self: flex-start; }
.qr-thumb {
  flex-shrink: 0; width: 80px; height: 80px; padding: 4px; background: #fff;
  border: 1px solid var(--border); border-radius: 10px; cursor: zoom-in; transition: border-color var(--ease);
}
.qr-thumb:hover, .qr-thumb:focus-visible { border-color: var(--accent); }
.qr-thumb img { width: 100%; height: 100%; display: block; image-rendering: pixelated; }

/* ── Empty state ─────────────────────────────────────────────────────────── */
.empty-state { text-align: center; padding: 48px 20px; color: var(--muted); }
.empty-state .empty-icon { font-size: 2.6rem; margin-bottom: 12px; color: var(--accent); }
.empty-state h3 { font-size: 1.05rem; color: var(--text); margin-bottom: 6px; }
.empty-state p { font-size: .92rem; line-height: 1.7; }

/* ── Skeleton ────────────────────────────────────────────────────────────── */
.skeleton { display: block; border-radius: 8px; background: var(--surface-2); animation: pulse 1.4s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: .55; } }

/* ── Modal ───────────────────────────────────────────────────────────────── */
.modal-overlay {
  position: fixed; inset: 0; z-index: 200; padding: 16px;
  background: rgba(16,19,26,.5); display: flex; align-items: center; justify-content: center;
  opacity: 0; visibility: hidden; pointer-events: none; transition: opacity var(--ease), visibility var(--ease);
}
.modal-overlay.open { opacity: 1; visibility: visible; pointer-events: auto; }
.modal {
  background: var(--bg-card); border: 1px solid var(--border); border-radius: 18px;
  padding: 26px 28px; width: min(520px, 100%); max-height: 90vh; overflow-y: auto;
  transform: translateY(10px); transition: transform var(--ease);
  box-shadow: 0 24px 60px -20px rgba(16,19,26,.35);
}
.modal-overlay.open .modal { transform: none; }
.modal-header { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 20px; }
.modal-header h2 { font-size: 1.15rem; font-weight: 600; }
.modal-close {
  width: 36px; height: 36px; border-radius: 50%; border: 0; background: transparent;
  color: var(--muted); font-size: 1.1rem; cursor: pointer; display: grid; place-items: center;
}
.modal-close:hover { background: var(--surface-2); color: var(--text); }

/* ── Forms ───────────────────────────────────────────────────────────────── */
.form-group { display: flex; flex-direction: column; gap: 6px; margin-bottom: 16px; }
.form-group label { font-size: .86rem; color: var(--text); font-weight: 500; }
.form-group input, .form-group select, .form-group textarea, .input {
  width: 100%; min-height: 44px; padding: 10px 14px;
  background: var(--bg-card); color: var(--text);
  border: 1px solid var(--border-s); border-radius: 10px;
  font-family: inherit; font-size: .95rem; outline: none;
  transition: border-color var(--ease), box-shadow var(--ease);
}
.form-group input:focus, .form-group select:focus, .form-group textarea:focus, .input:focus {
  border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 20%, transparent);
}
.form-group textarea { resize: vertical; min-height: 90px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.form-hint { font-size: .8rem; color: var(--muted); }
.form-error { font-size: .84rem; color: var(--red); min-height: 18px; }
.form-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 8px; flex-wrap: wrap; }

/* ── Date picker (assets/js/datepicker.js) ──────────────────────────────── */
.form-group input.dp-input { cursor: pointer; text-align: right; }
.dp-panel {
  background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 12px; max-width: 340px;
}
.dp-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.dp-jump { display: flex; gap: 6px; }
.form-group .dp-jump select {
  width: auto; min-height: 36px; padding: 4px 10px; font-size: .9rem; font-weight: 600;
  border-color: var(--border); cursor: pointer;
}
.dp-nav {
  display: grid; place-items: center; width: 36px; height: 36px; border-radius: 10px;
  border: 0; background: transparent; color: var(--text); cursor: pointer;
}
.dp-nav:hover { background: var(--surface-2); }
.dp-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; text-align: center; }
.dp-dow { font-size: .7rem; color: var(--muted); padding: 4px 0 6px; }
.dp-day {
  aspect-ratio: 1; min-height: 36px; border: 0; border-radius: 10px; background: transparent;
  color: var(--text); font-family: inherit; font-size: .9rem; cursor: pointer;
}
.dp-day:hover { background: var(--surface-2); }
.dp-dow.weekend, .dp-day.weekend { color: var(--red); }
.dp-day.today { box-shadow: inset 0 0 0 1px var(--accent); }
.dp-day.selected { background: var(--primary); color: var(--on-primary); }
.dp-foot { display: flex; justify-content: space-between; gap: 8px; margin-top: 10px; }

/* ── Toast ───────────────────────────────────────────────────────────────── */
.toast-wrap {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%); z-index: 300;
  display: flex; flex-direction: column; gap: 8px; pointer-events: none; width: max-content; max-width: calc(100vw - 32px);
}
.toast {
  background: var(--bg-card); border: 1px solid var(--border); border-radius: 12px;
  padding: 12px 18px; font-size: .9rem; animation: toast-in .25s ease both;
  pointer-events: auto; box-shadow: 0 10px 30px -12px rgba(16,19,26,.3);
}
.toast.ok  { border-color: var(--green); color: var(--green); }
.toast.err { border-color: var(--red);   color: var(--red); }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* ── Spinner ─────────────────────────────────────────────────────────────── */
.spin {
  display: inline-block; width: 15px; height: 15px; vertical-align: middle;
  border: 2px solid var(--border); border-top-color: var(--accent); border-radius: 50%;
  animation: sp .7s linear infinite;
}
@keyframes sp { to { transform: rotate(360deg); } }

/* ── Login / reset password ──────────────────────────────────────────────── */
.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px 16px; }
.login-card {
  width: min(440px, 100%); background: var(--bg-card); border: 1px solid var(--border);
  border-radius: 20px; padding: 34px 32px; box-shadow: var(--shadow);
}
.login-brand { text-align: center; margin-bottom: 26px; }
.login-brand .brand-icon { width: 52px; height: 52px; font-size: 1.5rem; margin: 0 auto 12px; display: flex; }
.login-brand h1 { font-size: 1.4rem; font-weight: 700; color: var(--text); }
.login-brand p { font-size: .9rem; color: var(--muted); margin-top: 4px; }
.login-tabs { display: flex; margin-bottom: 24px; border-bottom: 1px solid var(--border); }
.login-tab {
  flex: 1; background: none; border: 0; border-bottom: 2px solid transparent; padding: 11px 0;
  font-family: inherit; font-size: .92rem; font-weight: 500; color: var(--muted); cursor: pointer;
  transition: color var(--ease), border-color var(--ease);
}
.login-tab.active { color: var(--text); border-bottom-color: var(--accent); }

/* ── Theme switcher ──────────────────────────────────────────────────────── */
.theme-switcher { display: inline-flex; background: var(--surface-2); border-radius: 99px; padding: 3px; gap: 2px; }
.theme-opt {
  background: none; border: 0; border-radius: 99px; padding: 6px 9px; cursor: pointer;
  font-family: inherit; font-size: .82rem; color: var(--muted); display: inline-flex; align-items: center; gap: 4px;
}
.theme-opt .icon { font-size: 1rem; }
.theme-opt.active { background: var(--bg-card); color: var(--text); font-weight: 600; box-shadow: 0 1px 3px rgba(0,0,0,.12); }

/* ── Responsive ──────────────────────────────────────────────────────────── */
@media (max-width: 1180px) {
  .stats-row { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 960px) {
  /* Sidebar becomes an off-canvas drawer opened from the top bar */
  .sidebar {
    width: min(300px, 86vw); transform: translateX(100%);
    transition: transform .25s ease; box-shadow: none;
  }
  .sidebar.open { transform: none; box-shadow: -20px 0 50px -20px rgba(16,19,26,.4); }
  .scrim { display: block; position: fixed; inset: 0; z-index: 110; background: rgba(16,19,26,.45); opacity: 0; visibility: hidden; transition: opacity .25s ease, visibility .25s ease; }
  .scrim.open { opacity: 1; visibility: visible; }
  body.nav-open { overflow: hidden; }

  .topbar {
    display: flex; align-items: center; justify-content: space-between; gap: 12px;
    position: sticky; top: 0; z-index: 100; min-height: 60px; padding: 8px 16px;
    background: color-mix(in srgb, var(--bg) 92%, transparent);
    -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--border);
  }
  .topbar .brand { display: flex; align-items: center; gap: 10px; font-weight: 700; }
  .topbar .brand .brand-icon { width: 30px; height: 30px; font-size: .95rem; }

  .content { margin-right: 0; padding: 24px 20px 64px; }
  .plan-card { grid-template-columns: 1fr; }
}

@media (max-width: 600px) {
  .content { padding: 18px 16px 56px; }
  .page-header { margin-bottom: 20px; align-items: stretch; }
  .page-header h1 { font-size: 1.3rem; }
  .page-header > .btn, .page-header-actions { width: 100%; }
  .page-header-actions .btn { flex: 1; }
  .card { padding: 18px 16px; }
  .stats-row { gap: 10px; margin-bottom: 18px; }
  .stat-card { padding: 14px; }
  .stat-card .stat-value { font-size: 1.5rem; }
  .events-grid { grid-template-columns: 1fr; gap: 12px; }
  .event-card { padding: 16px; }
  .event-card-actions { display: grid; grid-template-columns: 1fr 1fr; }
  .event-card-actions .btn { width: 100%; }
  .form-row { grid-template-columns: 1fr; }
  .form-actions { flex-direction: column-reverse; }
  .form-actions .btn { width: 100%; min-height: 46px; }
  .modal-overlay { padding: 0; align-items: flex-end; }
  .modal { width: 100%; max-height: 92vh; border-radius: 18px 18px 0 0; padding: 22px 18px calc(22px + env(safe-area-inset-bottom)); }
  .toast-wrap { left: 16px; right: 16px; transform: none; width: auto; bottom: 16px; }
  .toast { text-align: center; }
  .login-card { padding: 28px 20px; }
  .btn { min-height: 44px; }
  .btn-sm { min-height: 38px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: .01ms !important; animation-duration: .01ms !important; }
}
