/* Administrator paneli. Hamma qoidalar .adm ichida, do‘kon sahifalariga tegmaydi. */

.adm {
  --adm-bg: #eef2ef;
  --adm-surface: #ffffff;
  --adm-border: #d6dfda;
  --adm-border-strong: #b4c3bb;
  --adm-text: var(--ink);
  --adm-muted: #5a6e64;
  --adm-accent: var(--pine);
  --adm-ok: #1f6b47;
  --adm-ok-bg: #e2f1e8;
  --adm-bad: #8a5a12;
  --adm-bad-bg: #f6ecd6;
  --adm-danger: var(--cranberry);
  --adm-radius: 10px;
  --adm-radius-sm: 8px;
  --adm-ring: 0 0 0 3px rgba(28, 70, 56, 0.18);
  --adm-shadow: 0 1px 2px rgba(16, 40, 32, 0.06), 0 2px 8px -4px rgba(16, 40, 32, 0.08);

  background: var(--adm-bg);
  color: var(--adm-text);
  font-size: 1rem;
}

/* ---------- Karkas ---------- */

.adm-shell {
  flex: 1 0 auto;
  min-height: 100vh;
  display: grid;
  grid-template-columns: 244px minmax(0, 1fr);
}

.adm-side {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--spruce);
  color: var(--snow);
  padding: 1.4rem 0.9rem 1rem;
}

.adm-brand { display: flex; flex-direction: column; padding: 0 0.6rem 1.4rem; }

.adm-brand-name {
  font-family: var(--font-display), Georgia, serif;
  font-size: 1.2rem;
  line-height: 1.2;
}

.adm-brand-sub { font-size: 0.85rem; color: rgba(244, 247, 245, 0.6); margin-top: 0.15rem; }

.adm-nav { display: flex; flex-direction: column; gap: 0.15rem; }

.adm-nav a {
  position: relative;
  padding: 0.6rem 0.75rem;
  border-radius: var(--adm-radius-sm);
  color: rgba(244, 247, 245, 0.82);
  text-decoration: none;
  font-weight: 600;
}

.adm-nav a:hover { background: rgba(244, 247, 245, 0.07); color: var(--snow); }

.adm-nav a[aria-current="page"] { background: rgba(166, 132, 69, 0.24); color: var(--snow); }

.adm-nav a[aria-current="page"]::before {
  content: "";
  position: absolute;
  left: -0.9rem;
  top: 0.5rem;
  bottom: 0.5rem;
  width: 3px;
  border-radius: 0 3px 3px 0;
  background: var(--brass);
}

.adm-side-foot {
  margin-top: auto;
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  padding-top: 1rem;
  border-top: 1px solid rgba(244, 247, 245, 0.12);
}

.adm-side-foot a,
.adm-side-foot button {
  appearance: none;
  border: 0;
  background: none;
  text-align: left;
  cursor: pointer;
  padding: 0.55rem 0.75rem;
  border-radius: var(--adm-radius-sm);
  color: rgba(244, 247, 245, 0.7);
  text-decoration: none;
  font: inherit;
  font-size: 0.95rem;
}

.adm-side-foot a:hover,
.adm-side-foot button:hover { background: rgba(244, 247, 245, 0.07); color: var(--snow); }

.adm-main {
  min-width: 0;
  width: 100%;
  max-width: 1180px;
  padding: 2rem 2.2rem 6rem;
}

.adm-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.adm-head h1 {
  margin: 0;
  font-family: var(--font-display), Georgia, serif;
  font-weight: 500;
  font-size: clamp(1.7rem, 2.6vw, 2.2rem);
  line-height: 1.15;
}

.adm-head p { margin: 0.35rem 0 0; color: var(--adm-muted); max-width: 46rem; }

.adm-back {
  display: inline-block;
  margin-bottom: 0.6rem;
  color: var(--adm-muted);
  text-decoration: none;
  font-weight: 600;
  font-size: 0.95rem;
}

.adm-back:hover { color: var(--adm-accent); }

/* ---------- Umumiy bloklar ---------- */

.adm-panel {
  background: var(--adm-surface);
  border: 1px solid var(--adm-border);
  border-radius: var(--adm-radius);
  box-shadow: var(--adm-shadow);
  padding: 1.25rem 1.35rem;
}

.adm-panel h2 { margin: 0 0 1rem; font-size: 1.05rem; font-weight: 700; }

.adm-panel-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  margin-bottom: 0.35rem;
}

.adm-panel-head h2 { margin: 0; }

.adm-stack { display: flex; flex-direction: column; gap: 1rem; }
.adm-narrow { max-width: 44rem; }

.adm-empty {
  background: var(--adm-surface);
  border: 1px dashed var(--adm-border-strong);
  border-radius: var(--adm-radius);
  padding: 2.5rem 1.5rem;
  text-align: center;
}

.adm-empty h2 { margin: 0 0 0.35rem; font-size: 1.2rem; }
.adm-empty p { margin: 0 auto 1.2rem; color: var(--adm-muted); max-width: 30rem; }
.adm-empty p:last-child { margin-bottom: 0; }

.adm-alert {
  margin: 0 0 1rem;
  padding: 0.8rem 1rem;
  border-radius: var(--adm-radius-sm);
  background: #fbeeee;
  border: 1px solid #ecc9cc;
  color: #6d2434;
  font-weight: 600;
}

.adm-warn {
  margin: 0.9rem 0 0;
  padding: 0.65rem 0.8rem;
  border-radius: var(--adm-radius-sm);
  background: var(--adm-bad-bg);
  color: var(--adm-bad);
  font-size: 0.92rem;
}

/* ---------- Tugmalar ---------- */

.adm-btn {
  appearance: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  min-height: 2.6rem;
  padding: 0.5rem 1.05rem;
  border: 1px solid transparent;
  border-radius: var(--adm-radius-sm);
  font: inherit;
  font-weight: 700;
  font-size: 0.97rem;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, color 0.15s, transform 0.1s;
}

.adm-btn:active { transform: translateY(1px); }
.adm-btn:disabled { opacity: 0.6; cursor: wait; }

.adm-btn-primary { background: var(--pine); color: var(--snow); }
.adm-btn-primary:hover { background: var(--spruce); }

.adm-btn-ghost { background: var(--adm-surface); color: var(--adm-text); border-color: var(--adm-border-strong); }
.adm-btn-ghost:hover { border-color: var(--pine); color: var(--pine); }

.adm-btn-danger { background: var(--adm-surface); color: var(--adm-danger); border-color: #e2c3c7; }
.adm-btn-danger:hover { background: #fbeeee; border-color: var(--adm-danger); }

.adm-btn-block { width: 100%; }

.adm-link-btn {
  appearance: none;
  border: 0;
  background: none;
  padding: 0;
  font: inherit;
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--adm-muted);
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.adm-link-btn:hover { color: var(--adm-danger); }

/* ---------- Maydonlar ---------- */

.adm-field { display: flex; flex-direction: column; gap: 0.4rem; margin-bottom: 1.1rem; }
.adm-field:last-child { margin-bottom: 0; }

.adm-label { font-weight: 700; font-size: 0.92rem; }

.adm-hint { display: block; margin: 0; color: var(--adm-muted); font-size: 0.88rem; font-weight: 400; line-height: 1.45; }

.adm input[type="text"],
.adm input[type="password"],
.adm input[type="number"],
.adm textarea,
.adm select {
  width: 100%;
  min-height: 2.75rem;
  padding: 0.55rem 0.8rem;
  border: 1px solid var(--adm-border-strong);
  border-radius: var(--adm-radius-sm);
  background: #fbfcfb;
  color: var(--adm-text);
  font-size: 1rem;
  transition: border-color 0.15s, box-shadow 0.15s, background 0.15s;
}

.adm textarea { min-height: 8rem; line-height: 1.5; resize: vertical; }

.adm input::placeholder,
.adm textarea::placeholder { color: #7c8d85; }

.adm input:hover,
.adm textarea:hover,
.adm select:hover { border-color: #8fa298; }

.adm input:focus,
.adm textarea:focus,
.adm select:focus {
  outline: none;
  border-color: var(--pine);
  background: #fff;
  box-shadow: var(--adm-ring);
}

.adm input:disabled { opacity: 0.55; }

.adm select {
  appearance: none;
  padding-right: 2.4rem;
  background-image:
    linear-gradient(45deg, transparent 50%, var(--adm-muted) 50%),
    linear-gradient(135deg, var(--adm-muted) 50%, transparent 50%);
  background-position: calc(100% - 1.15rem) 50%, calc(100% - 0.8rem) 50%;
  background-size: 0.35rem 0.35rem;
  background-repeat: no-repeat;
}

.adm-affix { position: relative; display: block; }
.adm-affix input { padding-right: 3.6rem; }

.adm-affix > span {
  position: absolute;
  right: 0.85rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--adm-muted);
  font-weight: 600;
  pointer-events: none;
}

.adm-check { display: flex; gap: 0.55rem; align-items: center; margin-top: 0.9rem; font-size: 0.95rem; cursor: pointer; }
.adm-check input { width: 1.1rem; height: 1.1rem; accent-color: var(--pine); }

/* Almashtirgich (switch) */
.adm-switch { position: relative; display: flex; gap: 0.85rem; align-items: flex-start; cursor: pointer; }

.adm-switch input {
  position: absolute;
  opacity: 0;
  width: 2.8rem;
  height: 1.6rem;
  margin: 0;
  cursor: pointer;
}

.adm-switch-track {
  flex: none;
  position: relative;
  width: 2.8rem;
  height: 1.6rem;
  border-radius: 999px;
  background: #c3cfc9;
  transition: background 0.2s;
}

.adm-switch-track::after {
  content: "";
  position: absolute;
  top: 0.2rem;
  left: 0.2rem;
  width: 1.2rem;
  height: 1.2rem;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 3px rgba(16, 40, 32, 0.3);
  transition: transform 0.2s;
}

.adm-switch input:checked + .adm-switch-track { background: var(--pine); }
.adm-switch input:checked + .adm-switch-track::after { transform: translateX(1.2rem); }
.adm-switch input:focus-visible + .adm-switch-track { box-shadow: var(--adm-ring); }
.adm-switch strong { display: block; margin-bottom: 0.15rem; }

.adm-state { margin: 1rem 0 0; padding-top: 0.9rem; border-top: 1px solid var(--adm-border); font-weight: 600; color: var(--adm-accent); }

/* Holat belgilari */
.adm-checks { list-style: none; margin: 0.6rem 0 0; padding: 0; display: flex; flex-wrap: wrap; gap: 0.35rem; }
.adm-checks-col { flex-direction: column; margin-top: 1rem; }

.adm-checks li {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.2rem 0.55rem;
  border-radius: 6px;
  font-size: 0.85rem;
  font-weight: 600;
}

.adm-checks-col li { padding: 0.35rem 0.6rem; }
.adm-checks li.ok { background: var(--adm-ok-bg); color: var(--adm-ok); }
.adm-checks li.bad { background: var(--adm-bad-bg); color: var(--adm-bad); }
.adm-checks li.ok::before { content: "✓"; }
.adm-checks li.bad::before { content: "!"; font-weight: 800; }

.adm-count {
  padding: 0.15rem 0.55rem;
  border-radius: 6px;
  font-size: 0.85rem;
  font-weight: 700;
  background: var(--adm-bad-bg);
  color: var(--adm-bad);
}

.adm-count.ok { background: var(--adm-ok-bg); color: var(--adm-ok); }

/* ---------- Tovarlar ro‘yxati ---------- */

.adm-products {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 1.1rem;
}

.adm-product {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--adm-surface);
  border: 1px solid var(--adm-border);
  border-radius: var(--adm-radius);
  box-shadow: var(--adm-shadow);
  transition: border-color 0.15s, box-shadow 0.15s;
}

.adm-product:hover { border-color: var(--adm-border-strong); box-shadow: 0 10px 24px -14px rgba(16, 40, 32, 0.35); }

.adm-product-media {
  position: relative;
  display: block;
  aspect-ratio: 4 / 3;
  background: #dfe7e2;
  overflow: hidden;
  text-decoration: none;
}

.adm-product-media img { width: 100%; height: 100%; object-fit: cover; display: block; }

.adm-noimg {
  display: grid;
  place-items: center;
  height: 100%;
  color: var(--adm-muted);
  font-size: 0.9rem;
  font-weight: 600;
  background: repeating-linear-gradient(135deg, #e6ece8 0 10px, #dfe7e2 10px 20px);
}

.adm-product-num,
.adm-status {
  position: absolute;
  top: 0.6rem;
  padding: 0.15rem 0.5rem;
  border-radius: 6px;
  font-size: 0.8rem;
  font-weight: 700;
}

.adm-product-num { left: 0.6rem; background: rgba(16, 40, 32, 0.82); color: var(--snow); }
.adm-status { right: 0.6rem; background: #ece7dc; color: #5c5346; }
.adm-status.is-on { background: var(--adm-ok-bg); color: var(--adm-ok); }

.adm-product-body { display: flex; flex-direction: column; flex: 1; padding: 0.9rem 1rem 1rem; }

.adm-product-body h2 { margin: 0; font-size: 1.05rem; line-height: 1.3; }
.adm-product-body h2 a { color: inherit; text-decoration: none; }
.adm-product-body h2 a:hover { color: var(--adm-accent); text-decoration: underline; }

.adm-product-cat { margin: 0.15rem 0 0; color: var(--adm-muted); font-size: 0.9rem; }
.adm-product-price { margin: 0.5rem 0 0; font-weight: 700; font-size: 1.1rem; }

.adm-product .adm-checks { margin-bottom: 0.9rem; }
.adm-product .adm-btn { margin-top: auto; }

/* ---------- Tovar formasi ---------- */

.adm-form-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  gap: 1.2rem;
  align-items: start;
}

.adm-form-main,
.adm-form-side { display: flex; flex-direction: column; gap: 1.2rem; }

.adm-form-side { position: sticky; top: 1.2rem; }

.adm-images {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 0.8rem;
  margin: 1rem 0;
}

.adm-image { display: flex; flex-direction: column; gap: 0.45rem; }
.adm-image input[type="text"] { min-height: 2.3rem; padding: 0.35rem 0.6rem; font-size: 0.92rem; }
.adm-image .adm-link-btn { align-self: flex-start; }
.adm-image.is-gone .adm-image-frame { opacity: 0.35; }

.adm-image-frame {
  position: relative;
  aspect-ratio: 1;
  border-radius: var(--adm-radius-sm);
  overflow: hidden;
  background: #dfe7e2;
  border: 1px solid var(--adm-border);
}

.adm-image-frame img { width: 100%; height: 100%; object-fit: cover; display: block; }

.adm-image-main {
  position: absolute;
  left: 0.4rem;
  top: 0.4rem;
  padding: 0.05rem 0.4rem;
  border-radius: 5px;
  background: rgba(16, 40, 32, 0.82);
  color: var(--snow);
  font-size: 0.75rem;
  font-weight: 700;
}

.adm-image.is-new .adm-image-frame { border-color: var(--brass); }

.adm-drop {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.2rem;
  margin-top: 1rem;
  padding: 1.6rem 1rem;
  border: 2px dashed var(--adm-border-strong);
  border-radius: var(--adm-radius);
  background: #f7faf8;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}

.adm-drop-sm { padding: 1.1rem 1rem; }

.adm-drop:hover,
.adm-drop:focus-within { border-color: var(--pine); background: #eef5f1; }

.adm-drop input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  cursor: pointer;
}

.adm-drop strong { color: var(--adm-accent); }
.adm-drop span { color: var(--adm-muted); font-size: 0.88rem; }

.adm-video {
  display: block;
  width: 100%;
  max-height: 360px;
  margin-top: 1rem;
  border-radius: var(--adm-radius-sm);
  background: #0e241c;
}

.adm-file { display: flex; gap: 0.8rem; align-items: center; margin: 0.8rem 0 0; font-size: 0.92rem; font-weight: 600; }

.adm-savebar {
  position: sticky;
  bottom: 0;
  z-index: 5;
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin: 1.4rem -2.2rem -6rem;
  padding: 0.9rem 2.2rem;
  background: rgba(255, 255, 255, 0.94);
  border-top: 1px solid var(--adm-border);
  backdrop-filter: blur(6px);
}

.adm-savebar-gap { flex: 1; }

/* ---------- Buyurtmalar ---------- */

.adm-panel-info { margin-bottom: 1.4rem; }
.adm-panel-info h2 { margin-bottom: 0.2rem; }

.adm-urls { list-style: none; margin: 0.7rem 0 0; padding: 0; display: flex; flex-wrap: wrap; gap: 0.5rem; }

.adm-urls a {
  display: inline-block;
  padding: 0.35rem 0.7rem;
  border-radius: 6px;
  background: var(--adm-bg);
  border: 1px solid var(--adm-border);
  color: var(--adm-accent);
  font-family: ui-monospace, Consolas, monospace;
  font-size: 0.9rem;
  text-decoration: none;
}

.adm-urls a:hover { border-color: var(--pine); }

.adm-orders { display: flex; flex-direction: column; gap: 1rem; }

.adm-order-head { display: flex; justify-content: space-between; gap: 1rem; align-items: flex-start; margin-bottom: 0.9rem; }
.adm-order-head h2 { margin: 0; font-size: 1.15rem; }

.adm-order-meta { display: flex; flex-wrap: wrap; gap: 0.3rem 1rem; margin: 0.3rem 0 0; color: var(--adm-muted); font-size: 0.9rem; }
.adm-order-meta a { color: var(--adm-accent); font-weight: 600; }

.adm-order-total { font-size: 1.2rem; white-space: nowrap; }

.adm-table { width: 100%; border-collapse: collapse; font-size: 0.95rem; }

.adm-table th {
  text-align: left;
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--adm-muted);
  padding: 0.45rem 0.6rem;
  background: var(--adm-bg);
}

.adm-table th:first-child { border-radius: 6px 0 0 6px; }
.adm-table th:last-child { border-radius: 0 6px 6px 0; }
.adm-table td { padding: 0.55rem 0.6rem; border-bottom: 1px solid var(--adm-border); }
.adm-table tr:last-child td { border-bottom: 0; }
.adm-table th:not(:first-child),
.adm-table td:not(:first-child) { text-align: right; white-space: nowrap; }

.adm-order-note { margin: 0.8rem 0 0; padding: 0.6rem 0.8rem; border-radius: 6px; background: var(--adm-bg); font-size: 0.93rem; }

/* ---------- Kategoriyalar ---------- */

.adm-cat-list { display: flex; flex-direction: column; gap: 0.6rem; }

.adm-cat-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 7rem 13rem;
  gap: 0.6rem;
  align-items: center;
}

.adm-cat-labels { font-size: 0.82rem; font-weight: 700; color: var(--adm-muted); }

.adm-row-actions { display: flex; gap: 0.4rem; justify-content: flex-end; }

/* ---------- Kirish ---------- */

.adm-login {
  flex: 1 0 auto;
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 1.5rem;
}

.adm-login-card {
  width: min(420px, 100%);
  background: var(--adm-surface);
  border: 1px solid var(--adm-border);
  border-top: 4px solid var(--brass);
  border-radius: var(--adm-radius);
  box-shadow: 0 20px 40px -24px rgba(16, 40, 32, 0.35);
  padding: 2rem 1.8rem;
}

.adm-login-brand { margin: 0 0 0.3rem; font-family: var(--font-display), Georgia, serif; color: var(--brass-deep); }

.adm-login-card h1 { margin: 0 0 1.4rem; font-size: 1.45rem; line-height: 1.25; }
.adm-login-card .adm-field { margin-bottom: 1.2rem; }

/* ---------- Moslashuvchanlik ---------- */

@media (max-width: 1000px) {
  .adm-form-grid { grid-template-columns: 1fr; }
  .adm-form-side { position: static; }
}

@media (max-width: 760px) {
  .adm-shell { grid-template-columns: 1fr; }

  .adm-side { position: static; height: auto; padding: 0.9rem 1rem; }
  .adm-brand { padding: 0 0 0.7rem; }
  .adm-nav { flex-direction: row; flex-wrap: wrap; }
  .adm-nav a[aria-current="page"]::before { display: none; }
  .adm-side-foot { flex-direction: row; margin-top: 0.6rem; padding-top: 0.6rem; }

  .adm-main { padding: 1.3rem 1rem 6rem; }
  .adm-head { flex-direction: column; align-items: stretch; }
  .adm-savebar { margin: 1.2rem -1rem -6rem; padding: 0.8rem 1rem; }
  .adm-cat-row { grid-template-columns: minmax(0, 1fr) 5.5rem; }
  .adm-row-actions { grid-column: 1 / -1; justify-content: flex-start; }
  .adm-cat-labels span:last-child { display: none; }
  .adm-order-head { flex-direction: column; }
}

@media (prefers-reduced-motion: reduce) {
  .adm * { transition: none !important; }
}
