/* ============================================================
   Atlas Tekstil — umumiy stillar
   Estetika: editorial / moda jurnali, iliq neytral palitra
   ============================================================ */

:root {
  --ivory: #f6f1e7;
  --ivory-2: #efe8da;
  --ink: #1f1b17;
  --ink-soft: #4a443c;
  --terracotta: #c75b39;
  --terracotta-dark: #a8482b;
  --green: #5b6e58;
  --line: #d8cfbd;
  --card: #fffdf8;
  --shadow: 0 18px 40px -24px rgba(31, 27, 23, 0.45);
  --radius: 4px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }

body {
  font-family: 'Hanken Grotesk', system-ui, sans-serif;
  background: var(--ivory);
  color: var(--ink);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  background-image:
    radial-gradient(circle at 12% 18%, rgba(199, 91, 57, 0.06), transparent 40%),
    radial-gradient(circle at 88% 82%, rgba(91, 110, 88, 0.07), transparent 42%);
}

.serif { font-family: 'Fraunces', Georgia, serif; }

a { color: inherit; text-decoration: none; }

/* ---------------- Header ---------------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px clamp(20px, 5vw, 64px);
  background: rgba(246, 241, 231, 0.85);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}

.brand {
  font-family: 'Fraunces', serif;
  font-weight: 600;
  font-size: 1.5rem;
  letter-spacing: -0.02em;
  display: flex;
  align-items: center;
  gap: 10px;
}

.brand .dot {
  width: 10px; height: 10px;
  background: var(--terracotta);
  border-radius: 50%;
  display: inline-block;
}

.brand small {
  display: block;
  font-family: 'Hanken Grotesk', sans-serif;
  font-size: 0.62rem;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  color: var(--ink-soft);
  font-weight: 600;
  margin-top: -2px;
}

.nav-actions { display: flex; align-items: center; gap: 22px; }

.nav-link {
  font-size: 0.82rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  font-weight: 600;
  color: var(--ink-soft);
  transition: color 0.2s;
}
.nav-link:hover { color: var(--terracotta); }

.cart-btn {
  position: relative;
  background: var(--ink);
  color: var(--ivory);
  border: none;
  border-radius: 40px;
  padding: 10px 20px;
  font-family: inherit;
  font-size: 0.82rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  cursor: pointer;
  transition: background 0.2s, transform 0.15s;
}
.cart-btn:hover { background: var(--terracotta); transform: translateY(-1px); }

.cart-count {
  background: var(--terracotta);
  color: #fff;
  border-radius: 50%;
  font-size: 0.7rem;
  padding: 1px 7px;
  margin-left: 6px;
}

/* ---------------- Hero ---------------- */
.hero {
  padding: clamp(48px, 9vw, 110px) clamp(20px, 5vw, 64px) clamp(30px, 5vw, 64px);
  display: grid;
  grid-template-columns: 1.2fr 0.8fr;
  gap: 40px;
  align-items: end;
}
@media (max-width: 760px) { .hero { grid-template-columns: 1fr; } }

.hero .eyebrow {
  font-size: 0.75rem;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  color: var(--terracotta);
  font-weight: 700;
  margin-bottom: 18px;
}

.hero h1 {
  font-family: 'Fraunces', serif;
  font-weight: 600;
  font-size: clamp(2.4rem, 6vw, 4.6rem);
  line-height: 0.98;
  letter-spacing: -0.02em;
}
.hero h1 em { font-style: italic; color: var(--terracotta); }

.hero p {
  margin-top: 22px;
  max-width: 46ch;
  color: var(--ink-soft);
  font-size: 1.02rem;
}

.hero-stats { display: flex; gap: 34px; flex-wrap: wrap; }
.hero-stats .stat .num {
  font-family: 'Fraunces', serif;
  font-size: 2.4rem;
  font-weight: 600;
  line-height: 1;
}
.hero-stats .stat .lbl {
  font-size: 0.74rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-soft);
  margin-top: 6px;
}

/* ---------------- Catalog ---------------- */
.catalog { padding: clamp(20px, 4vw, 50px) clamp(20px, 5vw, 64px) 90px; }

.catalog-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  border-top: 2px solid var(--ink);
  padding-top: 18px;
  margin-bottom: 30px;
  gap: 16px;
  flex-wrap: wrap;
}
.catalog-head h2 {
  font-family: 'Fraunces', serif;
  font-weight: 600;
  font-size: clamp(1.6rem, 3vw, 2.3rem);
  letter-spacing: -0.01em;
}

.filters { display: flex; gap: 8px; flex-wrap: wrap; }
.filter-chip {
  border: 1px solid var(--line);
  background: transparent;
  border-radius: 30px;
  padding: 7px 16px;
  font-family: inherit;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  color: var(--ink-soft);
  transition: all 0.18s;
}
.filter-chip:hover { border-color: var(--ink); }
.filter-chip.active { background: var(--ink); color: var(--ivory); border-color: var(--ink); }

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 26px;
}

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: transform 0.25s ease, box-shadow 0.25s ease;
  animation: rise 0.5s ease both;
}
.card:hover { transform: translateY(-6px); box-shadow: var(--shadow); }

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

.thumb {
  aspect-ratio: 4 / 5;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}
.thumb-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.4s ease;
}
.card:hover .thumb-img { transform: scale(1.05); }

.thumb .mono {
  font-family: 'Fraunces', serif;
  font-size: 3.6rem;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.92);
  mix-blend-mode: overlay;
}
.thumb .tag {
  position: absolute;
  top: 12px; left: 12px;
  background: rgba(255, 253, 248, 0.92);
  font-size: 0.66rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  padding: 4px 10px;
  border-radius: 20px;
}
.thumb .low {
  position: absolute;
  bottom: 12px; right: 12px;
  background: var(--terracotta);
  color: #fff;
  font-size: 0.64rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 4px 9px;
  border-radius: 20px;
}

.card-body { padding: 18px; display: flex; flex-direction: column; gap: 6px; flex: 1; }
.card-body h3 { font-family: 'Fraunces', serif; font-weight: 600; font-size: 1.18rem; line-height: 1.1; }
.card-body .desc { font-size: 0.86rem; color: var(--ink-soft); flex: 1; }
.card-foot {
  display: flex; align-items: center; justify-content: space-between;
  margin-top: 10px;
}
.price { font-family: 'Fraunces', serif; font-size: 1.3rem; font-weight: 600; }
.price small { font-family: 'Hanken Grotesk', sans-serif; font-size: 0.7rem; color: var(--ink-soft); font-weight: 600; }

.add-btn {
  background: var(--terracotta);
  color: #fff;
  border: none;
  border-radius: 30px;
  padding: 9px 16px;
  font-family: inherit;
  font-size: 0.8rem;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.18s, transform 0.12s;
}
.add-btn:hover { background: var(--terracotta-dark); transform: scale(1.04); }
.add-btn:disabled { background: var(--line); color: var(--ink-soft); cursor: not-allowed; transform: none; }

/* ---------------- Cart drawer ---------------- */
.drawer-overlay {
  position: fixed; inset: 0;
  background: rgba(31, 27, 23, 0.4);
  opacity: 0; pointer-events: none;
  transition: opacity 0.25s;
  z-index: 90;
}
.drawer-overlay.open { opacity: 1; pointer-events: auto; }

.drawer {
  position: fixed; top: 0; right: 0; bottom: 0;
  width: min(420px, 92vw);
  background: var(--ivory);
  z-index: 100;
  transform: translateX(100%);
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  display: flex; flex-direction: column;
  box-shadow: -20px 0 50px -30px rgba(0,0,0,0.5);
}
.drawer.open { transform: translateX(0); }

.drawer-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 22px 24px; border-bottom: 1px solid var(--line);
}
.drawer-head h3 { font-family: 'Fraunces', serif; font-size: 1.4rem; font-weight: 600; }
.close-btn { background: none; border: none; font-size: 1.5rem; cursor: pointer; color: var(--ink); }

.drawer-body { flex: 1; overflow-y: auto; padding: 18px 24px; }
.cart-item {
  display: flex; gap: 12px; align-items: center;
  padding: 12px 0; border-bottom: 1px solid var(--line);
}
.cart-item .swatch { width: 46px; height: 56px; border-radius: 3px; flex-shrink: 0; }
.cart-item .info { flex: 1; }
.cart-item .info h4 { font-size: 0.95rem; font-weight: 700; }
.cart-item .info .p { font-size: 0.82rem; color: var(--ink-soft); }
.qty { display: flex; align-items: center; gap: 8px; }
.qty button {
  width: 26px; height: 26px; border-radius: 50%;
  border: 1px solid var(--line); background: var(--card);
  cursor: pointer; font-weight: 700; font-family: inherit;
}
.qty button:hover { border-color: var(--ink); }
.remove { background: none; border: none; color: var(--terracotta); cursor: pointer; font-size: 0.78rem; font-weight: 700; }

.empty-cart { text-align: center; color: var(--ink-soft); padding: 40px 0; }

.drawer-foot { padding: 20px 24px; border-top: 1px solid var(--line); }
.total-row { display: flex; justify-content: space-between; font-family: 'Fraunces', serif; font-size: 1.3rem; font-weight: 600; margin-bottom: 16px; }

.field { margin-bottom: 12px; }
.field label { display: block; font-size: 0.72rem; letter-spacing: 0.08em; text-transform: uppercase; font-weight: 700; color: var(--ink-soft); margin-bottom: 5px; }
.field input {
  width: 100%; padding: 11px 13px;
  border: 1px solid var(--line); border-radius: 4px;
  background: var(--card); font-family: inherit; font-size: 0.92rem; color: var(--ink);
}
.field input:focus { outline: none; border-color: var(--terracotta); }

.checkout-btn {
  width: 100%; background: var(--ink); color: var(--ivory);
  border: none; border-radius: 4px; padding: 14px;
  font-family: inherit; font-weight: 700; font-size: 0.95rem; letter-spacing: 0.04em;
  cursor: pointer; transition: background 0.2s;
}
.checkout-btn:hover { background: var(--terracotta); }
.checkout-btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* ---------------- Footer ---------------- */
.site-footer {
  border-top: 1px solid var(--line);
  padding: 40px clamp(20px, 5vw, 64px);
  display: flex; justify-content: space-between; flex-wrap: wrap; gap: 16px;
  font-size: 0.84rem; color: var(--ink-soft);
}

/* ---------------- Toast ---------------- */
.toast {
  position: fixed; bottom: 26px; left: 50%;
  transform: translateX(-50%) translateY(120%);
  background: var(--ink); color: var(--ivory);
  padding: 13px 22px; border-radius: 40px;
  font-size: 0.9rem; font-weight: 600;
  z-index: 200; transition: transform 0.3s;
  box-shadow: var(--shadow);
}
.toast.show { transform: translateX(-50%) translateY(0); }
.toast.err { background: var(--terracotta-dark); }

/* ============================================================
   ADMIN PANEL
   ============================================================ */
.admin-shell { display: flex; min-height: 100vh; }

.sidebar {
  width: 240px; background: var(--ink); color: var(--ivory);
  padding: 28px 22px; flex-shrink: 0;
  display: flex; flex-direction: column;
}
.sidebar .brand { color: var(--ivory); margin-bottom: 36px; }
.sidebar .brand small { color: rgba(246,241,231,0.6); }
.side-link {
  display: block; padding: 11px 14px; border-radius: 6px;
  font-size: 0.92rem; font-weight: 600; color: rgba(246,241,231,0.72);
  cursor: pointer; margin-bottom: 4px; transition: all 0.16s;
}
.side-link:hover { background: rgba(255,255,255,0.06); color: var(--ivory); }
.side-link.active { background: var(--terracotta); color: #fff; }
.sidebar .logout { margin-top: auto; }

.admin-main { flex: 1; padding: 32px clamp(20px, 4vw, 48px); overflow-x: auto; }

.admin-topbar { display: flex; justify-content: space-between; align-items: center; margin-bottom: 28px; flex-wrap: wrap; gap: 12px; }
.admin-topbar h1 { font-family: 'Fraunces', serif; font-weight: 600; font-size: 2rem; letter-spacing: -0.01em; }

.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 18px; margin-bottom: 34px; }
.stat-card {
  background: var(--card); border: 1px solid var(--line); border-radius: 6px;
  padding: 20px 22px;
}
.stat-card .lbl { font-size: 0.72rem; letter-spacing: 0.1em; text-transform: uppercase; color: var(--ink-soft); font-weight: 700; }
.stat-card .val { font-family: 'Fraunces', serif; font-size: 2.2rem; font-weight: 600; margin-top: 6px; }
.stat-card.accent { background: var(--terracotta); color: #fff; border-color: var(--terracotta); }
.stat-card.accent .lbl { color: rgba(255,255,255,0.85); }

.panel { display: none; }
.panel.active { display: block; }

.table-wrap { background: var(--card); border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 13px 16px; font-size: 0.88rem; border-bottom: 1px solid var(--line); }
th { background: var(--ivory-2); font-size: 0.72rem; letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink-soft); font-weight: 700; }
tr:last-child td { border-bottom: none; }

.swatch-sm { width: 22px; height: 22px; border-radius: 4px; display: inline-block; vertical-align: middle; }
.admin-thumb { width: 40px; height: 48px; object-fit: cover; border-radius: 4px; display: inline-block; vertical-align: middle; }
.badge { font-size: 0.72rem; font-weight: 700; padding: 3px 10px; border-radius: 20px; background: var(--ivory-2); }
.badge.low { background: var(--terracotta); color: #fff; }
.badge.new { background: var(--green); color: #fff; }

.icon-btn { background: none; border: 1px solid var(--line); border-radius: 5px; padding: 5px 10px; cursor: pointer; font-family: inherit; font-size: 0.78rem; font-weight: 600; margin-right: 5px; }
.icon-btn:hover { border-color: var(--ink); }
.icon-btn.danger { color: var(--terracotta); }
.icon-btn.danger:hover { background: var(--terracotta); color: #fff; border-color: var(--terracotta); }

.btn-primary {
  background: var(--terracotta); color: #fff; border: none; border-radius: 6px;
  padding: 11px 20px; font-family: inherit; font-weight: 700; font-size: 0.88rem; cursor: pointer;
  transition: background 0.18s;
}
.btn-primary:hover { background: var(--terracotta-dark); }

/* Login */
.login-wrap { display: flex; align-items: center; justify-content: center; min-height: 100vh; padding: 20px; }
.login-card {
  background: var(--card); border: 1px solid var(--line); border-radius: 10px;
  padding: 40px; width: min(400px, 100%); box-shadow: var(--shadow);
}
.login-card h1 { font-family: 'Fraunces', serif; font-weight: 600; font-size: 1.8rem; margin-bottom: 6px; }
.login-card p { color: var(--ink-soft); font-size: 0.9rem; margin-bottom: 26px; }
.login-card .hint { margin-top: 16px; font-size: 0.78rem; color: var(--ink-soft); text-align: center; }

/* Modal */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(31,27,23,0.45);
  display: none; align-items: center; justify-content: center; z-index: 150; padding: 20px;
}
.modal-overlay.open { display: flex; }
.modal {
  background: var(--ivory); border-radius: 10px; padding: 30px;
  width: min(480px, 100%); max-height: 90vh; overflow-y: auto;
}
.modal h2 { font-family: 'Fraunces', serif; font-weight: 600; font-size: 1.5rem; margin-bottom: 20px; }
.modal-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 22px; }

.empty-state { text-align: center; padding: 60px 20px; color: var(--ink-soft); }
