/* ═══════════════════════════════════════════════════
   MANIKVAULT — style/main.css
   Single source of truth: themes + all shared styles
   ─────────────────────────────────────────────────
   TABLE OF CONTENTS
   1.  Theme Variables (dark + light)
   2.  Reset & Base
   3.  Layout
   4.  Navbar (standard page nav)
   5.  Buttons
   6.  Forms
   7.  Cards
   8.  Avatars
   9.  Badges & Tags
   10. Modals
   11. Toasts
   12. Traceability Timeline
   13. Map Placeholder
   14. Section Headers
   15. Utilities
   16. Responsive
═══════════════════════════════════════════════════ */


/* ─── 1. THEME VARIABLES ─────────────────────────
   :root + [data-theme="dark"] = dark (default)
   [data-theme="light"] = overrides
─────────────────────────────────────────────────── */

:root,
[data-theme="dark"] {
  --bg:        #0d0c0a;
  --bg2:       #141310;
  --bg3:       #1c1a17;
  --surface:   #211f1b;
  --surface2:  #2a271f;
  --border:    #2e2b26;
  --border2:   #3d3930;
  --text:      #e8e2d9;
  --text2:     #9e9688;
  --text3:     #5c5748;

  --gold:      #c9a84c;
  --gold2:     #e8c97a;
  --gold-dim:  #7a6330;
  --gold-bg:   rgba(201,168,76,0.08);

  --green:     #2d7a4f;
  --green-bg:  rgba(45,122,79,0.1);
  --green-dim: #245c3a;
  --red:       #c44444;
  --red-bg:    rgba(196,68,68,0.1);
  --red-dim:   #7a2a2a;
  --blue:      #3a6ea8;
  --blue-bg:   rgba(58,110,168,0.1);
  --amber:     #c9843a;
  --amber-bg:  rgba(201,132,58,0.1);
  --purple:    #8a4ac9;
  --purple-bg: rgba(138,74,201,0.1);

  --nav-bg:         rgba(13,12,10,0.92);
  --nav-bg-solid:   rgba(13,12,10,0.98);

  /* Animated gradient stops */
  --grad-a: #060810;
  --grad-b: #080706;
  --grad-c: #040e08;
  --grad-d: #04081a;
}

[data-theme="light"] {
  --bg:        #f5f0e8;
  --bg2:       #ede7dc;
  --bg3:       #e4dcd0;
  --surface:   #ddd5c8;
  --surface2:  #d5cbbe;
  --border:    #c8bfb0;
  --border2:   #b8ad9c;
  --text:      #1a1610;
  --text2:     #5c5040;
  --text3:     #9e9080;

  --gold:      #8a6020;
  --gold2:     #c09040;
  --gold-dim:  #c09040;
  --gold-bg:   rgba(138,96,32,0.08);

  --green:     #2d7a4f;
  --green-bg:  rgba(45,122,79,0.1);
  --green-dim: #245c3a;
  --red:       #c44444;
  --red-bg:    rgba(196,68,68,0.1);
  --red-dim:   #7a2a2a;
  --blue:      #3a6ea8;
  --blue-bg:   rgba(58,110,168,0.1);
  --amber:     #c9843a;
  --amber-bg:  rgba(201,132,58,0.1);
  --purple:    #8a4ac9;
  --purple-bg: rgba(138,74,201,0.1);

  --nav-bg:         rgba(245,240,232,0.92);
  --nav-bg-solid:   rgba(245,240,232,0.98);

  --grad-a: #fdf0f2;
  --grad-b: #fef4ee;
  --grad-c: #ddeeff;
  --grad-d: #f0f4fe;
}

/* Non-color tokens — identical in both themes */
:root {
  --mono:   'DM Mono', monospace;
  --serif:  'Cormorant Garamond', serif;
  --sans:   'DM Sans', sans-serif;
  --radius: 10px;
  --shadow: 0 4px 24px rgba(0,0,0,0.5);
  --nav-h:  64px;
  --trans:  all 0.2s ease;
}


/* ─── 2. RESET & BASE ────────────────────────────── */

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }

body {
  background: linear-gradient(-45deg, var(--grad-a), var(--grad-b), var(--grad-c), var(--grad-d));
  background-size: 400% 400%;
  animation: bgShift 22s ease infinite;
  color: var(--text);
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  overflow-x: hidden;
}

@keyframes bgShift {
  0%,100% { background-position: 0% 50%; }
  50%      { background-position: 100% 50%; }
}

a   { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }
button { cursor: pointer; font-family: inherit; border: none; background: none; }
input, select, textarea { font-family: inherit; }

::-webkit-scrollbar       { width: 4px; height: 4px; }
::-webkit-scrollbar-thumb { background: var(--border2); border-radius: 4px; }


/* ─── 3. LAYOUT ──────────────────────────────────── */

.container { width: 100%; max-width: 1200px; margin: 0 auto; padding: 0 24px; }
.page-wrap  { padding-top: calc(var(--nav-h) + 32px); padding-bottom: 80px; }


/* ─── 4. NAVBAR ──────────────────────────────────── */

.navbar {
  position: fixed; top: 0; left: 0; right: 0; z-index: 100;
  height: var(--nav-h);
  background: var(--nav-bg);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  transition: var(--trans);
}
.navbar.scrolled { background: var(--nav-bg-solid); }

.nav-inner {
  height: 100%; max-width: 1200px; margin: 0 auto;
  padding: 0 24px; display: flex; align-items: center; gap: 24px;
}

.nav-logo    { display: flex; align-items: center; gap: 10px; flex-shrink: 0; }
.logo-mark   { color: var(--gold); font-size: 15px; animation: logoPulse 3s ease-in-out infinite; }
.logo-text   { font-family: var(--serif); font-size: 20px; font-weight: 600; }
@keyframes logoPulse { 0%,100%{opacity:1} 50%{opacity:0.5} }

.nav-links   { display: flex; align-items: center; gap: 2px; flex: 1; }
.nav-link    { padding: 6px 12px; border-radius: 6px; font-size: 13px; color: var(--text2); transition: var(--trans); white-space: nowrap; }
.nav-link:hover,
.nav-link.active            { color: var(--text); background: var(--surface); }
.nav-link.highlight         { color: var(--gold); border: 1px solid var(--gold-dim); margin-left: 8px; }
.nav-link.highlight:hover   { background: var(--gold); color: #0d0c0a; }

.nav-actions  { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }

.theme-toggle {
  width: 34px; height: 34px; border-radius: 50%;
  background: var(--surface); border: 1px solid var(--border2);
  color: var(--text2); font-size: 15px;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; transition: var(--trans);
}
.theme-toggle:hover { border-color: var(--gold-dim); }

.nav-hamburger { display: none; flex-direction: column; gap: 5px; background: none; border: none; padding: 6px; }
.nav-hamburger span { display: block; width: 22px; height: 2px; background: var(--text2); border-radius: 2px; transition: var(--trans); }

.nav-mobile { display: none; flex-direction: column; padding: 16px 24px 20px; border-top: 1px solid var(--border); gap: 4px; background: var(--bg2); }
.nav-mobile.open { display: flex; }
.nav-mobile .nav-link { padding: 10px 12px; font-size: 15px; }

.mobile-auth { display: flex; gap: 8px; margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--border); }
.mobile-auth button { flex: 1; }

.guest-banner { background: var(--gold-bg); border-bottom: 1px solid var(--gold-dim); padding: 8px 24px; display: flex; align-items: center; justify-content: center; gap: 12px; font-size: 13px; color: var(--gold); font-family: var(--mono); letter-spacing: 0.04em; }
.guest-timer  { font-weight: 500; }
.guest-banner .btn { padding: 5px 14px; font-size: 12px; }


/* ─── 5. BUTTONS ─────────────────────────────────── */

.btn {
  display: inline-flex; align-items: center; justify-content: center;
  gap: 8px; padding: 10px 22px; border-radius: 8px;
  font-size: 13px; font-weight: 500; letter-spacing: 0.04em;
  border: none; cursor: pointer; transition: var(--trans); white-space: nowrap;
}
.btn-gold         { background: var(--gold);  color: #0d0c0a; }
.btn-gold:hover   { background: var(--gold2); }
.btn-ghost        { background: transparent; color: var(--text2); border: 1px solid var(--border2); }
.btn-ghost:hover  { border-color: var(--gold-dim); color: var(--gold); }
.btn-outline      { background: transparent; color: var(--text2); border: 1px solid var(--border2); }
.btn-outline:hover{ border-color: var(--gold); color: var(--gold); }
.btn-green        { background: var(--green); color: white; }
.btn-green:hover  { opacity: 0.85; }
.btn-danger       { background: transparent; color: var(--red); border: 1px solid var(--red-dim); }
.btn-danger:hover { background: var(--red-bg); }
.btn-full         { width: 100%; justify-content: center; }
.btn-sm           { padding: 7px 14px; font-size: 12px; }
.btn-lg           { padding: 13px 28px; font-size: 15px; }
.icon-btn { background: none; border: none; color: var(--text3); padding: 6px; border-radius: 6px; display: flex; align-items: center; justify-content: center; transition: var(--trans); }
.icon-btn:hover { color: var(--text); background: var(--surface); }


/* ─── 6. FORMS ───────────────────────────────────── */

.form-section       { margin-bottom: 32px; }
.form-section-title { font-family: var(--mono); font-size: 11px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--gold-dim); margin-bottom: 16px; padding-bottom: 8px; border-bottom: 1px solid var(--border); }
.form-grid          { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.form-grid-3        { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 16px; }
.form-group         { display: flex; flex-direction: column; gap: 6px; }
.form-group.full    { grid-column: 1 / -1; }
.form-label         { font-family: var(--mono); font-size: 10px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--text3); }
.form-label .req    { color: var(--gold); margin-left: 2px; }

.form-input,
.form-select,
.form-textarea {
  background: var(--surface); border: 1px solid var(--border2); border-radius: 8px;
  color: var(--text); font-size: 14px; padding: 10px 14px; outline: none;
  transition: border-color 0.15s; width: 100%; -webkit-appearance: none;
}
.form-select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath d='M1 1l4 4 4-4' stroke='%235c5748' stroke-width='1.5' fill='none'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 12px center;
  padding-right: 32px; background-color: var(--surface);
}
.form-select option  { background: var(--bg3); color: var(--text); }
.form-textarea       { resize: vertical; min-height: 100px; line-height: 1.6; }
.form-input:focus,
.form-select:focus,
.form-textarea:focus { border-color: var(--gold-dim); }
.form-input::placeholder,
.form-textarea::placeholder { color: var(--text3); }
.form-hint         { font-size: 12px; color: var(--text3); line-height: 1.5; }
.form-hint.warning { color: var(--gold-dim); }
.form-hint.info    { color: var(--blue); }

.disclaimer-box        { background: rgba(201,168,76,0.06); border: 1px solid var(--gold-dim); border-radius: 8px; padding: 12px 16px; font-size: 12px; color: var(--text2); line-height: 1.6; margin-top: 8px; }
.disclaimer-box strong { color: var(--gold); }


/* ─── 7. CARDS ───────────────────────────────────── */

.card       { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; overflow: hidden; transition: var(--trans); }
.card:hover { border-color: var(--gold-dim); transform: translateY(-2px); box-shadow: 0 8px 32px rgba(0,0,0,0.4); }
.card-img     { width: 100%; aspect-ratio: 4/3; background: var(--bg3); display: flex; align-items: center; justify-content: center; position: relative; overflow: hidden; }
.card-img img { width: 100%; height: 100%; object-fit: cover; }
.card-img .no-img { font-size: 40px; opacity: 0.2; }
.card-body    { padding: 16px; }
.card-badges  { position: absolute; top: 10px; left: 10px; display: flex; flex-direction: column; gap: 4px; }
.card-badge   { font-family: var(--mono); font-size: 9px; letter-spacing: 0.1em; text-transform: uppercase; padding: 3px 7px; border-radius: 4px; font-weight: 500; }
.badge-rough      { background: rgba(90,60,20,0.9);  color: #c9a84c; }
.badge-cut        { background: rgba(20,50,90,0.9);  color: #7ab3e8; }
.badge-studded    { background: rgba(70,20,70,0.9);  color: #c87ae8; }
.badge-verified   { background: rgba(45,122,79,0.9); color: #7ac49a; }
.badge-unverified { background: rgba(80,60,20,0.7);  color: #c9a84c; }
.card-stone-id  { position: absolute; bottom: 8px; right: 8px; font-family: var(--mono); font-size: 9px; color: var(--text3); background: rgba(13,12,10,0.8); padding: 2px 6px; border-radius: 3px; }

.stone-title   { font-family: var(--serif); font-size: 17px; font-weight: 400; color: var(--text); margin-bottom: 4px; line-height: 1.3; }
.stone-meta    { font-family: var(--mono); font-size: 10px; color: var(--text3); margin-bottom: 10px; display: flex; gap: 10px; flex-wrap: wrap; }
.stone-chips   { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 12px; }
.chip          { font-family: var(--mono); font-size: 10px; letter-spacing: 0.04em; color: var(--text2); background: var(--bg3); border: 1px solid var(--border); padding: 3px 8px; border-radius: 4px; }
.chip.gold     { color: var(--gold-dim); border-color: var(--gold-dim); background: var(--gold-bg); }
.stone-footer  { display: flex; align-items: center; justify-content: space-between; padding-top: 12px; border-top: 1px solid var(--border); }
.stone-price   { font-family: var(--mono); font-size: 15px; font-weight: 500; color: var(--gold); }
.stone-price .cur          { font-size: 11px; color: var(--text3); margin-right: 2px; }
.stone-price .hidden-price { font-size: 12px; color: var(--text3); font-weight: 300; }
.seller-mini   { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--text2); }


/* ─── 8. AVATARS ─────────────────────────────────── */

.avatar     { border-radius: 50%; display: flex; align-items: center; justify-content: center; font-family: var(--mono); font-weight: 500; flex-shrink: 0; }
.avatar-sm  { width: 28px; height: 28px; font-size: 10px; }
.avatar-md  { width: 40px; height: 40px; font-size: 14px; }
.avatar-lg  { width: 56px; height: 56px; font-size: 18px; }
.avatar-xl  { width: 72px; height: 72px; font-size: 24px; }
.avatar-gold   { background: #3d2e10; color: var(--gold);  border: 1px solid var(--gold-dim); }
.avatar-blue   { background: #0e2040; color: #7ab3e8;      border: 1px solid #1e4080; }
.avatar-green  { background: #0e3020; color: #7ac49a;      border: 1px solid #1e6040; }
.avatar-purple { background: #2a1040; color: #b07ae8;      border: 1px solid #5a2080; }
.avatar-red    { background: #3d1010; color: #e87a7a;      border: 1px solid #6d2020; }


/* ─── 9. BADGES & TAGS ───────────────────────────── */

.verified-tag { display: inline-flex; align-items: center; gap: 4px; font-family: var(--mono); font-size: 10px; letter-spacing: 0.08em; color: var(--green); background: var(--green-bg); border: 1px solid rgba(45,122,79,0.3); padding: 3px 8px; border-radius: 4px; }
.gemstok-id   { font-family: var(--mono); font-size: 11px; color: var(--gold-dim); }


/* ─── 10. MODALS ─────────────────────────────────── */

.modal-overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.75); backdrop-filter: blur(6px); z-index: 200; display: flex; align-items: center; justify-content: center; padding: 24px; opacity: 0; pointer-events: none; transition: opacity 0.2s ease; }
.modal-overlay.active { opacity: 1; pointer-events: all; }
.modal { background: var(--bg3); border: 1px solid var(--border2); border-radius: 16px; width: 100%; max-width: 480px; max-height: 90vh; overflow-y: auto; transform: translateY(16px); transition: transform 0.2s ease; }
.modal-overlay.active .modal { transform: translateY(0); }
.modal-header { display: flex; align-items: center; justify-content: space-between; padding: 20px 24px; border-bottom: 1px solid var(--border); position: sticky; top: 0; background: var(--bg3); z-index: 1; }
.modal-title  { font-family: var(--serif); font-size: 22px; font-weight: 400; color: var(--text); }
.modal-body   { padding: 24px; }
.modal-footer { padding: 16px 24px; border-top: 1px solid var(--border); display: flex; gap: 10px; justify-content: flex-end; }


/* ─── 11. TOASTS ─────────────────────────────────── */

.toast-wrap { position: fixed; bottom: 24px; right: 24px; z-index: 300; display: flex; flex-direction: column; gap: 8px; }
.toast      { background: var(--surface2); border: 1px solid var(--border2); border-radius: 8px; padding: 12px 16px; font-size: 13px; color: var(--text); display: flex; align-items: center; gap: 10px; animation: toastIn 0.3s ease; min-width: 240px; }
.toast.success { border-color: var(--green); }
.toast.error   { border-color: var(--red); }
.toast.info    { border-color: var(--gold-dim); }
@keyframes toastIn { from{opacity:0;transform:translateX(20px)} to{opacity:1;transform:translateX(0)} }


/* ─── 12. TRACEABILITY TIMELINE ──────────────────── */

.trace-timeline { display: flex; flex-direction: column; gap: 0; }
.trace-step     { display: flex; gap: 16px; position: relative; }
.trace-step:not(:last-child)::before { content: ''; position: absolute; left: 19px; top: 40px; bottom: 0; width: 1px; background: var(--border2); }
.trace-icon-wrap        { width: 40px; height: 40px; border-radius: 50%; background: var(--surface2); border: 1px solid var(--border2); display: flex; align-items: center; justify-content: center; font-size: 16px; flex-shrink: 0; z-index: 1; }
.trace-icon-wrap.active { border-color: var(--gold-dim); background: var(--gold-bg); }
.trace-content { flex: 1; padding-bottom: 24px; }
.trace-label   { font-family: var(--mono); font-size: 11px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--text3); margin-bottom: 4px; }
.trace-value   { font-size: 14px; color: var(--text); margin-bottom: 4px; }
.trace-coords  { font-family: var(--mono); font-size: 11px; color: var(--gold-dim); }
.trace-time    { font-family: var(--mono); font-size: 10px; color: var(--text3); }


/* ─── 13. MAP PLACEHOLDER ────────────────────────── */

.map-placeholder { width: 100%; height: 260px; background: var(--bg3); border: 1px solid var(--border); border-radius: 10px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; color: var(--text3); font-size: 13px; }
.map-placeholder .map-icon { font-size: 32px; }


/* ─── 14. SECTION HEADERS ────────────────────────── */

.section-tag    { font-family: var(--mono); font-size: 11px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--gold); margin-bottom: 10px; }
.section-title  { font-family: var(--serif); font-size: clamp(28px,5vw,44px); font-weight: 300; color: var(--text); }
.section-header { margin-bottom: 40px; }


/* ─── 15. UTILITIES ──────────────────────────────── */

.text-gold   { color: var(--gold); }
.text-muted  { color: var(--text2); }
.text-dim    { color: var(--text3); }
.text-mono   { font-family: var(--mono); }
.text-serif  { font-family: var(--serif); }
.text-sm     { font-size: 13px; }
.text-xs     { font-size: 11px; }
.flex        { display: flex; }
.flex-center { display: flex; align-items: center; justify-content: center; }
.gap-8       { gap: 8px; }
.gap-12      { gap: 12px; }
.gap-16      { gap: 16px; }
.mt-8  { margin-top:     8px; }
.mt-16 { margin-top:    16px; }
.mt-24 { margin-top:    24px; }
.mt-32 { margin-top:    32px; }
.mb-8  { margin-bottom:  8px; }
.mb-16 { margin-bottom: 16px; }
.mb-24 { margin-bottom: 24px; }
.hidden { display: none !important; }

@keyframes fadeUp { from{opacity:0;transform:translateY(20px)} to{opacity:1;transform:translateY(0)} }


/* ─── 16. RESPONSIVE ─────────────────────────────── */

@media (max-width: 900px) {
  .nav-links     { display: none; }
  .nav-hamburger { display: flex; }
  .form-grid     { grid-template-columns: 1fr; }
  .form-grid-3   { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 768px) {
  :root { --nav-h: 52px; }
  .logo-text   { font-size: 16px; }
  .theme-toggle { width: 30px; height: 30px; font-size: 13px; }
  .nav-inner   { padding: 0 16px; }
}
@media (max-width: 600px) {
  .form-grid-3 { grid-template-columns: 1fr; }
  .nav-actions .btn-ghost,
  .nav-actions .btn-gold  { display: none; }
  .nav-hamburger          { display: flex; }
  .modal         { border-radius: 12px 12px 0 0; position: fixed; bottom: 0; max-height: 95vh; }
  .modal-overlay { align-items: flex-end; padding: 0; }
}
