/* ===== MY FRAME — Studio Design (v2) =====
   Design language: dark ink top-bar, airy light canvas, photography-first.
   Radius rule: buttons = pill, cards/panels = 16px, inputs = 10px, photos = 12px.
   One accent: --blue. Ink navy for headings. */
:root {
  --navy:    #1e3a5f;
  --navy2:   #16304f;
  --ink:     #0d1826;          /* deep ink for top bar */
  --blue:    #2563eb;
  --blue-h:  #1d4ed8;
  --blue-soft: #eef4ff;
  --bg:      #f6f7f9;
  --white:   #ffffff;
  --text:    #16202e;
  --muted:   #68737f;
  --border:  #e7eaee;
  --surface: #ffffff;
  --red:     #ef4444;
  --green:   #10b981;
  --shadow:  0 1px 2px rgba(22,32,46,.05);
  --shadow-md: 0 8px 24px -8px rgba(22,32,46,.12);
  /* Corner scale: the ONLY radii used in the app.
     999 pill (buttons, chips) · 16 cards/modals · 12 photos · 10 inputs · 6 small bits · 50% circles. */
  --r-pill:  999px;
  --r-card:  16px;
  --r-photo: 12px;
  --r-input: 10px;
  --r-sm:    6px;
  /* Type scale: the ONLY font sizes used in the app (pages write var(--fs-N, Npx)).
     12 badges/dates · 13 secondary text · 14 body, buttons, fields · 16 card titles
     18 modal titles · 22 page titles · 28 big stat numbers · 40 large headings.
     Weights: 400 regular · 600 buttons and small titles · 800 page titles and big numbers.
     Screen-fluid hero titles (clamp) stay outside the scale on purpose. */
  --fs-12: 12px;
  --fs-13: 13px;
  --fs-14: 14px;
  --fs-16: 16px;
  --fs-18: 18px;
  --fs-22: 22px;
  --fs-28: 28px;
  --fs-40: 40px;
  --fw-regular: 400;
  --fw-semi:    600;
  --fw-bold:    800;
}
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
/* touch-action:manipulation kills the phone double-tap-to-zoom (two quick taps no longer
   zoom) while KEEPING two-finger pinch zoom. */
html, body { height: 100%; font-family: 'Inter', 'Noto Sans Arabic', sans-serif; background: var(--bg); color: var(--text); font-size: var(--fs-14, 14px); -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; text-rendering: optimizeLegibility; accent-color: var(--blue); caret-color: var(--blue); touch-action: manipulation; }
a { text-decoration: none; color: inherit; -webkit-tap-highlight-color: rgba(37,99,235,.15); }
/* Browser surfaces themed from the palette (text selection + keyboard focus),
   so every button, tab and link across the app gets a visible focus ring. */
::selection { background: rgba(37,99,235,.16); color: var(--ink); }
:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; border-radius: 6px; }

/* ===== AUTH PAGE ===== */
.auth-wrap {
  min-height: 100vh;
  min-height: 100dvh;   /* phones: the visible screen, so the box sits in the real middle */
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--ink);
  background-image: radial-gradient(1200px 600px at 80% -10%, rgba(37,99,235,.22), transparent 60%),
                    radial-gradient(800px 500px at 10% 110%, rgba(30,58,95,.6), transparent 65%);
  padding: 2rem;
}
.auth-box {
  background: var(--white);
  border-radius: 16px;
  padding: 2.75rem 2.5rem;
  width: 100%;
  max-width: 430px;
  box-shadow: 0 32px 80px rgba(0,0,0,.35);
}
.auth-logo {
  font-size: var(--fs-22, 22px);
  font-weight: 800;
  color: var(--navy);
  letter-spacing: -.03em;
  margin-bottom: .3rem;
  text-align: left;
}
.auth-sub {
  text-align: left;
  color: var(--muted);
  font-size: var(--fs-12, 12px);
  margin-bottom: 2rem;
}
.auth-tabs {
  display: flex;
  background: var(--bg);
  border-radius: 999px;
  padding: 4px;
  margin-bottom: 1.5rem;
}
.auth-tab {
  flex: 1;
  padding: .55rem;
  border: none;
  border-radius: 999px;
  background: transparent;
  font-family: inherit;
  font-size: var(--fs-12, 12px);
  cursor: pointer;
  color: var(--muted);
  transition: all .2s;
}
.auth-tab.active { background: var(--white); color: var(--text); font-weight: 600; box-shadow: var(--shadow-md); }

/* ===== APP SHELL — top-bar layout ===== */
.app-shell {
  display: flex;
  flex-direction: column;
  height: 100vh;
  overflow: hidden;
}

/* ===== TOP BAR (was sidebar) ===== */
.sidebar-wrap {
  position: relative;
  width: 100%;
  height: auto;
  display: block;
  flex-shrink: 0;
  z-index: 100;
}
.sidebar {
  width: 100%;
  min-width: 0;
  height: 58px;
  background: var(--ink);
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: .25rem;
  padding: 0 1rem;
  overflow: visible;
}
.sidebar-logo {
  padding: 0 .75rem 0 .25rem;
  border-bottom: none;
  display: flex;
  align-items: center;
  flex-shrink: 0;
}
.sidebar-logo img {
  width: auto;
  max-width: 120px;
  height: 24px;
  display: block;
}
.sidebar-user {
  padding: 0 1rem;
  border-bottom: none;
  border-left: 1px solid rgba(255,255,255,.12);
  margin-bottom: 0;
  flex-shrink: 1;
  min-width: 0;
  overflow: hidden;
}
.sidebar-user strong { display: block; color: #fff; font-size: var(--fs-12, 12px); font-weight: 600; margin-bottom: 0; line-height: 1.25; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidebar-user span { display: block; color: rgba(255,255,255,.45); font-size: var(--fs-12, 12px); line-height: 1.2; white-space: nowrap; }
.nav-item {
  display: inline-flex;
  align-items: center;
  gap: .5rem;
  padding: .45rem .9rem;
  border-radius: 999px;
  color: rgba(255,255,255,.6);
  font-size: var(--fs-12, 12px);
  transition: all .15s;
  cursor: pointer;
  white-space: nowrap;
  flex-shrink: 0;
}
.nav-item:hover { background: rgba(255,255,255,.08); color: #fff; }
.nav-item.active { background: rgba(37,99,235,.9); color: #fff; font-weight: 600; }
.nav-item svg { opacity: .75; flex-shrink: 0; }
.nav-item.active svg { opacity: 1; }
.nav-item[href="logout.php"] { color: #ef4444; }
.nav-item[href="logout.php"]:hover { background: rgba(239,68,68,.14); color: #ef4444; }
.nav-item[href="logout.php"] svg { opacity: 1; }
.sidebar-bottom { margin-top: 0; margin-inline-start: auto; border-top: none; padding: 0; display: flex; align-items: center; }

/* ===== MAIN AREA ===== */
.main-area {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  min-width: 0;
}
.main-header {
  background: transparent;
  border-bottom: none;
  padding: 1.6rem 2rem .4rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
  gap: 1rem;
  flex-wrap: wrap;
}
.main-header-title { font-size: var(--fs-18, 18px); font-weight: 800; letter-spacing: -.02em; color: var(--navy); }
.main-header-sub { font-size: var(--fs-12, 12px); color: var(--muted); margin-top: .2rem; }
.main-body { padding: 1.25rem 2rem 2rem; flex: 1; }

/* ===== GALLERY ADMIN LAYOUT ===== */
.gallery-admin {
  display: flex;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}
.gallery-left-panel {
  width: 260px;
  min-width: 260px;
  background: var(--white);
  border-left: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  overflow-y: auto;
}
.panel-cover-img {
  width: 100%;
  aspect-ratio: 4/3;
  object-fit: cover;
  display: block;
}
.panel-cover-placeholder {
  width: 100%;
  aspect-ratio: 4/3;
  background: linear-gradient(135deg, #dde3ec, #c8d0dc);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: .5rem;
  color: var(--muted);
  font-size: var(--fs-12, 12px);
}
.panel-tabs {
  display: flex;
  border-bottom: 1px solid var(--border);
}
.panel-tab {
  flex: 1;
  padding: .65rem .5rem;
  text-align: center;
  font-size: var(--fs-12, 12px);
  font-weight: 600;
  color: var(--muted);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  transition: all .15s;
  background: none;
  border-top: none;
  border-left: none;
  border-right: none;
  font-family: inherit;
}
.panel-tab.active { color: var(--blue); border-bottom-color: var(--blue); }
.panel-body { padding: 1rem; flex: 1; }
.panel-stat {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: .55rem 0;
  border-bottom: 1px solid var(--border);
  font-size: var(--fs-12, 12px);
}
.panel-stat:last-of-type { border-bottom: none; }
.panel-stat-label { color: var(--muted); }
.panel-stat-val { font-weight: 600; color: var(--text); }
.panel-section-title {
  font-size: var(--fs-12, 12px);
  font-weight: 600;
  letter-spacing: .07em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 1rem 0 .5rem;
}

/* Gallery right content */
.gallery-main {
  flex: 1;
  overflow-y: auto;
  min-width: 0;
  display: flex;
  flex-direction: column;
}
.gallery-toolbar {
  background: var(--white);
  border-bottom: 1px solid var(--border);
  padding: .75rem 1.25rem;
  display: flex;
  align-items: center;
  gap: .75rem;
  flex-shrink: 0;
  flex-wrap: wrap;
}
.gallery-main-body { padding: 1.25rem; position: relative; min-height: 300px; }

/* ===== STATS ===== */
.stats-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
  margin-bottom: 1.75rem;
}
.stat-card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--r-card);
  padding: 1.25rem 1.4rem;
  box-shadow: var(--shadow);
  position: relative;
  overflow: hidden;
}
.stat-card::before {
  content: '';
  position: absolute;
  inset-inline-start: 0;
  top: 0;
  bottom: 0;
  width: 4px;
  background: var(--blue);
  border-radius: 0 6px 6px 0;
  opacity: .85;
}
.stat-val { font-size: var(--fs-28, 28px); font-weight: 800; letter-spacing: -.03em; color: var(--navy); line-height: 1; }
.stat-label { font-size: var(--fs-12, 12px); color: var(--muted); margin-top: .4rem; }

/* ===== GALLERY CARDS — image-first overlay ===== */
.galleries-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 1rem;
}
@media (max-width: 1600px) { .galleries-grid { grid-template-columns: repeat(6, 1fr); } }
@media (max-width: 1360px) { .galleries-grid { grid-template-columns: repeat(5, 1fr); } }
@media (max-width: 1100px) { .galleries-grid { grid-template-columns: repeat(4, 1fr); } }
@media (max-width: 860px)  { .galleries-grid { grid-template-columns: repeat(3, 1fr); } }
.pager { display: flex; justify-content: center; flex-wrap: wrap; gap: .4rem; margin: 1.8rem 0 .5rem; }
.pager:empty { display: none; }
.pg-btn {
  min-width: 38px; height: 38px; padding: 0 .6rem;
  border: 1px solid var(--border, #e5e7eb); background: #fff; color: #1f2937;
  border-radius: 10px; font-family: inherit; font-size: var(--fs-12, 12px); font-weight: 600; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center; transition: .15s;
}
.pg-btn:hover:not(:disabled) { border-color: #2563eb; color: #2563eb; }
.pg-btn.on { background: #2563eb; border-color: #2563eb; color: #fff; }
.pg-btn:disabled { opacity: .4; cursor: default; }

.gallery-card {
  position: relative;
  background: linear-gradient(160deg, #24384f, #0d1826);
  border: none;
  border-radius: var(--r-card);
  overflow: hidden;
  cursor: pointer;
  transition: box-shadow .22s ease, transform .22s ease;
  box-shadow: var(--shadow);
  display: block;
  aspect-ratio: 4/4.4;
  height: auto;
}
.gallery-card:hover { box-shadow: 0 18px 40px -14px rgba(13,24,38,.4); transform: translateY(-4px); }
.gallery-card-cover {
  position: absolute;
  inset: 0;
  aspect-ratio: auto;
  background: transparent;
  overflow: hidden;
}
.gallery-card-cover img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform .45s ease; }
.gallery-card:hover .gallery-card-cover img { transform: scale(1.05); }
.no-cover {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--fs-28, 28px);
  opacity: .5;
}
.gallery-card-body {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  z-index: 2;
  padding: 3.2rem 1.15rem 1.1rem;
  background: linear-gradient(to top, rgba(13,24,38,.88) 0%, rgba(13,24,38,.45) 55%, transparent 100%);
}
.gallery-card-name { font-weight: 600; font-size: var(--fs-14, 14px); margin-bottom: .3rem; line-height: 1.45; color: #fff; text-shadow: 0 1px 2px rgba(0,0,0,.3); }
.gallery-card-meta { font-size: var(--fs-12, 12px); color: rgba(255,255,255,.75); display: flex; gap: .7rem; align-items: center; flex-wrap: wrap; }
.gallery-card-client { font-size: var(--fs-12, 12px); color: rgba(255,255,255,.65); margin-top: .2rem; }
.gallery-card-fav { color: #4ade80 !important; display: inline-flex; align-items: center; gap: 2px; }
.gallery-badge {
  display: inline-flex;
  align-items: center;
  background: rgba(16,185,129,.25);
  color: #6ee7b7;
  font-size: var(--fs-12, 12px);
  font-weight: 600;
  padding: .18rem .6rem;
  border-radius: 999px;
  margin-top: .5rem;
  backdrop-filter: none;
}
.gallery-badge.green { background: rgba(16,185,129,.25); color: #6ee7b7; }

/* ===== PHOTOS GRID ===== */
.photos-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: .85rem;
}
.photo-item {
  position: relative;
  aspect-ratio: 1;
  border-radius: var(--r-photo);
  overflow: hidden;
  background: #e8ecf1;
  cursor: pointer;
  transition: transform .15s ease, box-shadow .15s ease;
}
.photo-item:active {
  transform: scale(.95);
  box-shadow: 0 2px 8px rgba(0,0,0,.18);
}
.photo-item img { width: 100%; height: 100%; object-fit: cover; display: block; }
.photo-item:hover .photo-overlay { opacity: 1; }
.photo-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(13,24,38,.45), transparent 45%);
  display: flex;
  align-items: flex-start;
  justify-content: flex-end;
  padding: .45rem;
  opacity: 0;
  transition: opacity .2s;
}
.photo-delete {
  background: rgba(255,255,255,.95);
  color: var(--red);
  border: none;
  border-radius: 50%;
  width: 26px;
  height: 26px;
  font-size: var(--fs-12, 12px);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all .15s;
}
.photo-delete:hover { background: var(--red); color: #fff; }
.photo-selected-badge {
  position: absolute;
  bottom: .45rem;
  right: .45rem;
  background: #16a34a;
  color: #fff;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 1px 4px rgba(0,0,0,.25);
}
.photo-selected-badge svg { display: block; }
.photo-name {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  background: linear-gradient(transparent, rgba(13,24,38,.72));
  color: #fff;
  font-size: var(--fs-12, 12px);
  padding: .9rem .5rem .35rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ===== UPLOAD ===== */
.upload-area {
  border: 1.5px dashed #cfd6df;
  border-radius: var(--r-card);
  padding: 2.5rem 1.5rem;
  text-align: center;
  cursor: pointer;
  transition: all .2s;
  background: var(--white);
  color: var(--muted);
  margin-bottom: 1.25rem;
}
.upload-area:hover, .upload-area.drag { border-color: var(--blue); background: var(--blue-soft); color: var(--blue); }
.upload-area strong { color: var(--text); }
.progress-bar { height: 6px; background: var(--border); border-radius: 999px; margin-top: .5rem; overflow: hidden; position: relative; }
.progress-fill { height: 100%; background: var(--blue); transition: width .4s ease; border-radius: 999px; }
.progress-bar::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent 0%, rgba(255,255,255,.55) 50%, transparent 100%);
  animation: progress-shimmer 1.3s infinite;
}
@keyframes progress-shimmer { from { transform: translateX(-100%); } to { transform: translateX(100%); } }

/* ===== SHARE MODAL ===== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(13,24,38,.6);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity .2s, visibility .2s;
}
.modal-overlay.open { opacity: 1; visibility: visible; pointer-events: all; }
.modal {
  background: var(--white);
  border-radius: 16px;
  padding: 1.75rem;
  width: 90%;
  max-width: 440px;
  box-shadow: 0 32px 80px rgba(0,0,0,.3);
  transform: translateY(16px) scale(.98);
  transition: transform .22s cubic-bezier(.16,1,.3,1);
}
.modal-overlay.open .modal { transform: translateY(0) scale(1); }
.modal-title {
  font-size: var(--fs-18, 18px);
  font-weight: 800;
  margin-bottom: 1.25rem;
  color: var(--navy);
  text-align: left;
  direction: ltr;
}
.modal-close-btn {
  float: right;
  background: var(--bg);
  border: none;
  border-radius: 50%;
  width: 28px;
  height: 28px;
  font-size: var(--fs-12, 12px);
  cursor: pointer;
  color: var(--muted);
  line-height: 1;
  margin-top: -.15rem;
  transition: all .15s;
}
.modal-close-btn:hover { background: var(--border); color: var(--text); }
.modal, .share-option { direction: ltr !important; text-align: left !important; }
.share-option {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: .9rem 1rem;
  border: 1px solid var(--border);
  border-radius: 16px;
  margin-bottom: .65rem;
  cursor: pointer;
  transition: all .15s;
  background: var(--white);
  width: 100%;
  text-align: left;
  font-family: inherit;
}
.share-option:hover { border-color: var(--blue); background: var(--blue-soft); }
.share-icon {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--fs-16, 16px);
  flex-shrink: 0;
}
.share-icon.gold  { background: #fef3c7; color: #d97706; }
.share-icon.blue  { background: var(--blue-soft); color: var(--blue); }
.share-icon.terra { background: #fee2e2; color: #b45309; }
.share-label { font-weight: 600; font-size: var(--fs-12, 12px); color: var(--text); }
.share-sub   { font-size: var(--fs-12, 12px); color: var(--muted); margin-top: .1rem; }
.share-chevron { margin-left: auto; color: #c3cdd9; font-size: var(--fs-16, 16px); }
.share-email-form { display: none; margin-top: .75rem; }
.share-email-form.open { display: block; }

/* ===== CLIENT VIEW (legacy classes) ===== */
.client-wrap { min-height: 100vh; background: var(--bg); }
.client-header {
  background: rgba(255,255,255,.97);
  border-bottom: 1px solid var(--border);
  padding: .9rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 50;
}
.client-logo { font-size: var(--fs-14, 14px); font-weight: 800; color: var(--navy); }
.client-gallery-name { font-size: var(--fs-12, 12px); color: var(--muted); }
.client-actions { display: flex; align-items: center; gap: .75rem; }
.sel-count {
  font-size: var(--fs-12, 12px);
  color: var(--blue);
  font-weight: 600;
  background: var(--blue-soft);
  padding: .25rem .7rem;
  border-radius: 999px;
}
.client-info-bar {
  background: var(--blue-soft);
  border-bottom: 1px solid #d7e4fb;
  padding: .55rem 1.5rem;
  font-size: var(--fs-12, 12px);
  color: var(--blue);
  text-align: center;
}
.client-photos {
  padding: 1.25rem;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 1rem;
}
.client-photo {
  position: relative;
  aspect-ratio: 1;
  border-radius: var(--r-photo);
  overflow: hidden;
  cursor: pointer;
  box-shadow: var(--shadow);
}
.client-photo img { width: 100%; height: 100%; object-fit: cover; display: block; }
.client-photo.selected { box-shadow: 0 0 0 3px var(--blue); }
.heart-btn {
  position: absolute;
  bottom: .5rem;
  right: .5rem;
  background: rgba(255,255,255,.92);
  border: none;
  border-radius: 50%;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--blue);
  transition: all .15s;
}
.client-photo.selected .heart-btn { background: var(--blue); color: #fff; }

/* ===== LIGHTBOX ===== */
.lightbox {
  position: fixed;
  inset: 0;
  background: rgba(8,13,21,.95);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 9999;
}
.lightbox.open { display: flex; }
.lightbox img { max-height: 85vh; max-width: 85vw; border-radius: 6px; }
.lightbox-close, .lightbox-prev, .lightbox-next, .lightbox-heart {
  position: absolute;
  background: rgba(255,255,255,.14);
  border: none;
  color: #fff;
  cursor: pointer;
  border-radius: 50%;
  width: 42px;
  height: 42px;
  font-size: var(--fs-16, 16px);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background .15s;
}
.lightbox-close:hover, .lightbox-prev:hover, .lightbox-next:hover, .lightbox-heart:hover { background: rgba(255,255,255,.26); }
.lightbox-close { top: 1rem; right: 1rem; font-size: var(--fs-13, 13px); }
.lightbox-prev { left: 1rem; }
.lightbox-next { right: 1rem; }
.lightbox-heart {
  bottom: 1rem;
  right: 50%;
  transform: translateX(50%);
  width: auto;
  border-radius: 999px;
  padding: 0 1.2rem;
  gap: .4rem;
  font-size: var(--fs-12, 12px);
}
.lightbox-heart.selected { background: var(--blue); }

/* ===== FORMS ===== */
.form-group { margin-bottom: 1rem; }
.form-group label { display: block; font-size: var(--fs-12, 12px); font-weight: 600; color: var(--text); margin-bottom: .35rem; }
.form-group input, .form-group select, .form-group textarea {
  width: 100%;
  padding: .65rem .9rem;
  border: 1px solid var(--border);
  border-radius: var(--r-input);
  font-family: inherit;
  font-size: var(--fs-12, 12px);
  color: var(--text);
  background: var(--white);
  transition: border-color .15s, box-shadow .15s;
  outline: none;
}
.form-group input:focus, .form-group select:focus, .form-group textarea:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(37,99,235,.12);
}

/* ===== BUTTONS: one system =====
   Types: primary / ghost / navy / danger. Sizes: default (38px) / sm (32px) / full (44px, 100% wide).
   Always pill, 14/600 (sm 13/600). */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .4rem;
  min-height: 38px;
  padding: 0 1.2rem;
  border-radius: var(--r-pill, 999px);
  font-family: inherit;
  font-size: var(--fs-14, 14px);
  font-weight: 600;
  line-height: 1.2;
  cursor: pointer;
  border: none;
  transition: all .15s;
  text-decoration: none;
  white-space: nowrap;
}
.btn:active { transform: translateY(1px) scale(.98); }
.btn-primary { background: var(--blue); color: #fff; box-shadow: 0 4px 14px -4px rgba(37,99,235,.5); }
.btn-primary:hover { background: var(--blue-h); box-shadow: 0 8px 20px -6px rgba(37,99,235,.55); }
.btn-ghost { background: var(--white); color: var(--text); border: 1px solid var(--border); }
.btn-ghost:hover { background: var(--bg); border-color: #d5dbe3; }
.btn-danger { background: #fee2e2; color: var(--red); }
.btn-danger:hover { background: var(--red); color: #fff; }
.btn-navy { background: var(--navy); color: #fff; }
.btn-navy:hover { background: var(--navy2); }
.btn-sm { min-height: 32px; padding: 0 .9rem; font-size: var(--fs-13, 13px); }
.btn-full { width: 100%; justify-content: center; min-height: 44px; padding: 0 1.2rem; }
.btn:disabled { opacity: .5; cursor: default; transform: none; }

/* ===== TOGGLE SWITCH ===== */
.wm-toggle { position:relative; display:inline-block; width:44px; height:24px; flex-shrink:0; }
.wm-toggle input { opacity:0; width:0; height:0; }
.wm-slider { position:absolute; inset:0; background:#cbd5e1; border-radius:999px; cursor:pointer; transition:.25s; }
.wm-slider::before { content:''; position:absolute; width:18px; height:18px; left:3px; top:3px; background:#fff; border-radius:50%; transition:.25s; }
.wm-toggle input:checked + .wm-slider { background:var(--blue); }
.wm-toggle input:checked + .wm-slider::before { transform:translateX(20px); }

/* ===== PAGE HEADER ===== */
.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.5rem;
  gap: 1rem;
  flex-wrap: wrap;
}
.page-title { font-size: var(--fs-18, 18px); font-weight: 800; letter-spacing: -.02em; color: var(--navy); }
.page-sub { font-size: var(--fs-12, 12px); color: var(--muted); margin-top: .15rem; }

/* ===== EMPTY STATE ===== */
.empty-state { text-align: center; padding: 4.5rem 2rem; color: var(--muted); }
.empty-state svg { margin-bottom: 1rem; color: #c3cdd9; }
.empty-state p { font-size: var(--fs-13, 13px); margin-bottom: 1rem; }

/* ===== ALERTS ===== */
.alert { padding: .8rem 1.1rem; border-radius: var(--r-input); font-size: var(--fs-12, 12px); margin-bottom: 1rem; }
.alert-error   { background: #fee2e2; color: #991b1b; }
.alert-success { background: #e8f9f1; color: #067a4e; }

/* ===== TAGS / BADGES ===== */
.tag {
  display: inline-flex;
  align-items: center;
  background: var(--bg);
  border: 1px solid var(--border);
  padding: .35rem .75rem;
  border-radius: 10px;
  font-size: var(--fs-12, 12px);
  font-family: monospace;
  color: var(--text);
  word-break: break-all;
}
.badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 20px;
  height: 20px;
  padding: 0 .45rem;
  border-radius: 999px;
  font-size: var(--fs-12, 12px);
  font-weight: 600;
}
.badge-blue { background: var(--blue-soft); color: var(--blue); }

/* ===== SELECTIONS ===== */
.sel-info {
  background: var(--blue-soft);
  border: 1px solid #d7e4fb;
  border-radius: var(--r-card);
  padding: 1rem 1.5rem;
  margin-bottom: 1.5rem;
  font-size: var(--fs-12, 12px);
  color: var(--blue);
}
.sel-photo { border-radius: var(--r-photo); overflow: hidden; aspect-ratio: 1; box-shadow: var(--shadow); }
.sel-photo img { width: 100%; height: 100%; object-fit: cover; display: block; }

/* ===== TOAST ===== */
#toast {
  position: fixed;
  bottom: 2rem;
  left: 50%;
  transform: translateX(-50%) translateY(60px);
  background: var(--ink);
  color: #fff;
  padding: .7rem 1.5rem;
  border-radius: 999px;
  font-size: var(--fs-12, 12px);
  box-shadow: 0 12px 32px rgba(0,0,0,.28);
  transition: transform .3s;
  z-index: 9999;
  pointer-events: none;
}

/* ===== SCROLLBAR ===== */
@supports (scrollbar-width: thin) { * { scrollbar-width: thin; scrollbar-color: #c3cdd9 transparent; } }
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #c3cdd9; border-radius: 999px; }
::-webkit-scrollbar-thumb:hover { background: #a9b4c1; }

/* ===== SIDEBAR COLLAPSE BUTTON — unused in top-bar layout ===== */
.sidebar-toggle { display: none !important; }
.sidebar-collapse-btn { display: none !important; }
body.sidebar-collapsed .sidebar { width: 100%; min-width: 0; overflow: visible; }
body.sidebar-collapsed .main-area { margin-right: 0; }

/* Overlay unused in top-bar layout */
.sidebar-overlay { display: none !important; }

/* ===== MOBILE RESPONSIVE ===== */
@media (max-width: 768px) {
  .sidebar-wrap { width: 100%; height: auto; }

  /* Top bar stays fixed at top, nav scrolls horizontally */
  .sidebar {
    position: relative;
    transform: none !important;
    width: 100%;
    min-width: 0;
    height: 54px;
    padding: 0 .6rem;
    box-shadow: none;
    overflow-x: auto;
    overflow-y: hidden;
    scrollbar-width: none;
  }
  .sidebar::-webkit-scrollbar { display: none; }
  body.sidebar-open .sidebar { transform: none; }

  .sidebar-logo img { height: 20px; }
  .sidebar-user { display: none; }
  .nav-item { padding: .4rem .7rem; font-size: var(--fs-12, 12px); }

  .main-area { width: 100%; }

  .main-header {
    padding: 1.1rem 1rem .3rem;
    gap: .5rem;
  }
  .main-header-title { font-size: var(--fs-16, 16px); }
  .main-body { padding: 1rem; }

  .stats-row {
    grid-template-columns: repeat(3, 1fr);
    gap: .6rem;
    margin-bottom: 1rem;
  }
  .stat-card { padding: .8rem .85rem; }
  .stat-val { font-size: var(--fs-18, 18px); }
  .stat-label { font-size: var(--fs-12, 12px); }

  .galleries-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: .75rem;
  }
  .gallery-card-name { font-size: var(--fs-12, 12px); }

  /* Gallery view (gv) mobile */
  .gv-hero { margin: .75rem .75rem 0; height: 190px; border-radius: 16px; }
  .gv-hero-content { padding: 0 1rem 1rem; }
  .gv-hero-title { font-size: var(--fs-18, 18px); }
  .gv-hero-meta { font-size: var(--fs-12, 12px); }
  .gv-hero-actions .btn { min-height: 32px; padding: 0 .9rem; font-size: var(--fs-13, 13px); }
  .gv-toolbar { padding: .75rem .75rem 0; }
  .gv-content { padding: .75rem .75rem 1.5rem; }
  .gv-upload { margin: 0; width: 100%; justify-content: center; }

  .photos-grid {
    grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
    gap: .5rem;
  }

  .app-shell { overflow: visible; height: auto; min-height: 100vh; }

  .upload-area.gv-upload { padding: .55rem 1rem; }

  .page-header { flex-direction: column; align-items: flex-start; gap: .5rem; }

  .photo-action-bar { font-size: var(--fs-12, 12px); }
  .bar-btn { padding: .3rem .55rem; font-size: var(--fs-12, 12px); }

  .client-photos {
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: .6rem;
    padding: .75rem;
  }
}

/* ===== REDUCED MOTION ===== */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .001ms !important;
    scroll-behavior: auto !important;
  }
}

/* ===== UNIFIED DASHBOARD HEAD (Photos, Videos, Events, Designs, Clients, Visitors) =====
   Page title = the My Designs title. Stats cards = the My Photos stats row.
   !important because several pages carry their own older overrides inline. */
.main-header-title { font-family: 'Inter', 'Noto Sans Arabic', sans-serif !important; font-size: var(--fs-18, 18px) !important; font-weight: 800 !important; letter-spacing: -.02em !important; color: var(--navy) !important; }
.main-header-sub { font-family: 'Inter', 'Noto Sans Arabic', sans-serif !important; font-size: var(--fs-12, 12px) !important; font-weight: 400 !important; color: var(--muted) !important; margin-top: .2rem !important; }
.stats-row { display: grid !important; grid-template-columns: repeat(4, 1fr) !important; gap: .8rem !important; margin-bottom: 1.25rem !important; max-width: none !important; }
.stat-card { padding: .9rem 1.1rem !important; }
.stat-val { font-size: var(--fs-28, 28px) !important; }
.stat-label { font-family: 'Inter', 'Noto Sans Arabic', sans-serif !important; font-size: var(--fs-12, 12px) !important; }
@media (max-width: 700px) { .stats-row { grid-template-columns: repeat(2, 1fr) !important; } }
@media (max-width: 768px) {
  .main-header-title { font-size: var(--fs-16, 16px) !important; }
  .stat-val { font-size: var(--fs-18, 18px) !important; }
  .stat-label { font-size: var(--fs-12, 12px) !important; }
}

/* Phones and iPads: Safari zooms into any field under 16px when it is tapped. 16px stops that, site wide. */
@media (pointer: coarse) { input, select, textarea { font-size: 16px !important; } }
@media (max-width: 600px) { .auth-wrap { padding: 1.25rem; } }
