/* ============================================================
   My Wardrobe — Stylesheet
   Light mode. Pink + white (female accents) / Blue + white (male accents).
   Responsive: desktop sidebar + mobile bottom nav.
   ============================================================ */

:root {
  --pink: #ec4899;
  --pink-soft: #fce4ec;
  --pink-bg: #fff5f8;
  --blue: #3b82f6;
  --blue-soft: #e0e7ff;
  --blue-bg: #f0f7ff;
  --rose: #f43f5e;
  --ink: #1f1426;
  --ink-soft: #6b5562;
  --muted: #9b8a98;
  --border: #f1e3ea;
  --card: #ffffff;
  --bg: #fffafc;
  --bg-gradient: linear-gradient(180deg, #ffffff 0%, #fff5f8 100%);
  --shadow-sm: 0 1px 2px rgba(45, 12, 32, 0.06);
  --shadow-md: 0 4px 14px rgba(45, 12, 32, 0.08);
  --shadow-lg: 0 12px 32px rgba(45, 12, 32, 0.14);
  --radius-sm: 8px;
  --radius: 14px;
  --radius-lg: 20px;
  --radius-full: 9999px;
}

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; padding: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  font-size: 15px; line-height: 1.55; color: var(--ink); background: var(--bg);
  -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale;
}
a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }
button { font: inherit; cursor: pointer; border: 0; background: transparent; color: inherit; }
input, textarea, select { font: inherit; }
h1, h2, h3, h4 { margin: 0; line-height: 1.25; font-weight: 700; }
h1 { font-size: 1.5rem; } h2 { font-size: 1.25rem; } h3 { font-size: 1rem; }
p { margin: 0 0 1em; }
.serif { font-family: Georgia, 'Playfair Display', serif; }

/* ============================================================
   App shell layout
   ============================================================ */
.app-bg { background: var(--bg-gradient); min-height: 100vh; }
.onboarding-bg { background: var(--bg-gradient); min-height: 100vh; display: flex; align-items: center; justify-content: center; }

.sidebar {
  position: fixed; top: 0; left: 0; bottom: 0; width: 240px;
  background: #fff; border-right: 1px solid var(--border);
  display: flex; flex-direction: column; z-index: 30;
}
.brand { padding: 20px 20px 12px; font-size: 1.4rem; font-weight: 800; color: var(--ink); }
.brand-primary { color: var(--pink); }
.brand-tag { font-size: 9px; letter-spacing: 0.25em; color: var(--muted); margin-top: 4px; text-transform: uppercase; }
.side-nav { flex: 1; overflow-y: auto; padding: 8px 12px; display: flex; flex-direction: column; gap: 2px; }
.side-link { display: flex; align-items: center; gap: 10px; padding: 9px 12px; border-radius: var(--radius); color: var(--ink); font-size: 14px; font-weight: 500; transition: background 0.15s; }
.side-link:hover { background: var(--pink-bg); }
.side-link.active { background: var(--pink); color: #fff; }
.side-emoji { width: 18px; text-align: center; font-size: 16px; }
.side-foot { padding: 12px; border-top: 1px solid var(--border); }
.side-foot-user { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.side-foot-name { font-weight: 600; font-size: 13px; }
.side-foot-sub { color: var(--muted); font-size: 11px; }
.side-logout { color: var(--pink); font-size: 12px; font-weight: 600; }
.avatar-xs { width: 28px; height: 28px; border-radius: 50%; object-fit: cover; }
.avatar-sm { width: 32px; height: 32px; border-radius: 50%; object-fit: cover; }
.avatar-md { width: 44px; height: 44px; border-radius: 50%; object-fit: cover; }
.avatar-lg { width: 80px; height: 80px; border-radius: 50%; object-fit: cover; border: 4px solid #fff; box-shadow: var(--shadow-md); }

.badge-dot { background: #fff; color: var(--pink); padding: 1px 6px; border-radius: var(--radius-full); font-size: 10px; font-weight: 700; margin-left: 4px; }
.badge-dot-top { position: absolute; top: 8px; right: 8px; width: 8px; height: 8px; background: var(--pink); border-radius: 50%; }

.main-content { margin-left: 240px; min-height: 100vh; display: flex; flex-direction: column; }
.container { max-width: 760px; margin: 0 auto; padding: 28px 20px 100px; flex: 1; width: 100%; }

.mobile-topbar { display: none; }
.bottom-nav { display: none; }
.app-footer { display: none; }

/* ============================================================
   Onboarding layout (splash, welcome, gender, register)
   ============================================================ */
.onboarding-main { flex: 1; display: flex; align-items: center; justify-content: center; padding: 24px; }
.onboarding-container { width: 100%; max-width: 460px; }

/* ============================================================
   Buttons
   ============================================================ */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 11px 18px; border-radius: var(--radius-full); font-weight: 600; font-size: 14px;
  border: 1px solid transparent; transition: all 0.15s; cursor: pointer; text-decoration: none;
}
.btn:active { transform: scale(0.98); }
.btn-primary { background: var(--pink); color: #fff; box-shadow: 0 4px 14px rgba(236, 72, 153, 0.3); }
.btn-primary:hover { opacity: 0.95; }
.btn-secondary { background: #fff; color: var(--ink); border-color: var(--border); }
.btn-secondary:hover { background: var(--pink-bg); }
.btn-ghost { color: var(--ink-soft); padding: 8px 12px; }
.btn-ghost:hover { background: var(--pink-bg); color: var(--pink); }
.btn-block { width: 100%; }
.btn-sm { padding: 6px 12px; font-size: 12px; }
.btn-danger { background: #fee; color: #c00; }
.btn-male { background: var(--blue); color: #fff; box-shadow: 0 4px 14px rgba(59, 130, 246, 0.3); }

.icon-btn { width: 38px; height: 38px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; background: transparent; position: relative; }
.icon-btn:hover { background: var(--pink-bg); }

/* ============================================================
   Form fields
   ============================================================ */
.field { margin-bottom: 14px; }
.field-label { display: block; font-size: 12px; font-weight: 600; margin-bottom: 6px; color: var(--ink-soft); }
.field-label .req { color: var(--pink); }
.input, .textarea, .select {
  width: 100%; padding: 10px 14px; border: 1px solid var(--border); border-radius: var(--radius-sm);
  background: #fff; color: var(--ink); transition: border 0.15s, box-shadow 0.15s;
}
.input:focus, .textarea:focus, .select:focus {
  outline: none; border-color: var(--pink); box-shadow: 0 0 0 3px rgba(236, 72, 153, 0.15);
}
.textarea { min-height: 80px; resize: vertical; }
.field-hint { font-size: 11px; color: var(--muted); margin-top: 4px; }
.field-error { font-size: 11px; color: #c00; margin-top: 4px; }
.input-grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

/* ============================================================
   Cards
   ============================================================ */
.card { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow-sm); }
.card-tight { padding: 12px; }
.card-hover:hover { box-shadow: var(--shadow-md); transform: translateY(-1px); }
.card-title { font-size: 14px; font-weight: 700; margin-bottom: 8px; }

/* ============================================================
   Chips & badges
   ============================================================ */
.chip {
  display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px;
  background: #fff; border: 1px solid var(--border); border-radius: var(--radius-full);
  font-size: 12px; font-weight: 600; color: var(--ink-soft); cursor: pointer; transition: all 0.15s;
}
.chip:hover { border-color: var(--pink); color: var(--pink); }
.chip.active { background: var(--pink); color: #fff; border-color: var(--pink); }
.chip-row { display: flex; gap: 8px; overflow-x: auto; padding: 4px 0; -webkit-overflow-scrolling: touch; }
.chip-row::-webkit-scrollbar { display: none; }

.badge { display: inline-flex; align-items: center; padding: 2px 8px; border-radius: var(--radius-full); font-size: 11px; font-weight: 700; }
.badge-pink { background: var(--pink-bg); color: var(--pink); }
.badge-blue { background: var(--blue-bg); color: var(--blue); }
.badge-grey { background: #f3f0f1; color: var(--ink-soft); }
.badge-green { background: #e8f5e9; color: #2e7d32; }
.badge-red { background: #fee; color: #c00; }

/* ============================================================
   Stat grid (dashboard)
   ============================================================ */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); gap: 10px; margin-bottom: 16px; }
.stat-card { background: #fff; border: 1px solid var(--border); border-radius: var(--radius); padding: 12px; text-align: center; }
.stat-value { font-size: 22px; font-weight: 800; color: var(--pink); }
.stat-label { font-size: 10px; color: var(--muted); letter-spacing: 0.1em; text-transform: uppercase; margin-top: 2px; }

/* ============================================================
   Category grid (dashboard)
   ============================================================ */
.cat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px; }
.cat-card { display: flex; flex-direction: column; padding: 14px; border: 1px solid var(--border); border-radius: var(--radius); background: #fff; text-decoration: none; color: inherit; transition: all 0.15s; }
.cat-card:hover { border-color: var(--pink); transform: translateY(-2px); box-shadow: var(--shadow-md); }
.cat-emoji { font-size: 28px; margin-bottom: 6px; }
.cat-name { font-size: 14px; font-weight: 700; }
.cat-count { font-size: 11px; color: var(--muted); margin-top: 2px; }
.cat-thumbs { display: flex; gap: 2px; margin-top: 8px; }
.cat-thumb { width: 28px; height: 28px; border-radius: 6px; object-fit: cover; background: var(--pink-bg); }

/* ============================================================
   Item grid (category page)
   ============================================================ */
.item-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
@media (min-width: 600px) { .item-grid { grid-template-columns: repeat(3, 1fr); } }
.item-card { background: #fff; border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; cursor: pointer; transition: all 0.15s; position: relative; }
.item-card:hover { box-shadow: var(--shadow-md); transform: translateY(-2px); }
.item-card-img { aspect-ratio: 1; background: var(--pink-bg); overflow: hidden; }
.item-card-img img { width: 100%; height: 100%; object-fit: cover; }
.item-card-info { padding: 8px 10px; }
.item-card-title { font-size: 12px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.item-card-brand { font-size: 10px; color: var(--muted); }
.item-card-fav { position: absolute; top: 6px; right: 6px; background: rgba(255, 255, 255, 0.9); padding: 4px; border-radius: 50%; }
.item-card-vis { position: absolute; top: 6px; left: 6px; background: rgba(255, 255, 255, 0.9); padding: 3px 6px; border-radius: var(--radius-full); font-size: 10px; }

/* ============================================================
   Post card (feed)
   ============================================================ */
.post-card { background: #fff; border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow-sm); margin-bottom: 14px; }
.post-head { display: flex; align-items: center; gap: 10px; padding: 12px 14px; }
.post-head-info { flex: 1; min-width: 0; }
.post-user-name { font-size: 13px; font-weight: 700; }
.post-user-handle { font-size: 11px; color: var(--muted); }
.post-meta { font-size: 11px; color: var(--muted); margin-top: 1px; }
.post-img { width: 100%; aspect-ratio: 1; background: var(--pink-bg); overflow: hidden; cursor: pointer; }
.post-img img { width: 100%; height: 100%; object-fit: cover; }
.post-actions { display: flex; align-items: center; gap: 4px; padding: 8px 12px; }
.post-action { display: inline-flex; align-items: center; gap: 4px; padding: 6px 8px; border-radius: var(--radius-full); font-size: 12px; color: var(--ink-soft); background: transparent; transition: all 0.15s; }
.post-action:hover { background: var(--pink-bg); color: var(--pink); }
.post-action.liked { color: var(--pink); }
.post-action.wishlisted { color: var(--pink); }
.post-caption { padding: 0 14px 14px; font-size: 13px; }
.post-caption b { font-weight: 700; }
.tag-link, .mention-link { color: var(--pink); font-weight: 600; }

/* ============================================================
   Page title & sub-tabs
   ============================================================ */
.page-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 18px; gap: 10px; }
.page-title { font-size: 1.4rem; font-weight: 800; }
.page-subtitle { color: var(--muted); font-size: 13px; margin-top: 2px; }
.tabs-row { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: 16px; overflow-x: auto; }
.tab { padding: 10px 14px; font-size: 13px; font-weight: 600; color: var(--ink-soft); border-bottom: 2px solid transparent; white-space: nowrap; }
.tab.active { color: var(--pink); border-color: var(--pink); }

/* ============================================================
   Avatar with cover (profile)
   ============================================================ */
.cover { height: 180px; background: linear-gradient(135deg, #ffe4ec 0%, #ffc1d6 50%, #ffb6c1 100%); border-radius: var(--radius); position: relative; }
.cover-male { background: linear-gradient(135deg, #c1d9ff 0%, #93b8f5 50%, #6ea0ee 100%); }
.profile-head { display: flex; flex-direction: column; align-items: center; text-align: center; margin-bottom: 18px; }
.profile-avatar { width: 96px; height: 96px; border-radius: 50%; border: 4px solid #fff; box-shadow: var(--shadow-md); margin-top: -48px; object-fit: cover; background: var(--pink-bg); }
.profile-name { font-size: 1.4rem; font-weight: 800; margin-top: 8px; }
.profile-handle { color: var(--muted); font-size: 13px; }
.profile-bio { font-size: 13px; color: var(--ink-soft); max-width: 460px; margin: 6px auto 0; }
.profile-location { font-size: 12px; color: var(--muted); margin-top: 4px; }
.profile-stats { display: flex; justify-content: center; gap: 24px; padding: 14px 0; }
.profile-stat { text-align: center; }
.profile-stat-num { font-size: 16px; font-weight: 800; }
.profile-stat-label { font-size: 10px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.1em; }

/* ============================================================
   Multi-step wizard (add item)
   ============================================================ */
.wizard-steps { display: flex; align-items: center; justify-content: space-between; margin-bottom: 20px; gap: 4px; }
.wizard-step { flex: 1; text-align: center; font-size: 11px; color: var(--muted); padding: 6px 0; border-bottom: 2px solid var(--border); }
.wizard-step.active { color: var(--pink); border-color: var(--pink); font-weight: 700; }
.wizard-step.done { color: var(--pink); border-color: var(--pink); }

.upload-area { border: 2px dashed var(--border); border-radius: var(--radius); padding: 28px; text-align: center; background: var(--pink-bg); cursor: pointer; transition: all 0.15s; }
.upload-area:hover { border-color: var(--pink); background: #fff; }
.sample-img-row { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
.sample-img { width: 70px; height: 70px; border-radius: 8px; border: 2px solid var(--border); cursor: pointer; object-fit: cover; }
.sample-img.selected { border-color: var(--pink); box-shadow: 0 0 0 2px var(--pink); }

.color-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(40px, 1fr)); gap: 8px; }
.color-swatch { width: 40px; height: 40px; border-radius: 50%; border: 2px solid var(--border); cursor: pointer; position: relative; }
.color-swatch.selected { border-color: var(--ink); transform: scale(1.1); }

.visibility-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.vis-card { padding: 18px; border: 2px solid var(--border); border-radius: var(--radius); text-align: center; cursor: pointer; transition: all 0.15s; }
.vis-card:hover { border-color: var(--pink); }
.vis-card.selected { border-color: var(--pink); background: var(--pink-bg); }
.vis-emoji { font-size: 32px; }
.vis-label { font-weight: 700; margin-top: 4px; }
.vis-desc { font-size: 11px; color: var(--muted); margin-top: 2px; }

/* ============================================================
   Outfit builder
   ============================================================ */
.outfit-slots { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.outfit-slot { padding: 12px; border: 1px solid var(--border); border-radius: var(--radius); background: #fff; text-align: center; }
.outfit-slot-img { aspect-ratio: 1; background: var(--pink-bg); border-radius: 8px; margin-bottom: 6px; overflow: hidden; }
.outfit-slot-img img { width: 100%; height: 100%; object-fit: cover; }
.outfit-slot-empty { aspect-ratio: 1; background: var(--pink-bg); border-radius: 8px; display: flex; align-items: center; justify-content: center; color: var(--muted); margin-bottom: 6px; cursor: pointer; }

/* ============================================================
   Try-on dialog
   ============================================================ */
.modal-overlay { position: fixed; inset: 0; background: rgba(0, 0, 0, 0.5); display: flex; align-items: center; justify-content: center; z-index: 100; padding: 16px; }
.modal { background: #fff; border-radius: var(--radius-lg); max-width: 500px; width: 100%; max-height: 90vh; overflow-y: auto; padding: 20px; }
.modal-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; }
.modal-close { font-size: 22px; color: var(--muted); background: transparent; }

/* ============================================================
   Empty state
   ============================================================ */
.empty { text-align: center; padding: 40px 20px; color: var(--muted); }
.empty-emoji { font-size: 48px; margin-bottom: 8px; }
.empty-title { font-size: 16px; font-weight: 700; color: var(--ink); margin-bottom: 4px; }
.empty-sub { font-size: 13px; }
.empty-action { margin-top: 14px; }

/* ============================================================
   Toast (PHP-side flash message)
   ============================================================ */
.toast { position: fixed; top: 20px; left: 50%; transform: translateX(-50%); background: var(--ink); color: #fff; padding: 10px 18px; border-radius: var(--radius-full); font-size: 13px; z-index: 200; animation: toast-slide 0.3s ease; }
.toast.success { background: #1a7e3f; }
.toast.error { background: #c53030; }
@keyframes toast-slide { from { opacity: 0; transform: translate(-50%, -10px); } to { opacity: 1; transform: translate(-50%, 0); } }

/* ============================================================
   Splash + gender selection
   ============================================================ */
.splash-globe { width: 200px; height: 200px; margin: 0 auto; position: relative; }
.splash-globe-inner { width: 96px; height: 96px; border-radius: 50%; background: conic-gradient(from 0deg, #ffd1dc, #c7d8ff, #ffe0c7, #ffd1dc); position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); box-shadow: 0 8px 40px rgba(236, 72, 153, 0.4); animation: spin-slow 10s linear infinite; }
.splash-orbit { position: absolute; inset: 0; animation: spin-slow 14s linear infinite; }
.splash-icon { position: absolute; width: 44px; height: 44px; border-radius: 50%; background: #fff; box-shadow: var(--shadow-md); display: flex; align-items: center; justify-content: center; font-size: 22px; }
@keyframes spin-slow { to { transform: rotate(360deg); } }

.gender-split { display: flex; height: 100vh; }
.gender-half { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; cursor: pointer; position: relative; transition: flex 0.3s; text-decoration: none; color: inherit; }
.gender-half:hover { flex: 1.05; }
.gender-female { background: linear-gradient(135deg, #fff 0%, var(--pink-bg) 100%); }
.gender-male { background: linear-gradient(135deg, #fff 0%, var(--blue-bg) 100%); }
.gender-emoji-circle { width: 96px; height: 96px; border-radius: 50%; background: #fff; display: flex; align-items: center; justify-content: center; font-size: 48px; box-shadow: var(--shadow-lg); }
.gender-label { font-size: 2rem; font-weight: 800; margin-top: 16px; }
.gender-female .gender-label { color: var(--pink); }
.gender-male .gender-label { color: var(--blue); }
.gender-sub { font-size: 12px; color: var(--ink-soft); margin-top: 4px; }
.gender-or { position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); background: #fff; padding: 8px 14px; border-radius: var(--radius-full); box-shadow: var(--shadow-md); font-weight: 700; font-size: 12px; color: var(--ink-soft); z-index: 5; }

/* ============================================================
   Responsive — mobile
   ============================================================ */
@media (max-width: 768px) {
  .sidebar { display: none; }
  .main-content { margin-left: 0; }
  .mobile-topbar {
    display: flex; align-items: center; justify-content: space-between;
    padding: 10px 14px; background: rgba(255, 255, 255, 0.95); backdrop-filter: blur(8px);
    border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 30;
  }
  .mobile-brand { font-size: 1.2rem; font-weight: 800; }
  .mobile-top-actions { display: flex; align-items: center; gap: 4px; }
  .container { padding: 16px 14px 100px; }
  .input-grid-2 { grid-template-columns: 1fr; }
  .visibility-grid { grid-template-columns: 1fr; }
  .outfit-slots { grid-template-columns: 1fr; }
  .gender-split { flex-direction: column; height: auto; min-height: 100vh; }
  .gender-half { min-height: 50vh; padding: 30px 0; }

  .bottom-nav {
    display: flex; justify-content: space-around; align-items: center;
    position: fixed; bottom: 0; left: 0; right: 0; z-index: 30;
    background: rgba(255, 255, 255, 0.97); backdrop-filter: blur(8px);
    border-top: 1px solid var(--border); padding: 6px 8px env(safe-area-inset-bottom);
  }
  .bn-link { display: flex; flex-direction: column; align-items: center; padding: 6px 10px; font-size: 10px; color: var(--muted); flex: 1; }
  .bn-link.active { color: var(--pink); }
  .bn-emoji { font-size: 18px; margin-bottom: 2px; }
  .bn-add {
    background: var(--pink); color: #fff; width: 52px; height: 52px; border-radius: 50%;
    display: flex; align-items: center; justify-content: center; font-size: 22px;
    box-shadow: 0 4px 18px rgba(236, 72, 153, 0.4); margin-top: -16px;
  }

  .app-footer {
    display: block; text-align: center; padding: 12px 16px;
    border-top: 1px solid var(--border); font-size: 11px; color: var(--muted);
  }
  .footer-links { display: flex; gap: 12px; justify-content: center; margin-top: 4px; }
}

/* ============================================================
   Utility
   ============================================================ */
.flex { display: flex; }
.flex-between { display: flex; justify-content: space-between; align-items: center; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.gap-2 { gap: 8px; } .gap-3 { gap: 12px; } .gap-4 { gap: 16px; }
.text-center { text-align: center; }
.text-pink { color: var(--pink); } .text-blue { color: var(--blue); } .text-muted { color: var(--muted); }
.text-sm { font-size: 12px; } .text-xs { font-size: 11px; }
.mt-2 { margin-top: 8px; } .mt-4 { margin-top: 16px; } .mb-2 { margin-bottom: 8px; } .mb-4 { margin-bottom: 16px; }
.w-full { width: 100%; }
.hidden { display: none; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.no-scrollbar::-webkit-scrollbar { display: none; }
.no-scrollbar { -ms-overflow-style: none; scrollbar-width: none; }
.h-3 { height: 12px; }
.flex-wrap { flex-wrap: wrap; }
.rounded { border-radius: var(--radius); }
.shadow { box-shadow: var(--shadow-sm); }
