@import url("https://fonts.googleapis.com/css2?family=JetBrains+Mono:wght@400;500&display=swap");

@font-face {
  font-family: "Futura PT";
  src: url("../assets/fonts/FuturaPT-Book.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Futura PT";
  src: url("../assets/fonts/FuturaPT-Medium.woff2") format("woff2");
  font-weight: 500 600;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Futura PT";
  src: url("../assets/fonts/FuturaPT-Bold.woff2") format("woff2");
  font-weight: 700 800;
  font-style: normal;
  font-display: swap;
}

:root {
  --ink: #0d0d0d;
  --paper: #f5f4f1;
  --white: #ffffff;
  --line: #0d0d0d;
  --line-soft: #d9d8d3;
  --mid: #7a7a76;
  --danger: #8a2c2c;
  --ok: #2c6a3f;
  --font-display: "Futura PT", sans-serif;
  --font-body: "Futura PT", sans-serif;
  --font-mono: "JetBrains Mono", monospace;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--paper); color: var(--ink); font-family: var(--font-body); }
button { cursor: pointer; font-family: inherit; border: none; background: none; color: inherit; }
input, select, textarea { font-family: inherit; }
a { color: inherit; }

/* ---------- Login screen ---------- */
.login-screen {
  min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 20px;
}
.login-box {
  width: 100%; max-width: 360px; padding: 32px; background: var(--white); border: 1px solid var(--line); border-radius: 12px;
  display: flex; flex-direction: column; gap: 16px;
}
.login-box h1 { font-family: var(--font-display); font-weight: 700; font-size: 20px; margin: 0 0 4px; }
.login-box p.sub { margin: 0; font-size: 13px; color: var(--mid); }

/* ---------- Shell ---------- */
.admin-shell { display: none; min-height: 100vh; }
.admin-shell.active { display: flex; }

.sidebar {
  width: 220px; flex-shrink: 0; background: var(--ink); color: var(--paper);
  display: flex; flex-direction: column; padding: 20px 0; position: sticky; top: 0; height: 100vh;
}
.sidebar-brand { display: flex; align-items: center; gap: 10px; padding: 0 20px 20px; border-bottom: 1px solid #2a2a2a; margin-bottom: 12px; }
.sidebar-brand span { font-family: var(--font-display); font-weight: 700; font-size: 15px; }
.sidebar nav { display: flex; flex-direction: column; gap: 2px; }
.sidebar nav button {
  text-align: left; padding: 11px 20px; font-size: 13px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em;
  color: #a6a6a2; border-left: 2px solid transparent;
}
.sidebar nav button.active { color: var(--paper); border-left-color: var(--paper); background: #1a1a1a; }
.sidebar-footer { margin-top: auto; padding: 16px 20px 0; }
.sidebar-footer button { font-size: 12px; color: #a6a6a2; }

.main { flex: 1; padding: 28px 32px; max-width: 1100px; }
.view { display: none; }
.view.active { display: block; }

.view-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 20px; flex-wrap: wrap; gap: 12px; }
.view-head h2 { font-family: var(--font-display); font-weight: 700; font-size: 22px; margin: 0; }

.btn { padding: 9px 16px; font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; border-radius: 8px; }
.btn-dark { background: var(--ink); color: var(--paper); }
.btn-outline { background: transparent; border: 1px solid var(--line-soft) !important; border: 1px solid var(--line-soft); color: var(--ink); }
.btn-danger { background: transparent; color: var(--danger); border: 1px solid var(--danger); }
.btn-sm { padding: 6px 10px; font-size: 11px; border-radius: 6px; }

table { width: 100%; border-collapse: collapse; background: var(--white); border-radius: 10px; overflow: hidden; }
th, td { text-align: left; padding: 10px 12px; font-size: 13px; border-bottom: 1px solid var(--line-soft); vertical-align: middle; }
tbody tr { height: 76px; }
th { text-transform: uppercase; font-size: 11px; letter-spacing: 0.05em; color: var(--mid); font-weight: 600; }
td.mono, th.mono { font-family: var(--font-mono); }
tr:last-child td { border-bottom: none; }
.row-actions { display: flex; gap: 8px; align-items: center; }

.tag { display: inline-block; padding: 3px 8px; font-size: 11px; font-family: var(--font-mono); border: 1px solid var(--line-soft); border-radius: 6px; }
.tag.in-stock { border-color: var(--ok); color: var(--ok); }
.tag.out-stock { border-color: var(--danger); color: var(--danger); }

.status-select { padding: 5px 8px; font-size: 12px; border: 1px solid var(--line-soft); background: var(--white); border-radius: 6px; }

/* ---------- Modal (product/category form) ---------- */
.admin-modal-overlay {
  position: fixed; inset: 0; z-index: 60; background: rgba(13,13,13,0.55);
  display: none; align-items: flex-start; justify-content: center; overflow-y: auto;
  padding: 30px 16px;
}
.admin-modal-overlay.open { display: flex; }
.admin-modal { width: 100%; max-width: 720px; margin: 0; background: var(--white); border: 1px solid var(--line); border-radius: 14px; overflow: hidden; }
.admin-modal-head { display: flex; justify-content: space-between; align-items: center; padding: 20px 28px; border-bottom: 1px solid var(--line-soft); }
.admin-modal-head h3 { margin: 0; font-family: var(--font-display); font-weight: 700; font-size: 17px; }
.admin-modal-body { padding: 24px 28px; display: flex; flex-direction: column; gap: 20px; max-height: 74vh; overflow-y: auto; }
.admin-modal-foot { padding: 18px 28px; border-top: 1px solid var(--line-soft); display: flex; gap: 10px; justify-content: flex-end; }

.form-section {
  border: 1px solid var(--line-soft); border-radius: 10px; padding: 18px 18px 20px; background: #fbfbfa;
  display: flex; flex-direction: column; gap: 14px;
}
.form-section-title {
  font-size: 11px; text-transform: uppercase; letter-spacing: 0.08em; color: var(--mid); font-weight: 700;
  margin: -4px 0 2px;
}

.field { display: flex; flex-direction: column; gap: 5px; }
.field label { font-size: 11px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--mid); font-weight: 600; }
.field input, .field select, .field textarea {
  padding: 10px 12px; font-size: 13px; border: 1px solid var(--line-soft); background: var(--white); border-radius: 8px;
}
.field input:focus, .field select:focus, .field textarea:focus { outline: 2px solid var(--ink); outline-offset: 1px; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; align-items: end; }
.field-row-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 14px; align-items: end; }

.size-toggle-row { display: flex; gap: 8px; flex-wrap: wrap; }
.size-toggle {
  padding: 7px 13px; font-size: 12px; font-family: var(--font-mono); border: 1px solid var(--line-soft); border-radius: 7px;
}
.size-toggle.on { background: var(--ink); color: var(--paper); border-color: var(--ink); }

.image-upload-row { display: flex; align-items: center; gap: 12px; }
.image-preview {
  width: 64px; height: 78px; background-size: cover; background-position: center; background-color: #eee;
  border: 1px solid var(--line-soft); border-radius: 8px; flex-shrink: 0;
}
.upload-hint { font-size: 11px; color: var(--mid); }

.form-error { font-size: 12px; color: var(--danger); }
.empty-note { font-size: 13px; color: var(--mid); padding: 24px 0; }

@media (max-width: 760px) {
  .sidebar { position: fixed; height: auto; width: 100%; flex-direction: row; overflow-x: auto; padding: 10px 0; z-index: 20; }
  .sidebar-brand { display: none; }
  .sidebar nav { flex-direction: row; }
  .sidebar-footer { display: none; }
  .admin-shell.active { flex-direction: column; }
  .main { padding-top: 72px; }
  .field-row, .field-row-3 { grid-template-columns: 1fr; }
}

/* ---------- Gallery image list in product form ---------- */
.image-list-item {
  display: flex; align-items: center; gap: 10px; padding: 8px; border: 1px solid var(--line-soft); border-radius: 8px; background: var(--white);
}
.image-list-item .image-preview { width: 44px; height: 54px; }
.image-list-item .image-url { flex: 1; font-size: 11px; font-family: var(--font-mono); color: var(--mid); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.image-list-item .cover-tag { font-size: 10px; text-transform: uppercase; letter-spacing: 0.05em; padding: 3px 7px; border: 1px solid var(--line-soft); border-radius: 6px; color: var(--mid); }

/* ---------- Compact thumbnail grid for product gallery (admin form) ---------- */
.image-thumb-grid { display: flex; flex-wrap: wrap; gap: 10px; }
.image-thumb {
  position: relative; width: 72px; height: 88px; border-radius: 8px; border: 1px solid var(--line-soft);
  background-size: cover; background-position: center; background-color: #eee; flex-shrink: 0;
}
.image-thumb-remove {
  position: absolute; top: -6px; right: -6px; width: 20px; height: 20px; border-radius: 50%;
  background: var(--ink); color: var(--paper); font-size: 13px; line-height: 1;
  display: flex; align-items: center; justify-content: center; border: 2px solid var(--white);
}
.image-thumb-cover {
  position: absolute; bottom: 4px; left: 4px; right: 4px; text-align: center;
  font-size: 9px; text-transform: uppercase; letter-spacing: 0.03em; font-weight: 700;
  background: rgba(255,255,255,0.92); color: var(--ink); padding: 2px 0; border-radius: 4px;
}
.image-thumb-cover-btn {
  position: absolute; bottom: 4px; left: 4px; right: 4px; text-align: center;
  font-size: 11px; background: rgba(13,13,13,0.55); color: var(--paper); padding: 2px 0; border-radius: 4px;
  opacity: 0; transition: opacity .15s;
}
.image-thumb:hover .image-thumb-cover-btn { opacity: 1; }