:root {
  color-scheme: light;
  --ink: #18332d;
  --ink-soft: #50645f;
  --forest: #16372f;
  --forest-2: #234b41;
  --cream: #f8f5ee;
  --paper: #fffdf8;
  --sand: #e7dfcf;
  --gold: #b99055;
  --gold-soft: #eadcc3;
  --danger: #a53f42;
  --shadow: 0 20px 60px rgba(26, 45, 39, .12);
  --radius: 24px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  min-height: 100vh;
  background: var(--cream);
  color: var(--ink);
  font-family: "Manrope", "Cairo", system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
}
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  background:
    radial-gradient(circle at 8% 4%, rgba(185, 144, 85, .13), transparent 26rem),
    radial-gradient(circle at 95% 25%, rgba(57, 105, 91, .12), transparent 30rem);
  pointer-events: none;
}
[dir="rtl"] body { font-family: "Cairo", "Manrope", system-ui, sans-serif; }
button, input, select { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
button { cursor: pointer; }
a { color: inherit; text-decoration: none; }
.hidden { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }
.muted { color: var(--ink-soft); line-height: 1.7; }

.topbar {
  width: min(1180px, calc(100% - 32px));
  min-height: 80px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
}
.brand { display: inline-flex; min-width: 0; align-items: center; gap: 12px; font-weight: 700; letter-spacing: -.02em; }
.brand-logo {
  display: block;
  flex: 0 0 94px;
  width: 94px;
  height: 66px;
  mix-blend-mode: multiply;
}
.brand-title { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lang-button, .ghost-button {
  border: 1px solid rgba(22,55,47,.18);
  background: rgba(255,255,255,.45);
  color: var(--ink);
  border-radius: 999px;
  min-height: 42px;
  padding: 0 18px;
  font-weight: 700;
  transition: .2s ease;
}
.lang-button:hover, .ghost-button:hover { background: var(--paper); border-color: var(--gold); transform: translateY(-1px); }

main { width: min(1180px, calc(100% - 32px)); margin: 0 auto; }
.hero {
  position: relative;
  min-height: 380px;
  overflow: hidden;
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(250px, .75fr);
  align-items: center;
  gap: 40px;
  padding: clamp(34px, 6vw, 72px);
  border-radius: 38px;
  background: var(--forest);
  color: #fffaf0;
  box-shadow: var(--shadow);
}
.hero::before {
  content: "";
  position: absolute;
  width: 520px;
  height: 520px;
  right: -210px;
  top: -260px;
  border: 1px solid rgba(234,220,195,.3);
  border-radius: 50%;
  box-shadow: 0 0 0 68px rgba(234,220,195,.035), 0 0 0 138px rgba(234,220,195,.025);
}
[dir="rtl"] .hero::before { right: auto; left: -210px; }
.hero-copy { position: relative; z-index: 1; max-width: 690px; }
.eyebrow { margin: 0 0 12px; text-transform: uppercase; letter-spacing: .17em; font-size: .72rem; font-weight: 800; color: var(--gold); }
[dir="rtl"] .eyebrow { letter-spacing: .04em; }
h1, h2, h3 { margin: 0; line-height: 1.12; }
h1, h2 { font-family: "Playfair Display", "Cairo", serif; }
[dir="rtl"] h1, [dir="rtl"] h2 { font-family: "Cairo", sans-serif; }
.hero h1 { font-size: clamp(3rem, 7vw, 6.4rem); max-width: 750px; letter-spacing: -.055em; }
[dir="rtl"] .hero h1 { letter-spacing: -.025em; }
.hero-text { margin: 24px 0 0; max-width: 600px; color: rgba(255,250,240,.74); font-size: clamp(1rem, 2vw, 1.16rem); line-height: 1.75; }
.hero-art { position: relative; min-height: 250px; align-self: stretch; }
.bottle { position: absolute; bottom: 15px; border: 1px solid rgba(255,255,255,.24); background: linear-gradient(145deg, rgba(255,255,255,.14), rgba(185,144,85,.18)); box-shadow: 0 25px 70px rgba(0,0,0,.2), inset 0 0 30px rgba(255,255,255,.05); }
.bottle::before { content: ""; position: absolute; left: 50%; transform: translateX(-50%); top: -34px; width: 42%; height: 34px; border-radius: 7px 7px 2px 2px; background: linear-gradient(90deg, #9f7d49, #e5c38d 50%, #8f6d3c); }
.bottle-tall { width: 126px; height: 190px; left: 25%; border-radius: 16px 16px 25px 25px; transform: rotate(-5deg); }
.bottle-round { width: 156px; height: 148px; right: 8%; border-radius: 48% 48% 23% 23%; transform: rotate(5deg); }
.scent-ring { position: absolute; width: 210px; height: 210px; border: 1px solid rgba(234,220,195,.3); border-radius: 50%; left: 4%; top: 5%; }

.catalog-section { padding: clamp(58px, 8vw, 100px) 0 150px; }
.section-heading { display: flex; justify-content: space-between; align-items: end; gap: 30px; margin-bottom: 26px; }
.section-heading h2 { font-size: clamp(2rem, 4vw, 3.8rem); letter-spacing: -.04em; }
.result-count { margin: 0; color: var(--ink-soft); font-size: .88rem; white-space: nowrap; }
.filters { position: sticky; top: 12px; z-index: 10; display: flex; gap: 12px; align-items: center; padding: 12px; border: 1px solid rgba(22,55,47,.1); border-radius: 22px; background: rgba(248,245,238,.86); backdrop-filter: blur(18px); box-shadow: 0 12px 35px rgba(24,51,45,.07); }
.search-box { flex: 1; min-width: 0; position: relative; display: flex; align-items: center; }
.search-box svg { position: absolute; left: 17px; width: 20px; fill: none; stroke: var(--ink-soft); stroke-width: 1.7; }
[dir="rtl"] .search-box svg { left: auto; right: 17px; }
.search-box input { width: 100%; height: 52px; border: 1px solid transparent; border-radius: 15px; background: var(--paper); padding: 0 18px 0 50px; color: var(--ink); outline: none; box-shadow: inset 0 0 0 1px rgba(22,55,47,.07); }
[dir="rtl"] .search-box input { padding: 0 50px 0 18px; }
.search-box input:focus { border-color: var(--gold); box-shadow: 0 0 0 4px rgba(185,144,85,.12); }
.segment { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; padding: 4px; border-radius: 16px; background: #ebe6da; }
.segment-button { min-width: 82px; min-height: 44px; border: 0; border-radius: 12px; color: var(--ink-soft); background: transparent; font-weight: 700; }
.segment-button.active { background: var(--forest); color: #fff; box-shadow: 0 6px 18px rgba(22,55,47,.16); }
.alphabet { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; padding: 16px 2px 20px; }
.alphabet::-webkit-scrollbar { display: none; }
.letter-button { flex: 0 0 34px; height: 34px; border: 0; border-radius: 50%; color: var(--ink-soft); background: transparent; font-size: .78rem; font-weight: 800; }
.letter-button:hover, .letter-button.active { background: var(--gold-soft); color: var(--forest); }
.catalog-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.perfume-card { position: relative; display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 14px; min-height: 98px; padding: 18px; border: 1px solid rgba(22,55,47,.1); border-radius: 20px; background: rgba(255,253,248,.74); transition: .2s ease; }
.perfume-card:hover { transform: translateY(-2px); background: var(--paper); border-color: rgba(185,144,85,.6); box-shadow: 0 15px 38px rgba(24,51,45,.08); }
.perfume-card.selected { border-color: var(--forest); background: #f2f4ec; box-shadow: inset 0 0 0 1px var(--forest); }
.check-wrap { display: grid; place-items: center; }
.perfume-check { appearance: none; width: 25px; height: 25px; margin: 0; border: 1.5px solid #95a09d; border-radius: 8px; background: #fff; cursor: pointer; }
.perfume-check:checked { border-color: var(--forest); background: var(--forest); box-shadow: inset 0 0 0 5px var(--forest); }
.perfume-check:checked::after { content: "✓"; display: grid; place-items: center; height: 100%; color: #fff; font-size: 16px; font-weight: 800; }
.perfume-info { min-width: 0; cursor: pointer; }
.perfume-info h3 { font-size: 1rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.perfume-info p { margin: 7px 0 0; color: var(--ink-soft); font-size: .78rem; }
.perfume-code { display: block; margin-top: 5px; color: var(--forest); font-size: .875rem; font-weight: 700; line-height: 1.5; overflow-wrap: anywhere; }
.perfume-code bdi { font-variant-numeric: tabular-nums; }
.image-button { display: inline-flex; align-items: center; gap: 7px; border: 0; border-radius: 999px; background: var(--gold-soft); color: var(--forest); padding: 9px 12px; font-size: .75rem; font-weight: 800; }
.image-button svg { width: 15px; fill: none; stroke: currentColor; stroke-width: 1.8; }
.empty-state { padding: 70px 20px; text-align: center; border: 1px dashed rgba(22,55,47,.2); border-radius: var(--radius); color: var(--ink-soft); }
.empty-state > span { display: block; font-size: 3rem; margin-bottom: 14px; color: var(--gold); }
.empty-state h3 { color: var(--ink); }
.empty-state p { margin-bottom: 0; }

.selection-bar { position: fixed; z-index: 30; left: 50%; bottom: max(18px, env(safe-area-inset-bottom)); transform: translateX(-50%); width: min(680px, calc(100% - 24px)); display: flex; justify-content: space-between; align-items: center; gap: 18px; padding: 10px 10px 10px 22px; color: #fff; background: rgba(22,55,47,.95); backdrop-filter: blur(15px); border: 1px solid rgba(255,255,255,.15); border-radius: 22px; box-shadow: 0 20px 55px rgba(11,31,26,.28); }
[dir="rtl"] .selection-bar { padding: 10px 22px 10px 10px; }
.selection-bar strong { font-size: 1.25rem; margin-inline-end: 5px; }
.primary-button { display: inline-flex; justify-content: center; align-items: center; gap: 14px; min-height: 48px; border: 0; border-radius: 15px; padding: 0 22px; color: #fff; background: var(--forest); font-weight: 800; box-shadow: 0 10px 24px rgba(22,55,47,.16); transition: .2s ease; }
.selection-bar .primary-button { background: var(--gold); color: #132a24; box-shadow: none; }
.primary-button:hover { filter: brightness(1.06); transform: translateY(-1px); }
.primary-button:disabled { opacity: .6; cursor: wait; transform: none; }
.text-button { display: block; width: 100%; border: 0; background: transparent; color: var(--ink-soft); padding: 15px; font-weight: 700; }

.dialog { width: min(620px, calc(100% - 24px)); max-height: min(860px, calc(100dvh - 24px)); overflow: auto; border: 0; border-radius: 28px; padding: clamp(24px, 5vw, 46px); color: var(--ink); background: var(--paper); box-shadow: 0 35px 100px rgba(14,34,28,.28); }
.dialog::backdrop { background: rgba(10,28,23,.68); backdrop-filter: blur(7px); }
.dialog-close { position: absolute; top: 16px; right: 16px; }
[dir="rtl"] .dialog-close { right: auto; left: 16px; }
.icon-button { width: 38px; height: 38px; border: 0; border-radius: 50%; background: rgba(22,55,47,.08); color: var(--ink); font-size: 1.55rem; line-height: 1; }
.image-dialog { padding: 0; overflow: hidden; }
.image-stage { min-height: 360px; display: grid; place-items: center; background: linear-gradient(145deg, #e9e3d8, #f9f5ed); }
.image-stage img { width: 100%; height: min(55vh, 520px); object-fit: contain; display: block; }
.image-placeholder { width: 140px; height: 185px; border: 1px solid rgba(22,55,47,.2); border-radius: 18px 18px 32px 32px; display: grid; place-items: center; color: var(--gold); font-family: "Playfair Display", serif; font-size: 3rem; box-shadow: inset 0 0 35px rgba(185,144,85,.12); }
.dialog-copy { padding: 28px 34px 34px; }
.dialog h2 { font-size: clamp(1.8rem, 5vw, 2.8rem); letter-spacing: -.035em; margin-bottom: 10px; }
.dialog h3 { font-size: 1.55rem; }
.selected-summary { display: flex; gap: 8px; overflow-x: auto; margin: 26px 0; padding-bottom: 6px; }
.summary-pill { flex: 0 0 auto; padding: 8px 12px; border-radius: 999px; background: var(--gold-soft); font-size: .78rem; font-weight: 700; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.form-grid label, .login-row label { display: grid; gap: 8px; color: var(--ink-soft); font-size: .82rem; font-weight: 700; }
.form-grid input, .form-grid select, .login-row input { width: 100%; height: 50px; border: 1px solid rgba(22,55,47,.16); border-radius: 13px; background: #fff; color: var(--ink); padding: 0 14px; outline: none; }
.form-grid input:focus, .form-grid select:focus, .login-row input:focus { border-color: var(--gold); box-shadow: 0 0 0 4px rgba(185,144,85,.1); }
.full-width { grid-column: 1 / -1; }
.privacy-note { color: var(--ink-soft); font-size: .72rem; line-height: 1.6; margin: 18px 0; }
.submit-button { width: 100%; margin-top: 4px; }
.success-dialog { text-align: center; }
.success-icon { display: grid; place-items: center; width: 72px; height: 72px; margin: 0 auto 24px; border-radius: 50%; color: #fff; background: var(--forest); font-size: 2rem; }
.order-reference { min-height: 22px; color: var(--gold); font-weight: 800; }
.success-dialog .primary-button { min-width: 190px; }
.toast { position: fixed; z-index: 80; left: 50%; top: 22px; transform: translateX(-50%); width: min(500px, calc(100% - 30px)); padding: 14px 18px; border-radius: 15px; color: #fff; background: #263f38; text-align: center; box-shadow: var(--shadow); font-size: .86rem; }
.toast.error { background: var(--danger); }

.admin-main { padding: 28px 0 90px; }
.admin-hero { display: flex; justify-content: space-between; align-items: end; gap: 30px; padding: clamp(30px, 5vw, 56px); border-radius: 30px; background: var(--forest); color: #fff; }
.admin-hero h1 { font-size: clamp(2.5rem, 6vw, 5rem); letter-spacing: -.05em; }
.admin-hero .muted { max-width: 680px; margin-bottom: 0; color: rgba(255,255,255,.68); }
.admin-hero .primary-button { background: var(--gold); color: var(--forest); white-space: nowrap; }
.admin-login, .admin-content { margin-top: 24px; padding: clamp(24px, 4vw, 40px); border: 1px solid rgba(22,55,47,.1); border-radius: 25px; background: rgba(255,253,248,.76); }
.login-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: end; gap: 12px; margin-top: 24px; }
.demo-note { margin: 18px 0 0; padding: 12px 14px; border-radius: 12px; background: #f3e7ce; color: #6a4a1f; font-size: .8rem; }
.admin-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 20px; margin-bottom: 22px; }
.admin-toolbar .search-box { max-width: 520px; }
.admin-stats { color: var(--ink-soft); font-size: .85rem; white-space: nowrap; }
.admin-list { display: grid; gap: 10px; }
.admin-row { display: grid; grid-template-columns: 1.2fr .9fr auto auto; gap: 18px; align-items: center; padding: 16px 18px; border: 1px solid rgba(22,55,47,.1); border-radius: 17px; background: #fff; }
.admin-row.is-hidden { opacity: .58; }
.admin-name { min-width: 0; }
.admin-name strong, .admin-name span { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.admin-name span { margin-top: 4px; color: var(--ink-soft); font-family: "Cairo", sans-serif; font-size: .8rem; }
.admin-name .perfume-code { color: var(--forest); font-size: .875rem; white-space: normal; }
.admin-meta { color: var(--ink-soft); font-size: .8rem; }
.row-edit { border: 0; border-radius: 11px; padding: 9px 13px; color: var(--ink); background: var(--gold-soft); font-weight: 800; }
.toggle-label { display: flex !important; align-items: center; gap: 10px !important; cursor: pointer; }
.toggle-label input { position: absolute; opacity: 0; pointer-events: none; }
.toggle { position: relative; width: 44px; height: 25px; border-radius: 999px; background: #c8cfcc; transition: .2s; }
.toggle::after { content: ""; position: absolute; width: 19px; height: 19px; left: 3px; top: 3px; border-radius: 50%; background: white; box-shadow: 0 2px 6px rgba(0,0,0,.16); transition: .2s; }
.toggle-label input:checked + .toggle { background: var(--forest); }
.toggle-label input:checked + .toggle::after { transform: translateX(19px); }
[dir="rtl"] .toggle::after { left: auto; right: 3px; }
[dir="rtl"] .toggle-label input:checked + .toggle::after { transform: translateX(-19px); }
.edit-dialog { width: min(700px, calc(100% - 24px)); }

@media (max-width: 900px) {
  .hero { grid-template-columns: 1fr; min-height: 520px; }
  .hero-art { position: absolute; right: 20px; bottom: 15px; width: 280px; height: 190px; opacity: .75; }
  [dir="rtl"] .hero-art { right: auto; left: 20px; }
  .catalog-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .admin-row { grid-template-columns: 1fr auto auto; }
  .admin-meta { display: none; }
}

@media (max-width: 640px) {
  .topbar, main { width: min(100% - 22px, 1180px); }
  .topbar { min-height: 68px; }
  .brand { gap: 8px; font-size: .88rem; }
  .brand-logo { flex-basis: 82px; width: 82px; height: 58px; }
  .lang-button, .ghost-button { min-height: 38px; padding: 0 13px; font-size: .78rem; }
  .hero { min-height: 480px; padding: 34px 24px; border-radius: 27px; align-items: start; }
  .hero h1 { font-size: clamp(2.9rem, 16vw, 4.4rem); }
  .hero-text { font-size: .94rem; }
  .hero-art { transform: scale(.78); transform-origin: bottom right; right: -18px; }
  [dir="rtl"] .hero-art { transform-origin: bottom left; right: auto; left: -18px; }
  .catalog-section { padding-top: 58px; }
  .section-heading { display: block; }
  .result-count { margin-top: 10px; }
  .filters { align-items: stretch; flex-direction: column; top: 7px; padding: 9px; border-radius: 19px; }
  .search-box input { height: 48px; }
  .segment-button { min-width: 0; min-height: 40px; }
  .catalog-grid { grid-template-columns: 1fr; gap: 9px; }
  .perfume-card { min-height: 86px; padding: 14px; border-radius: 17px; }
  .selection-bar { border-radius: 18px; }
  .selection-bar .primary-button { padding: 0 18px; }
  .dialog { border-radius: 23px; }
  .form-grid { grid-template-columns: 1fr; }
  .full-width { grid-column: auto; }
  .image-stage { min-height: 300px; }
  .admin-main { padding-top: 8px; }
  .admin-hero { display: block; padding: 28px 22px; border-radius: 24px; }
  .admin-hero .primary-button { width: 100%; margin-top: 24px; }
  .admin-login, .admin-content { padding: 20px 16px; }
  .login-row, .admin-toolbar { display: flex; flex-direction: column; align-items: stretch; }
  .admin-toolbar .search-box { max-width: none; }
  .admin-row { grid-template-columns: 1fr auto; gap: 12px; }
  .admin-row .toggle-label { order: 3; }
  .row-edit { grid-row: 1 / span 2; grid-column: 2; }
}

@media (max-width: 390px) {
  .brand-title { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; }
}
