/* YULIA admin panel styles (loaded on top of styles.css) */

/* The `hidden` attribute must always win. Class rules like `.gate { display:grid }`
   would otherwise override the UA `[hidden] { display:none }` and keep hidden
   panels (the login gate, the app, modals) visible on top of everything. */
[hidden] { display: none !important; }

.admin { background: var(--bg); }

/* ---------- passcode gate ---------- */
.gate {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 1.5rem;
}
.gate-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 2.5rem 2rem;
  width: min(380px, 100%);
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}
.gate-logo { width: 72px; height: 72px; border-radius: 50%; object-fit: cover; margin: 0 auto 0.5rem; }
.gate-card h1 { font-size: 1.8rem; }
.gate-card p { color: var(--muted); margin: 0 0 0.5rem; }
.gate-card input {
  padding: 0.8rem 1rem; border: 1px solid var(--line); border-radius: var(--radius-sm);
  font-family: var(--sans); font-size: 1rem;
  background: var(--bg-soft); color: var(--ink);
}
.gate-card input:focus { outline: 2px solid var(--accent-soft); border-color: var(--accent); }
.gate-error { color: var(--accent-deep); font-size: 0.85rem; margin: 0; }
.gate-hint { color: var(--muted); font-size: 0.8rem; margin: 0.2rem 0 0; }
.gate-hint code { background: var(--bg-soft); padding: 0.1rem 0.4rem; border-radius: 6px; }
.gate-back { color: var(--muted); font-size: 0.85rem; text-decoration: none; margin-top: 0.4rem; }
.gate-back:hover { color: var(--accent-deep); }

/* ---------- header & nav ---------- */
.admin-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 0.9rem 1.25rem; background: var(--card); border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 20;
}
.admin-brand { display: flex; align-items: center; gap: 0.6rem; font-family: var(--serif); font-size: 1.3rem; letter-spacing: 0.1em; }
.admin-brand img { width: 38px; height: 38px; border-radius: 50%; object-fit: cover; }
.admin-nav { display: flex; align-items: center; gap: 1rem; }
.admin-nav a { text-decoration: none; color: var(--muted); font-size: 0.9rem; }
.admin-nav a:hover { color: var(--accent-deep); }

.btn-ghost {
  background: none; border: 1px solid var(--line); border-radius: 999px;
  padding: 0.5rem 1.1rem; cursor: pointer; font-family: var(--sans); font-size: 0.9rem; color: var(--ink);
}
.btn-ghost:hover { border-color: var(--accent); color: var(--accent-deep); }
.btn-danger {
  background: transparent; border: 1px solid #b5524f; color: #e58a87;
  border-radius: 999px; padding: 0.6rem 1.3rem; cursor: pointer; font-family: var(--sans); font-size: 0.95rem;
}
.btn-danger:hover { background: #b23b3b; color: #fff; border-color: #b23b3b; }

/* ---------- tabs ---------- */
.admin-tabs { display: flex; gap: 0.3rem; padding: 1rem 1.25rem 0; max-width: var(--maxw); margin: 0 auto; flex-wrap: wrap; }
.tab {
  background: none; border: none; border-bottom: 2px solid transparent;
  padding: 0.6rem 0.9rem; cursor: pointer; font-family: var(--sans); font-size: 0.98rem; color: var(--muted);
}
.tab.active { color: var(--accent-deep); border-color: var(--accent); font-weight: 500; }

.admin-main { max-width: var(--maxw); margin: 0 auto; padding: 1.5rem 1.25rem 4rem; }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-bottom: 1.3rem; flex-wrap: wrap; }
.panel-head h2, .tab-panel > h2 { font-size: 1.8rem; }
.count { color: var(--muted); font-size: 1rem; font-family: var(--sans); }

/* ---------- product list ---------- */
.admin-products { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 1.1rem; }
.admin-card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  overflow: hidden; display: flex; flex-direction: column;
}
.admin-card .thumb { aspect-ratio: 1/1; background: var(--bg-soft); overflow: hidden; }
.admin-card .thumb img { width: 100%; height: 100%; object-fit: cover; }
.admin-card .info { padding: 0.9rem 1rem; display: flex; flex-direction: column; gap: 0.2rem; flex: 1; }
.admin-card .info h3 { font-size: 1.2rem; }
.admin-card .meta { font-size: 0.8rem; color: var(--muted); }
.admin-card .price { color: var(--accent-deep); font-weight: 500; }
.admin-card .flags { display: flex; gap: 0.3rem; flex-wrap: wrap; margin-top: 0.3rem; }
.flag { font-size: 0.66rem; text-transform: uppercase; letter-spacing: 0.06em; padding: 0.15rem 0.5rem; border-radius: 999px; background: var(--bg-soft); color: var(--accent-deep); }
.flag.sold { background: rgba(0,0,0,0.6); color: #fff; border: 1px solid rgba(255,255,255,0.25); }
.admin-card .actions { display: flex; border-top: 1px solid var(--line); }
.admin-card .actions button {
  flex: 1; background: none; border: none; padding: 0.7rem; cursor: pointer;
  font-family: var(--sans); font-size: 0.9rem; color: var(--ink);
}
.admin-card .actions button:hover { background: var(--bg-soft); }
.admin-card .actions .del { color: #b23b3b; border-left: 1px solid var(--line); }

/* ---------- forms ---------- */
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.form-grid label { display: flex; flex-direction: column; gap: 0.35rem; font-size: 0.9rem; color: var(--ink); }
.form-grid label.full { grid-column: 1 / -1; }
.form-grid label.check { flex-direction: row; align-items: center; gap: 0.5rem; }
.form-grid input[type="text"],
.form-grid input[type="email"],
.form-grid input[type="number"],
.form-grid input[type="password"],
.form-grid textarea {
  padding: 0.65rem 0.8rem; border: 1px solid var(--line); border-radius: var(--radius-sm);
  font-family: var(--sans); font-size: 0.98rem; background: var(--bg-soft); color: var(--ink); width: 100%;
}
.form-grid textarea { resize: vertical; }
.form-grid input:focus, .form-grid textarea:focus { outline: 2px solid var(--accent-soft); border-color: var(--accent); }
.form-grid small { color: var(--muted); font-size: 0.76rem; }
.form-actions { display: flex; align-items: center; gap: 1rem; }
.saved-flag { color: #3a8f5b; font-size: 0.9rem; }

/* ---------- image field ---------- */
.image-field > label { font-size: 0.9rem; margin-bottom: 0.4rem; display: block; }
.image-row { display: flex; gap: 1rem; align-items: flex-start; }
.image-preview {
  width: 120px; height: 120px; flex: none; border-radius: var(--radius-sm);
  background: var(--bg-soft); border: 1px dashed var(--line); overflow: hidden;
  display: grid; place-items: center; color: var(--muted); font-size: 0.8rem; text-align: center;
}
.image-preview img { width: 100%; height: 100%; object-fit: cover; }
.image-controls { flex: 1; display: flex; flex-direction: column; gap: 0.4rem; }

/* multi-image product gallery editor */
.product-images { display: flex; flex-wrap: wrap; gap: 0.6rem; margin-bottom: 0.7rem; }
.product-images .no-images { color: var(--muted); font-size: 0.85rem; }
.pimg {
  position: relative; width: 84px; height: 84px; border-radius: 10px; overflow: hidden;
  border: 1px solid var(--line); background: var(--bg-soft); flex: none;
}
.pimg.is-main { border-color: var(--gold); }
.pimg.uploading { display: grid; place-items: center; color: var(--muted); font-size: 0.72rem; text-align: center; border-style: dashed; }
.pimg img { width: 100%; height: 100%; object-fit: cover; }
.pimg-tag {
  position: absolute; left: 0; bottom: 0; right: 0; text-align: center;
  background: rgba(0, 0, 0, 0.6); color: var(--gold); font-size: 0.62rem;
  letter-spacing: 0.06em; text-transform: uppercase; padding: 1px 0;
}
.pimg-x {
  position: absolute; top: 2px; right: 2px; width: 20px; height: 20px; border-radius: 50%;
  border: none; background: rgba(0, 0, 0, 0.6); color: #fff; cursor: pointer;
  font-size: 1rem; line-height: 1; display: flex; align-items: center; justify-content: center;
}
.pimg-x:hover { background: #c0392b; }
.image-add-row { display: flex; gap: 0.5rem; }
.image-add-row input { flex: 1; }

/* ---------- image fit picker ---------- */
.fit-options { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 0.6rem; margin-top: 0.4rem; }
@media (max-width: 540px) { .fit-options { grid-template-columns: 1fr; } }

/* ---------- caption editor (repeatable rows) ---------- */
.captions-field > small { color: var(--muted); font-size: 0.78rem; display: block; margin: 0.2rem 0 0.7rem; }
.captions-list { display: flex; flex-direction: column; gap: 0.8rem; margin-bottom: 0.8rem; }
.captions-empty { color: var(--muted); font-size: 0.85rem; margin: 0; }
.caption-row { border: 1px solid var(--line); border-radius: 10px; padding: 0.8rem; background: var(--bg-soft); }
.caption-row-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 0.55rem; }
.caption-row-head strong { font-weight: 500; font-size: 0.92rem; }
.caption-del { background: none; border: none; color: var(--muted); cursor: pointer; font-size: 0.78rem; text-decoration: underline; }
.caption-del:hover { color: #d66; }
.caption-text { width: 100%; padding: 0.5rem 0.6rem; border-radius: 8px; border: 1px solid var(--line); background: var(--card, #fff); color: var(--ink); font-family: var(--sans); }
.caption-controls { display: flex; gap: 1.1rem; flex-wrap: wrap; align-items: flex-start; margin-top: 0.7rem; }
.caption-pos { display: flex; flex-direction: column; gap: 0.35rem; }
.caption-lbl { font-size: 0.78rem; color: var(--muted); }
.caption-grid { grid-template-columns: repeat(3, 26px); grid-template-rows: repeat(3, 26px); }
.caption-grid button { width: 26px; height: 26px; }
.caption-style { display: flex; gap: 0.8rem; flex-wrap: wrap; }
.caption-style label { display: flex; flex-direction: column; gap: 0.3rem; font-size: 0.8rem; }
.caption-style select {
  padding: 0.4rem 0.5rem; border-radius: 8px; border: 1px solid var(--line);
  background: var(--card, #fff); color: var(--ink); font-family: var(--sans); font-size: 0.88rem;
}
.caption-color input[type="color"] { width: 44px; height: 32px; padding: 0; border: 1px solid var(--line); border-radius: 8px; background: none; cursor: pointer; }

/* colour swatch + paste-able hex box */
.color-combo { display: inline-flex; align-items: center; gap: 0.4rem; }
.color-combo input[type="color"] { width: 40px; height: 32px; padding: 0; border: 1px solid var(--line); border-radius: 8px; background: none; cursor: pointer; flex: none; }
.hexinput {
  width: 88px; padding: 0.35rem 0.45rem; border: 1px solid var(--line); border-radius: 8px;
  background: var(--card, #fff); color: var(--ink); font-family: var(--sans);
  font-size: 0.85rem; text-transform: uppercase;
}
.add-caption { align-self: flex-start; }

/* hero preview mirrors the real slide (fit + captions) */
#heroPreview { width: 240px; height: 135px; position: relative; }
#heroPreview .hero-caption-group { padding: 0 7%; max-width: 100%; gap: 1px; }
#heroPreview .hero-caption-line { text-shadow: 0 1px 5px rgba(0,0,0,0.85); }
#heroPreview .hero-caption-line.size-sm { font-size: 9px; }
#heroPreview .hero-caption-line.size-md { font-size: 13px; }
#heroPreview .hero-caption-line.size-lg { font-size: 18px; }
#heroPreview .hero-caption-line.size-xl { font-size: 24px; }
@media (max-width: 540px) { #heroPreview { width: 100%; height: 150px; } }
.fit-opt {
  display: flex; gap: 0.55rem; align-items: flex-start; padding: 0.7rem 0.8rem;
  border: 1px solid var(--line); border-radius: 10px; background: var(--bg-soft); cursor: pointer;
}
.fit-opt:hover { border-color: var(--accent); }
.fit-opt input { margin-top: 0.2rem; accent-color: var(--gold); }
.fit-opt span { display: flex; flex-direction: column; gap: 0.15rem; }
.fit-opt strong { font-weight: 500; }
.fit-opt small { color: var(--muted); font-size: 0.74rem; line-height: 1.3; }
.fit-opt:has(input:checked) { border-color: var(--gold); background: var(--accent-soft); }

/* settings checkbox row */
.setting-toggle { display: flex; gap: 0.6rem; align-items: flex-start; cursor: pointer; }
.setting-toggle input { margin-top: 0.2rem; width: 18px; height: 18px; flex: none; accent-color: var(--gold); }
.setting-toggle span { display: flex; flex-direction: column; gap: 0.2rem; }
.setting-toggle small { color: var(--muted); font-size: 0.78rem; line-height: 1.35; }

/* ---------- focus point picker ---------- */
.focus-field small { color: var(--muted); font-size: 0.78rem; display: block; margin: 0.2rem 0 0.6rem; }
.focus-grid {
  display: grid; grid-template-columns: repeat(3, 36px); grid-template-rows: repeat(3, 36px);
  gap: 6px; width: max-content;
}
.focus-grid button {
  width: 36px; height: 36px; border-radius: 8px; border: 1px solid var(--line);
  background: var(--bg-soft); cursor: pointer; position: relative; padding: 0;
}
.focus-grid button::after {
  content: ""; position: absolute; inset: 0; margin: auto; width: 8px; height: 8px;
  border-radius: 50%; background: var(--muted); top: 50%; left: 50%; transform: translate(-50%, -50%);
}
.focus-grid button:hover { border-color: var(--accent); }
.focus-grid button.active { background: var(--accent-soft); border-color: var(--gold); }
.focus-grid button.active::after { background: var(--gold); width: 10px; height: 10px; }

/* ---------- data tab ---------- */
.data-card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 1.4rem 1.5rem; margin-bottom: 1.2rem;
}
.data-card h3 { font-size: 1.3rem; margin-bottom: 0.4rem; }
.data-card p { color: var(--muted); margin: 0 0 1rem; font-size: 0.95rem; }
.data-card code { background: var(--bg-soft); padding: 0.1rem 0.4rem; border-radius: 6px; font-size: 0.88rem; }
.data-card .btn, .data-card .btn-ghost { margin-right: 0.6rem; }
.data-card.danger { border-color: #e9c3c3; }

.edit-card { max-width: 640px; }
.edit-body { padding: 2rem 1.8rem; }
.edit-body h3 { font-size: 1.8rem; margin-bottom: 1.2rem; }

/* ---------- select (category dropdown) ---------- */
.form-grid select {
  padding: 0.65rem 0.8rem; border: 1px solid var(--line); border-radius: var(--radius-sm);
  font-family: var(--sans); font-size: 0.98rem; background: var(--bg-soft); color: var(--ink); width: 100%;
}
.form-grid select:focus { outline: 2px solid var(--accent-soft); border-color: var(--accent); }

/* ---------- categories tab ---------- */
.panel-hint { color: var(--muted); font-size: 0.9rem; margin: -0.6rem 0 1.3rem; max-width: 62ch; }
.admin-categories { display: flex; flex-direction: column; gap: 0.8rem; }
.cat-row {
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem 1.2rem;
}
.cat-info h3 { font-size: 1.25rem; }
.cat-info p { color: var(--muted); margin: 0.2rem 0 0; font-size: 0.9rem; }
.cat-count { display: inline-block; margin-top: 0.4rem; font-size: 0.74rem; color: var(--accent-deep); letter-spacing: 0.05em; text-transform: uppercase; }
.cat-actions { display: flex; gap: 0.4rem; flex: none; }
.cat-actions button {
  background: none; border: 1px solid var(--line); border-radius: 999px;
  padding: 0.45rem 1rem; cursor: pointer; font-family: var(--sans); font-size: 0.88rem; color: var(--ink);
}
.cat-actions button:hover { border-color: var(--accent); color: var(--accent-deep); }
.cat-actions .del:hover { border-color: #b5524f; color: #e58a87; }

/* ---------- slideshow tab ---------- */
.hero-controls {
  display: flex; gap: 1.6rem; align-items: center; flex-wrap: wrap;
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem 1.2rem;
}
.hero-controls label.inline { display: flex; align-items: center; gap: 0.5rem; font-size: 0.95rem; }
.hero-controls input[type="number"] {
  width: 72px; padding: 0.45rem 0.55rem; border: 1px solid var(--line); border-radius: 8px;
  background: var(--bg-soft); color: var(--ink); font-family: var(--sans);
}
.admin-hero-slides { display: flex; flex-direction: column; gap: 0.7rem; }
.hero-row {
  display: flex; align-items: center; gap: 1rem;
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 0.7rem 1rem;
}
.hero-thumb { width: 96px; height: 60px; border-radius: 8px; overflow: hidden; background: var(--bg-soft); flex: none; }
.hero-thumb img, .hero-thumb video { width: 100%; height: 100%; object-fit: cover; }

/* ---------- order history ---------- */
.orders-wrap { overflow-x: auto; }
.orders-table { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
.orders-table th, .orders-table td { text-align: left; padding: 0.7rem 0.8rem; border-bottom: 1px solid var(--line); vertical-align: top; }
.orders-table th { color: var(--muted); font-weight: 500; font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.05em; }
.orders-table td:nth-child(3) { max-width: 360px; }
.orders-table td:last-child { white-space: nowrap; color: var(--accent-deep); font-weight: 500; }
.orders-table .o-sub { color: var(--muted); font-size: 0.78rem; }
.orders-pager { display: flex; align-items: center; gap: 1rem; justify-content: center; margin-top: 1.2rem; }
.ord-pageinfo { color: var(--muted); font-size: 0.85rem; }
.hero-meta { flex: 1; }
.hero-meta p { color: var(--muted); margin: 0.2rem 0 0; font-size: 0.88rem; }
.hero-actions { display: flex; gap: 0.35rem; flex-wrap: wrap; }
.hero-actions button {
  background: none; border: 1px solid var(--line); border-radius: 8px;
  padding: 0.4rem 0.7rem; cursor: pointer; color: var(--ink); font-family: var(--sans); font-size: 0.85rem;
}
.hero-actions button:hover:not([disabled]) { border-color: var(--accent); color: var(--accent-deep); }
.hero-actions button[disabled] { opacity: 0.35; cursor: default; }
.hero-actions .del:hover { border-color: #b5524f; color: #e58a87; }

@media (max-width: 560px) {
  .cat-row { flex-direction: column; align-items: flex-start; }
  .hero-row { flex-wrap: wrap; }
  .form-grid { grid-template-columns: 1fr; }
  .image-row { flex-direction: column; }
}
