/* ==========================================================================
   Design System — Magic & Illusion Shop
   Premium Dark Theme with Gold & Purple Accents
   Fully Responsive, Mobile-First
   ========================================================================== */

:root {
  /* Colors */
  --bg-primary: #0b0a0f;
  --bg-elevated: #13111c;
  --bg-card: rgba(19, 17, 28, 0.88);
  --bg-glass: rgba(19, 17, 28, 0.72);
  --text-primary: #f0edf5;
  --text-muted: #9b95b0;
  --text-gold: #d4af37;
  --text-gold-light: #e8c95a;
  --accent-purple: #7b3fba;
  --accent-purple-light: #a06cdb;
  --accent-gold: #d4af37;
  --accent-gold-glow: rgba(212, 175, 55, 0.25);
  --danger: #ff5c7a;
  --success: #5ce0a0;
  --border-subtle: rgba(255, 255, 255, 0.07);
  --border-medium: rgba(255, 255, 255, 0.14);

  /* Typography */
  --font-display: 'Playfair Display', serif;
  --font-body: 'Inter', system-ui, -apple-system, sans-serif;
  --text-xs: 0.75rem;   /* 12px */
  --text-sm: 0.875rem;  /* 14px */
  --text-base: 1rem;    /* 16px */
  --text-lg: 1.125rem;  /* 18px */
  --text-xl: 1.375rem;  /* 22px */
  --text-2xl: 1.75rem;  /* 28px */
  --text-3xl: 2.25rem;  /* 36px */

  /* Spacing (4‑8‑12‑16‑24‑32‑48) */
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 24px;
  --space-6: 32px;
  --space-7: 48px;

  /* Layout */
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --radius-xl: 24px;
  --shadow-card: 0 8px 32px rgba(0, 0, 0, 0.45);
  --shadow-glow: 0 0 30px rgba(212, 175, 55, 0.08);
  --topbar-height: 64px;
  --container-max: 1120px;

  /* Transitions */
  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
  --ease-in-out: cubic-bezier(0.65, 0, 0.35, 1);
  --duration-fast: 0.2s;
  --duration-med: 0.35s;
  --duration-slow: 0.5s;
}

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

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-body);
  font-size: var(--text-base);
  line-height: 1.6;
  background: var(--bg-primary);
  color: var(--text-primary);
  min-height: 100vh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

img,
video {
  max-width: 100%;
  height: auto;
  display: block;
}

a {
  color: var(--accent-gold);
  text-decoration: none;
  transition: color var(--duration-fast) ease;
}
a:hover {
  color: var(--text-gold-light);
}

/* ==========================================================================
   Typography
   ========================================================================== */
h1, h2, h3, h4 {
  font-family: var(--font-display);
  font-weight: 600;
  line-height: 1.25;
  letter-spacing: 0.01em;
  margin: 0 0 var(--space-2);
}

h1 { font-size: var(--text-3xl); }
h2 { font-size: var(--text-2xl); }
h3 { font-size: var(--text-xl); }

.muted {
  color: var(--text-muted);
  font-size: var(--text-sm);
}

/* ==========================================================================
   Topbar / Nav
   ========================================================================== */
.topbar {
  position: sticky;
  top: 0;
  z-index: 100;
  border-bottom: 1px solid var(--border-subtle);
  background: var(--bg-glass);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

.topbar__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  padding: 0 var(--space-4);
  min-height: var(--topbar-height);
  max-width: var(--container-max);
  margin: 0 auto;
  flex-wrap: nowrap;
}

.topbar__actions {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  margin-left: auto;
  flex-shrink: 0;
}

.brand {
  font-family: var(--font-display);
  font-size: var(--text-lg);
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: 0.02em;
  white-space: nowrap;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
}
.brand--link {
  color: var(--text-primary);
  transition: color var(--duration-fast) ease;
}
.brand--link:hover {
  color: var(--text-gold);
}
.brand .gold {
  color: var(--text-gold);
}

/* ==========================================================================
   Navbar Brand Logo (Site Logo)
   ========================================================================== */
.brand__logo-link {
  display: inline-flex;
  align-items: center;
  justify-content: flex-start;
  gap: var(--space-2);
  flex-shrink: 0;
  min-width: 0;
}

.brand__logo {
  display: block;
  height: 40px; /* ~36–44px mobile target */
  width: auto;
  max-height: 44px;
  flex-shrink: 0;
}

@media (min-width: 768px) {
  .brand__logo {
    height: 48px; /* ~44–52px desktop target */
    max-height: 52px;
  }
}

/* Ensure logo never pushes hamburger/cart off-screen */
@media (max-width: 479px) {
  .topbar__inner {
    gap: var(--space-2);
  }
  .brand__logo {
    height: 38px;
    max-height: 42px;
  }
}

/* --- Hamburger --- */
.nav-toggle {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  width: 44px;
  height: 44px;
  padding: 10px 8px;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.04);
  cursor: pointer;
  flex-shrink: 0;
  transition: border-color var(--duration-fast) ease;
}
.nav-toggle:hover {
  border-color: var(--border-medium);
}
.nav-toggle__bar {
  display: block;
  width: 100%;
  height: 2px;
  background: var(--text-primary);
  border-radius: 2px;
  transition: transform var(--duration-med) var(--ease-in-out),
              opacity var(--duration-med) var(--ease-in-out);
  transform-origin: center;
}
.nav-toggle[aria-expanded="true"] .nav-toggle__bar:nth-child(1) {
  transform: translateY(7px) rotate(45deg);
}
.nav-toggle[aria-expanded="true"] .nav-toggle__bar:nth-child(2) {
  opacity: 0;
}
.nav-toggle[aria-expanded="true"] .nav-toggle__bar:nth-child(3) {
  transform: translateY(-7px) rotate(-45deg);
}

/* --- Navigation Menu --- */
.nav {
  position: fixed;
  top: var(--topbar-height);
  right: 0;
  width: min(300px, 85vw);
  height: calc(100vh - var(--topbar-height));
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
  padding: var(--space-4) var(--space-5);
  background: var(--bg-elevated);
  border-left: 1px solid var(--border-subtle);
  box-shadow: var(--shadow-card);
  transform: translateX(100%);
  transition: transform var(--duration-med) var(--ease-out);
  z-index: 99;
  overflow-y: auto;
}
.nav--open {
  transform: translateX(0);
}

.nav__link {
  display: flex;
  align-items: center;
  min-height: 48px;
  padding: var(--space-2) var(--space-4);
  border-radius: var(--radius-md);
  font-size: var(--text-base);
  font-weight: 500;
  color: var(--text-primary);
  background: transparent;
  border: none;
  cursor: pointer;
  width: 100%;
  text-align: left;
  font-family: inherit;
  transition: background var(--duration-fast) ease, color var(--duration-fast) ease;
}
.nav__link--compact {
  width: auto;
  min-height: 40px;
  padding: var(--space-2) var(--space-3);
  text-align: center;
  white-space: nowrap;
}
.nav__link:hover,
.nav__link--active {
  background: rgba(212, 175, 55, 0.08);
  color: var(--text-gold);
}
.nav__link--btn {
  color: var(--danger);
  margin-top: auto;
}
.nav__link--btn:hover {
  background: rgba(255, 92, 122, 0.1);
  color: #ff8fa3;
}

.nav__avatar-link {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  min-width: 44px;
  border-radius: 50%;
  border: 1px solid var(--border-subtle);
  background: radial-gradient(circle at 30% 30%, rgba(212, 175, 55, 0.18), rgba(123, 63, 186, 0.12));
  overflow: hidden;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.2);
  transition: transform var(--duration-fast) ease, border-color var(--duration-fast) ease, box-shadow var(--duration-fast) ease;
}
.nav__avatar-link:hover {
  border-color: rgba(212, 175, 55, 0.45);
  box-shadow: 0 0 18px rgba(212, 175, 55, 0.12);
  transform: translateY(-1px);
}
.nav__avatar-img,
.nav__avatar-fallback {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}
.nav__avatar-img {
  display: none;
  object-fit: cover;
}
.nav__avatar-fallback {
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-display);
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-gold);
  background: linear-gradient(135deg, rgba(11, 10, 15, 0.86), rgba(26, 18, 37, 0.92));
}

/* ==========================================================================
   Layout & Container
   ========================================================================== */
.container {
  width: 100%;
  max-width: var(--container-max);
  margin: 0 auto;
  padding: var(--space-4) var(--space-4) var(--space-6);
}

.hero {
  margin-bottom: var(--space-5);
}
.hero h2 {
  font-size: var(--text-2xl);
  color: var(--text-gold);
}
.hero p {
  color: var(--text-muted);
  font-size: var(--text-lg);
}

/* ==========================================================================
   Grids
   ========================================================================== */
.grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-4);
}
.smallGrid {
  grid-template-columns: 1fr;
}

/* ==========================================================================
   Cards (Product & Admin)
   ========================================================================== */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-card);
  transition: border-color var(--duration-fast) ease,
              box-shadow var(--duration-fast) ease,
              transform var(--duration-fast) ease;
  backdrop-filter: blur(4px);
}
.card--clickable {
  cursor: pointer;
}
.card:hover,
.card:focus-within {
  border-color: rgba(212, 175, 55, 0.3);
  box-shadow: var(--shadow-glow), var(--shadow-card);
  transform: translateY(-2px);
}
.cardMedia {
  width: 100%;
  aspect-ratio: 4 / 3;
  background: rgba(255, 255, 255, 0.04);
  overflow: hidden;
}
.cardMedia img,
.cardMedia video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.cardBody {
  padding: var(--space-4);
}
.cardTitle {
  font-family: var(--font-display);
  font-size: var(--text-lg);
  margin: 0 0 var(--space-1);
}
.cardDesc {
  color: var(--text-muted);
  font-size: var(--text-sm);
  line-height: 1.5;
  min-height: 2.8em;
}
.cardActions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  align-items: center;
  margin-top: var(--space-3);
}
.card .price {
  font-weight: 600;
  color: var(--text-gold);
  font-size: var(--text-base);
}

/* ==========================================================================
   Buttons
   ========================================================================== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  min-height: 48px;
  min-width: 48px;
  padding: 0 var(--space-4);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  background: transparent;
  color: var(--text-primary);
  font-family: var(--font-body);
  font-size: var(--text-sm);
  font-weight: 600;
  cursor: pointer;
  transition: all var(--duration-fast) ease;
  -webkit-tap-highlight-color: transparent;
  letter-spacing: 0.01em;
}
.btn:hover:not(:disabled) {
  border-color: var(--border-medium);
}
.btn:active:not(:disabled) {
  transform: scale(0.97);
}
.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn.primary {
  background: linear-gradient(135deg, rgba(212, 175, 55, 0.18), rgba(123, 63, 186, 0.18));
  border-color: rgba(212, 175, 55, 0.4);
  color: var(--text-gold);
}
.btn.primary:hover:not(:disabled) {
  background: linear-gradient(135deg, rgba(212, 175, 55, 0.28), rgba(123, 63, 186, 0.28));
  border-color: rgba(212, 175, 55, 0.7);
  box-shadow: 0 0 20px rgba(212, 175, 55, 0.15);
}

.btn.danger {
  background: rgba(255, 92, 122, 0.12);
  border-color: rgba(255, 92, 122, 0.4);
  color: #ffd6de;
}
.btn.danger:hover:not(:disabled) {
  background: rgba(255, 92, 122, 0.2);
  border-color: rgba(255, 92, 122, 0.7);
}

.btn.ghost {
  color: var(--text-muted);
  border-color: transparent;
}
.btn.ghost:hover:not(:disabled) {
  color: var(--text-primary);
  border-color: var(--border-subtle);
}

.btn--block {
  width: 100%;
  justify-content: center;
}

.btn--loading {
  pointer-events: none;
}

/* ==========================================================================
   Forms
   ========================================================================== */
.panel {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: var(--space-5);
  margin-bottom: var(--space-5);
  box-shadow: var(--shadow-card);
  backdrop-filter: blur(4px);
}

.form {
  display: grid;
  gap: var(--space-4);
}

label {
  display: grid;
  gap: var(--space-1);
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--text-muted);
}

input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
input[type="tel"],
textarea {
  width: 100%;
  min-height: 48px;
  padding: 0 var(--space-4);
  border-radius: var(--radius-md);
  border: 1px solid var(--border-subtle);
  background: rgba(0, 0, 0, 0.25);
  color: var(--text-primary);
  font-family: var(--font-body);
  font-size: var(--text-base);
  transition: border-color var(--duration-fast) ease, box-shadow var(--duration-fast) ease;
  outline: none;
}
textarea {
  padding: var(--space-3) var(--space-4);
  min-height: 100px;
  resize: vertical;
}
input:focus,
textarea:focus {
  border-color: var(--accent-gold);
  box-shadow: 0 0 0 3px var(--accent-gold-glow);
}

.uploadRow {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-4);
}
.uploadLabel input[type="file"] {
  font-size: var(--text-sm);
  color: var(--text-muted);
  min-height: 48px;
  padding: var(--space-2) 0;
  background: transparent;
  border: none;
}

.formActions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  align-items: center;
}
.form-error {
  min-height: 1.5em;
  color: #ff9fb0;
  font-size: var(--text-sm);
}
.status {
  min-height: 1.5em;
  font-size: var(--text-sm);
}
.status.success { color: var(--success); }
.status.error { color: #ff9fb0; }

.divider {
  border: none;
  border-top: 1px solid var(--border-subtle);
  margin: var(--space-5) 0;
}

.dangerSection {
  display: grid;
  gap: var(--space-2);
}

.empty {
  border: 1px dashed var(--border-subtle);
  padding: var(--space-6);
  border-radius: var(--radius-lg);
  color: var(--text-muted);
  text-align: center;
  background: rgba(255, 255, 255, 0.02);
}

/* ==========================================================================
   Modal (Product Preview)
   ========================================================================== */
body.modal-open {
  overflow: hidden;
}
.modal {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-4);
  background: rgba(2, 2, 8, 0.92);
  z-index: 200;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--duration-med) ease;
}
.modal[aria-hidden="false"] {
  opacity: 1;
  pointer-events: auto;
}
.modalCard {
  width: min(100%, 920px);
  max-height: 92vh;
  display: flex;
  flex-direction: column;
  background: var(--bg-elevated);
  border: 1px solid var(--border-medium);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card), 0 0 60px rgba(212, 175, 55, 0.05);
  transform: translateY(20px) scale(0.97);
  transition: transform var(--duration-med) var(--ease-out);
}
.modal[aria-hidden="false"] .modalCard {
  transform: translateY(0) scale(1);
}
.modalClose {
  position: absolute;
  top: var(--space-2);
  right: var(--space-2);
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 1px solid var(--border-subtle);
  background: rgba(0, 0, 0, 0.5);
  color: var(--text-primary);
  font-size: 1.75rem;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 3;
  transition: background var(--duration-fast) ease, border-color var(--duration-fast) ease;
}
.modalClose:hover {
  background: rgba(255, 92, 122, 0.2);
  border-color: rgba(255, 92, 122, 0.5);
}
.modalContent {
  padding: var(--space-5);
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  max-height: calc(92vh - 2 * var(--space-4));
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}
.modalMediaStage {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: var(--space-2);
}
.modalNav {
  width: 44px;
  height: 44px;
  min-width: 44px;
  border-radius: 50%;
  border: 1px solid var(--border-subtle);
  background: rgba(0, 0, 0, 0.3);
  color: var(--text-primary);
  font-size: 1.5rem;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background var(--duration-fast) ease, border-color var(--duration-fast) ease;
}
.modalNav:hover {
  background: rgba(212, 175, 55, 0.15);
  border-color: rgba(212, 175, 55, 0.4);
}
.modalMediaFrame {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  max-height: 55vh;
  border-radius: var(--radius-md);
  overflow: hidden;
  background: #000;
  border: 1px solid rgba(255, 255, 255, 0.06);
}
.modalMedia {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: contain;
  background: #000;
}
.modalMedia--video { display: none; }
.modalMeta {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}
.modalMeta h3 {
  font-family: var(--font-display);
  font-size: var(--text-xl);
  margin: 0;
}
.modalDescription {
  margin: 0;
  color: var(--text-muted);
  font-size: var(--text-sm);
  line-height: 1.6;
}
.thumbnail-strip {
  display: flex;
  flex-wrap: nowrap;
  gap: var(--space-2);
  overflow-x: auto;
  padding: var(--space-2) 0;
  max-width: 100%;
  -webkit-overflow-scrolling: touch;
}
.thumbnail {
  width: 64px;
  height: 64px;
  flex: 0 0 64px;
  border: 2px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  overflow: hidden;
  padding: 0;
  background: rgba(255, 255, 255, 0.04);
  cursor: pointer;
  transition: border-color var(--duration-fast) ease;
}
.thumbnail img,
.thumbnail video {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.thumbnail--active {
  border-color: var(--accent-gold);
  box-shadow: 0 0 0 3px var(--accent-gold-glow);
}

/* --- Media preview in admin form --- */
.media-preview-list {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  margin-top: var(--space-2);
}
.media-preview-thumb {
  position: relative;
  width: 72px;
  height: 72px;
  border-radius: var(--radius-sm);
  overflow: hidden;
  border: 1px solid var(--border-subtle);
}
.media-preview-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.media-preview-remove {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 24px;
  height: 24px;
  border: none;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.7);
  color: var(--text-primary);
  font-size: 1rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background var(--duration-fast) ease;
}
.media-preview-remove:hover {
  background: rgba(255, 92, 122, 0.8);
}

/* ==========================================================================
   Auth Pages
   ========================================================================== */
.auth-page {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: var(--space-4);
  background: radial-gradient(ellipse at 30% 20%, #1f1730, var(--bg-primary) 70%);
}
.auth-container {
  width: 100%;
  max-width: 420px;
}
.auth-card {
  background: var(--bg-card);
  border: 1px solid var(--border-medium);
  border-radius: var(--radius-lg);
  padding: var(--space-6) var(--space-5);
  box-shadow: var(--shadow-card), 0 0 60px rgba(123, 63, 186, 0.05);
  backdrop-filter: blur(8px);
}
.auth-header {
  text-align: center;
  margin-bottom: var(--space-5);
}
.auth-title {
  font-family: var(--font-display);
  font-size: var(--text-2xl);
  color: var(--text-gold);
  margin: 0 0 var(--space-1);
}
.auth-subtitle {
  color: var(--text-muted);
  font-size: var(--text-sm);
  margin: 0;
}
.auth-footer {
  text-align: center;
  margin-top: var(--space-5);
  font-size: var(--text-sm);
}

/* ==========================================================================
   Profile Page
   ========================================================================== */
.profile-panel {
  overflow: visible;
}
.profile-header {
  display: grid;
  gap: var(--space-4);
  margin-bottom: var(--space-5);
}
.profile-avatar-wrap {
  position: relative;
  width: 100px;
  height: 100px;
  min-width: 100px;
}
.profile-avatar {
  width: 100px;
  height: 100px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--border-medium);
  display: none;
}
.profile-avatar--placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, rgba(212, 175, 55, 0.2), rgba(123, 63, 186, 0.2));
  color: var(--text-gold);
  font-size: 2.5rem;
  font-weight: 700;
  font-family: var(--font-display);
}
.profile-meta h2 {
  font-family: var(--font-display);
  font-size: var(--text-xl);
  margin: 0;
}
.profile-since {
  font-size: var(--text-sm);
  color: var(--text-muted);
  margin-top: var(--space-1);
}
.profile-details {
  display: grid;
  gap: var(--space-4);
}
.detail-row {
  display: grid;
  gap: var(--space-1);
  padding-bottom: var(--space-3);
  border-bottom: 1px solid var(--border-subtle);
}
.detail-row:last-child {
  border-bottom: none;
  padding-bottom: 0;
}
.detail-label {
  font-size: var(--text-sm);
  color: var(--text-muted);
  font-weight: 500;
}
.detail-value {
  font-size: var(--text-base);
}
.image-preview-wrap {
  margin-top: var(--space-2);
}
.image-preview {
  width: 100px;
  height: 100px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--border-medium);
}

/* ========================================================================== 
   Public Owner Page
   ========================================================================== */
.owner-page {
  min-height: calc(100vh - var(--topbar-height));
  padding: var(--space-6) var(--space-4);
  display: grid;
  place-items: center;
  background:
    radial-gradient(circle at top, rgba(123, 63, 186, 0.14), transparent 35%),
    radial-gradient(circle at 80% 20%, rgba(212, 175, 55, 0.12), transparent 30%),
    linear-gradient(180deg, rgba(19, 17, 28, 0.35), rgba(11, 10, 15, 0.98));
}
.owner-card {
  width: min(100%, 720px);
  display: grid;
  justify-items: center;
  gap: var(--space-4);
  text-align: center;
  padding: var(--space-7) var(--space-5);
  position: relative;
  overflow: hidden;
}
.owner-card::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(212, 175, 55, 0.08), transparent 40%, rgba(123, 63, 186, 0.08));
  pointer-events: none;
}
.owner-card > * {
  position: relative;
  z-index: 1;
}
.owner-kicker {
  color: var(--text-gold);
  text-transform: uppercase;
  letter-spacing: 0.24em;
  font-size: var(--text-xs);
  font-weight: 700;
}
.owner-avatar-shell {
  width: clamp(160px, 32vw, 240px);
  aspect-ratio: 1 / 1;
  border-radius: 50%;
  overflow: hidden;
  border: 1px solid rgba(212, 175, 55, 0.28);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.55), 0 0 0 10px rgba(212, 175, 55, 0.04);
  background: radial-gradient(circle at 30% 30%, rgba(212, 175, 55, 0.18), rgba(123, 63, 186, 0.18));
}
.owner-profile-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.owner-profile-image--fallback {
  display: none;
  align-items: center;
  justify-content: center;
  font-family: var(--font-display);
  font-size: clamp(3rem, 10vw, 5rem);
  font-weight: 700;
  color: var(--text-gold);
  background: linear-gradient(135deg, rgba(11, 10, 15, 0.9), rgba(26, 18, 37, 0.96));
}
.owner-name {
  font-size: clamp(2rem, 5vw, 3rem);
  margin-bottom: 0;
}
.owner-bio {
  max-width: 60ch;
  font-size: var(--text-base);
  line-height: 1.9;
  white-space: pre-wrap;
}
.owner-meta {
  display: flex;
  gap: var(--space-3);
  flex-wrap: wrap;
  justify-content: center;
}
.owner-pill {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  padding: 0 var(--space-3);
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.03);
  color: var(--text-muted);
  font-size: var(--text-xs);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

/* ==========================================================================
   Toast notifications
   ========================================================================== */
.toast-container {
  position: fixed;
  bottom: var(--space-4);
  left: var(--space-4);
  right: var(--space-4);
  z-index: 300;
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  pointer-events: none;
}
.toast {
  padding: var(--space-4) var(--space-5);
  border-radius: var(--radius-md);
  background: var(--bg-elevated);
  border: 1px solid var(--border-medium);
  box-shadow: var(--shadow-card);
  color: var(--text-primary);
  font-size: var(--text-sm);
  opacity: 0;
  transform: translateY(12px);
  transition: opacity var(--duration-med) ease, transform var(--duration-med) ease;
  pointer-events: auto;
  backdrop-filter: blur(8px);
}
.toast--visible {
  opacity: 1;
  transform: translateY(0);
}
.toast--success {
  border-color: rgba(92, 224, 160, 0.5);
  background: rgba(20, 50, 35, 0.95);
}
.toast--error {
  border-color: rgba(255, 92, 122, 0.5);
  background: rgba(50, 20, 28, 0.95);
}
.toast--info {
  border-color: rgba(212, 175, 55, 0.4);
}

/* ==========================================================================
   Spinner
   ========================================================================== */
.spinner {
  display: inline-block;
  width: 20px;
  height: 20px;
  border: 2.5px solid rgba(255, 255, 255, 0.15);
  border-top-color: var(--accent-gold);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}
@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ==========================================================================
   Cart Drawer
   ========================================================================== */
.cart-badge {
  display: inline-block;
  min-width: 22px;
  height: 22px;
  line-height: 22px;
  text-align: center;
  border-radius: 999px;
  background: var(--accent-gold);
  color: #0b0a0f;
  font-weight: 700;
  font-size: 0.75rem;
  margin-left: 6px;
  padding: 0 6px;
}
.cart-drawer {
  position: fixed;
  inset: 0;
  display: none;
  z-index: 320;
}
.cart-drawer[aria-hidden="false"] {
  display: block;
}
.cart-drawer__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
}
.cart-drawer__panel {
  position: absolute;
  right: 0;
  top: 0;
  height: 100%;
  width: min(440px, 92vw);
  max-width: 100%;
  background: var(--bg-elevated);
  border-left: 1px solid var(--border-medium);
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-card);
  transform: translateX(100%);
  transition: transform var(--duration-med) var(--ease-out);
}
.cart-drawer[aria-hidden="false"] .cart-drawer__panel {
  transform: translateX(0);
}
.cart-drawer__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-4);
  border-bottom: 1px solid var(--border-subtle);
}
.cart-drawer__header h3 {
  font-family: var(--font-display);
  font-size: var(--text-xl);
  margin: 0;
}
.cart-drawer__body {
  padding: var(--space-4);
  overflow-y: auto;
  flex: 1 1 auto;
  display: grid;
  gap: var(--space-4);
}
.cart-items {
  display: grid;
  gap: var(--space-4);
}
.cart-item {
  display: flex;
  gap: var(--space-3);
  align-items: center;
  flex-wrap: wrap;
  padding: var(--space-3);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.02);
}
.cart-item img {
  width: 72px;
  height: 72px;
  object-fit: cover;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-subtle);
}
.cart-item__meta {
  flex: 1 1 auto;
  min-width: 0;
}
.cart-item__meta h4 {
  font-size: var(--text-base);
  margin: 0 0 var(--space-1);
}
.cart-item__meta p {
  margin: 0;
  color: var(--text-muted);
  font-size: var(--text-sm);
}
.cart-item__controls {
  display: flex;
  gap: var(--space-2);
  align-items: center;
  flex-wrap: wrap;
}
.cart-qty {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
}
.cart-qty button {
  width: 40px;
  height: 40px;
  min-width: 40px;
  min-height: 40px;
  padding: 0;
  font-size: var(--text-lg);
  border-radius: 50%;
}
.checkout-panel {
  display: grid;
  gap: var(--space-4);
  padding-top: var(--space-4);
  border-top: 1px solid var(--border-subtle);
}
.checkout-summary h4 {
  font-family: var(--font-display);
  font-size: var(--text-lg);
  margin: 0 0 var(--space-1);
}
.checkout-meta {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  font-size: var(--text-sm);
  color: var(--text-primary);
}
.checkout-meta strong {
  color: var(--text-gold);
}
.cart-drawer__footer {
  padding: var(--space-4);
  border-top: 1px solid var(--border-subtle);
  display: flex;
  gap: var(--space-3);
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
}
.cart-total {
  font-weight: 700;
  font-size: var(--text-lg);
  color: var(--text-gold);
}

/* ==========================================================================
   Responsive Breakpoints
   ========================================================================== */

/* --- Mobile-first adjustments --- */
@media (max-width: 479px) {
  .modalCard {
    width: 100%;
    height: 100vh;
    max-height: 100vh;
    border-radius: 0;
    padding: 0;
  }
  .modalContent {
    max-height: 100vh;
    padding: var(--space-3);
    gap: var(--space-3);
  }
  .modalMediaStage {
    grid-template-columns: 1fr;
    gap: var(--space-1);
  }
  .modalNav {
    display: none;
  }
  .thumbnail {
    width: 56px;
    height: 56px;
    flex: 0 0 56px;
  }
  .cart-drawer__panel {
    left: 0;
    right: 0;
    width: 100%;
    height: 100%;
    border-left: none;
  }
  .cart-drawer__footer {
    flex-direction: column;
    align-items: stretch;
  }
  .cart-actions {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-2);
  }
  .cart-actions .btn {
    flex: 1 1 100%;
  }
  .profile-header {
    grid-template-columns: 1fr;
    justify-items: center;
    text-align: center;
  }
  .profile-avatar-wrap {
    margin: 0 auto;
  }
  .topbar__actions {
    gap: var(--space-1);
  }
  .nav__avatar-link {
    width: 40px;
    height: 40px;
    min-width: 40px;
  }
  .nav__link--compact {
    padding-inline: var(--space-2);
  }
  .owner-card {
    padding: var(--space-6) var(--space-4);
  }
}

/* --- Tablet (≥480px) --- */
@media (min-width: 480px) {
  .grid {
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  }
  .smallGrid {
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  }
  .uploadRow {
    grid-template-columns: 1fr 1fr;
  }
  .profile-header {
    grid-template-columns: auto 1fr auto;
    align-items: center;
    text-align: left;
  }
  .detail-row {
    grid-template-columns: 140px 1fr;
    align-items: center;
  }
}

/* --- Desktop (≥768px) --- */
@media (min-width: 768px) {
  .nav-toggle {
    display: none;
  }
  .nav {
    position: static;
    width: auto;
    height: auto;
    flex-direction: row;
    align-items: center;
    gap: var(--space-1);
    padding: 0;
    background: transparent;
    border: none;
    box-shadow: none;
    transform: none;
    overflow: visible;
  }
  .nav__link {
    width: auto;
    min-height: 40px;
    padding: var(--space-2) var(--space-4);
    white-space: nowrap;
  }
  .nav__link--btn {
    margin-top: 0;
  }
  .topbar__actions {
    gap: var(--space-3);
  }
  .container {
    padding: var(--space-5) var(--space-6);
  }
  .grid {
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  }
  .modal {
    align-items: center;
    padding: var(--space-5);
  }
  .modalCard {
    height: auto;
    max-height: 90vh;
    border-radius: var(--radius-xl);
    padding: var(--space-5);
  }
  .toast-container {
    left: auto;
    right: var(--space-5);
    bottom: var(--space-5);
    max-width: 380px;
  }
}

/* --- Large Desktop (≥1024px) --- */
@media (min-width: 1024px) {
  .grid {
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  }
  .brand {
    font-size: var(--text-xl);
  }
  .nav__avatar-link {
    width: 46px;
    height: 46px;
    min-width: 46px;
  }
}
/* ===== إصلاح المودال للجوال ===== */
.modal {
  padding: 0 !important; /* إزالة أي padding يسبب تمرير */
}

.modalCard {
  width: 100vw !important;
  max-width: 100vw !important;
  max-height: 100vh !important;
  border-radius: 0 !important;
  margin: 0 !important;
  overflow-x: hidden !important;
  overflow-y: auto !important;
}

.modalContent {
  padding: 16px !important;
  max-height: 100vh !important;
  overflow-y: auto !important;
}

.modalMediaStage {
  display: flex !important;
  flex-direction: column !important;
  align-items: center !important;
  width: 100% !important;
}

.modalMediaFrame {
  width: 100% !important;
  max-width: 100% !important;
  aspect-ratio: 16 / 9 !important;
  height: auto !important;
}

.modalNav {
  display: none !important; /* إخفاء أزرار التنقل على الجوال */
}

.thumbnail-strip {
  flex-wrap: nowrap !important;
  overflow-x: auto !important;
  -webkit-overflow-scrolling: touch !important;
  max-width: 100% !important;
}

.thumbnail {
  flex: 0 0 56px !important;
  width: 56px !important;
  height: 56px !important;
}

/* منع التمرير الأفقي في أي عنصر */
body.modal-open {
  overflow: hidden !important;
  position: fixed !important;
  width: 100% !important;
}
/* ===== إصلاح النافبار للجوال ===== */
.topbar__inner {
  flex-wrap: nowrap !important;
  overflow-x: hidden !important;
}

.nav {
  width: 85vw !important;
  max-width: 85vw !important;
  overflow-x: hidden !important;
  overflow-y: auto !important;
}

.nav__link {
  white-space: normal !important; /* السماح للنص بالالتفاف */
  word-break: break-word !important;
}

/* منع التمرير الأفقي في أي عنصر */
html, body {
  overflow-x: hidden !important;
  max-width: 100% !important;
}