/* ==========================================================================
   Dropzyy Admin Panel Styles
   ========================================================================== */

/* ---------------------------------- ADMIN HEADER -------------------------- */
.admin-header {
  position: sticky;
  top: 0;
  z-index: 60;
  background: color-mix(in srgb, var(--surface) 92%, transparent);
  backdrop-filter: saturate(180%) blur(14px);
  border-bottom: 1px solid var(--line);
  padding: 14px 0;
}

.admin-header__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.admin-header__actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

/* Admin main content area */
.admin-main {
  flex: 1 0 auto;
  padding: 28px 0;
}

/* ---------------------------------- AUTHENTICATION ------------------------ */
.auth-wrap {
  max-width: 460px;
  margin: 60px auto;
}

.auth-wrap .card {
  padding: 28px;
}

/* ---------------------------------- ADMIN STATS --------------------------- */
.grid--stats {
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
}

.stat {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r);
  padding: 18px;
  display: grid;
  gap: 4px;
  box-shadow: var(--sh-1);
}

.stat__label {
  font-size: 0.78rem;
  color: var(--muted);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.stat__value {
  font-size: 1.6rem;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.stat__hint {
  font-size: 0.78rem;
  color: var(--muted);
}

.stat--brand {
  background: linear-gradient(135deg, var(--brand-700), var(--brand));
  border-color: transparent;
  color: #fff;
}

.stat--brand .stat__label,
.stat--brand .stat__hint {
  color: rgba(255, 255, 255, 0.85);
}

/* ---------------------------------- FORMS -------------------------------- */
.form-grid {
  display: grid;
  gap: 14px;
  grid-template-columns: 1fr 1fr;
}
.form-grid > * { min-width: 0; }

.form-grid .col-2 {
  grid-column: 1 / -1;
}

@media (max-width: 620px) {
  .form-grid {
    grid-template-columns: 1fr;
  }
}

.field {
  display: grid;
  gap: 6px;
}

.field > label {
  font-size: 0.84rem;
  font-weight: 700;
  color: var(--ink-2);
}

.input,
.select,
.textarea {
  width: 100%;
  padding: 11px 13px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--surface-2);
  color: var(--ink);
  outline: none;
  transition: border-color 0.15s var(--ease), box-shadow 0.15s var(--ease);
}

.input:focus,
.select:focus,
.textarea:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand) 18%, transparent);
}

.textarea {
  min-height: 84px;
  resize: vertical;
}

.radio-card {
  display: flex;
  gap: 10px;
  align-items: center;
  cursor: pointer;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--r);
  background: var(--surface-2);
  font-size: 0.88rem;
  font-weight: 600;
}

.radio-card input {
  accent-color: var(--brand);
}

.radio-card:has(input:checked) {
  border-color: var(--brand);
  background: var(--brand-soft);
}

/* ---------------------------------- TABLES -------------------------------- */
.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: var(--r);
  background: var(--surface);
}

.table {
  width: 100%;
  border-collapse: collapse;
  min-width: 620px;
  font-size: 0.88rem;
}

.table th,
.table td {
  padding: 11px 13px;
  text-align: left;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}

.table th {
  background: var(--surface-2);
  font-size: 0.74rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
}

.table tbody tr:hover {
  background: var(--surface-2);
}

.table tr:last-child td {
  border-bottom: 0;
}

/* ---------------------------------- SPLIT LAYOUT -------------------------- */
.split {
  display: grid;
  gap: 18px;
  grid-template-columns: 1fr 1fr;
  align-items: start;
}
.split > * { min-width: 0; }

@media (max-width: 900px) {
  .split {
    grid-template-columns: 1fr;
  }
}

/* ---------------------------------- CARDS --------------------------------- */
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: var(--sh-1);
  padding: 18px;
}

.card__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin: -4px 0 14px;
}

.card__head h3 {
  margin: 0;
}

.stack {
  display: grid;
  gap: 12px;
}

/* ---------------------------------- BUTTONS ------------------------------- */
.btn {
  --btn-bg: var(--brand);
  --btn-fg: #fff;
  --btn-bd: var(--brand);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 11px 17px;
  border-radius: var(--r-pill);
  border: 1px solid var(--btn-bd);
  background: var(--btn-bg);
  color: var(--btn-fg);
  font-weight: 700;
  font-size: 0.93rem;
  cursor: pointer;
  white-space: nowrap;
  transition: transform 0.15s var(--ease), filter 0.15s var(--ease), box-shadow 0.15s var(--ease);
}

.btn:hover {
  transform: translateY(-1px);
  filter: brightness(1.05);
  box-shadow: var(--sh-2);
}

.btn:active {
  transform: translateY(0);
}

.btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
  filter: none;
}

.btn--ghost {
  --btn-bg: transparent;
  --btn-fg: var(--ink);
  --btn-bd: var(--line);
}

.btn--ghost:hover {
  --btn-bg: var(--surface-2);
}

.btn--soft {
  --btn-bg: var(--brand-soft);
  --btn-fg: var(--brand-700);
  --btn-bd: transparent;
}

html[data-theme="dark"] .btn--soft {
  --btn-fg: var(--brand);
}

.btn--dangerSoft {
  --btn-bg: var(--danger-soft);
  --btn-fg: var(--danger);
  --btn-bd: transparent;
}

.btn--sm {
  padding: 7px 13px;
  font-size: 0.84rem;
}

.btn--lg {
  padding: 14px 24px;
  font-size: 1rem;
}

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

.link-btn {
  background: none;
  border: 0;
  padding: 0;
  cursor: pointer;
  color: var(--brand);
  font-weight: 700;
  font-size: 0.85rem;
}

.link-btn:hover {
  text-decoration: underline;
}

/* ---------------------------------- STATUS BADGES ------------------------- */
.status--pending {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  border-radius: var(--r-pill);
  font-size: 0.74rem;
  font-weight: 800;
  letter-spacing: 0.02em;
  background: var(--accent-soft);
  color: var(--accent);
  border: 1px solid transparent;
}

.status--approved {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  border-radius: var(--r-pill);
  font-size: 0.74rem;
  font-weight: 800;
  letter-spacing: 0.02em;
  background: var(--success-soft);
  color: var(--success);
  border: 1px solid transparent;
}

/* ---------------------------------- BADGES -------------------------------- */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  border-radius: var(--r-pill);
  font-size: 0.74rem;
  font-weight: 800;
  letter-spacing: 0.02em;
  background: var(--surface-2);
  color: var(--ink-2);
  border: 1px solid var(--line);
}

.badge--brand {
  background: var(--brand-soft);
  color: var(--brand-700);
  border-color: transparent;
}

html[data-theme="dark"] .badge--brand {
  color: var(--brand);
}

/* ---------------------------------- UTILITIES ----------------------------- */
.muted {
  color: var(--muted);
}

.small {
  font-size: 0.82rem;
}

.mt-0 {
  margin-top: 0;
}

.mt-1 {
  margin-top: 8px;
}

.mt-2 {
  margin-top: 16px;
}

.mt-3 {
  margin-top: 26px;
}

.mb-0 {
  margin-bottom: 0;
}

.center {
  text-align: center;
}

/* ---------------------------------- RESPONSIVE ---------------------------- */
@media (max-width: 780px) {
  .admin-header { padding: 10px 0; }
  .admin-header__inner {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
  }

  .admin-header__actions {
    justify-content: flex-end;
    gap: 6px;
  }

  .admin-header .btn {
    padding: 6px 10px;
    font-size: .78rem;
  }

  .admin-header .badge { display: none; }

  .auth-wrap {
    margin: 22px auto;
  }

  .card {
    padding: 14px;
    border-radius: var(--r);
  }

  .admin-main { padding: 20px 0; }

  .grid--stats {
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
  }

  .card__head { flex-wrap: wrap; }
  .table-wrap { max-width: 100%; }
}

@media (max-width: 480px) {
  .admin-header__inner { flex-direction: column; align-items: flex-start; }
  .admin-header__actions { width: 100%; justify-content: flex-start; flex-wrap: wrap; }
  .admin-header .btn { flex: 1; text-align: center; white-space: nowrap; }
  .admin-header .btn--ghost { flex: 0 0 auto; }
  .admin-main { padding: 16px 0; }
  .card { padding: 12px; }
  .stat { padding: 12px; }
  .stat__value { font-size: 1.3rem; }
  .page-head { flex-direction: column; align-items: flex-start; gap: 8px; }
  .page-head .btn { width: 100%; }
  .grid--stats { grid-template-columns: 1fr; }
  .admin-header__actions .btn { flex: 1 1 100%; }
}

/* ---------------------------------- ADMIN SUB-HEADER ----------------------- */
/* Used when the admin panel is embedded inside index.html (below the appbar).
   Unlike .admin-header (which is sticky at top:0 for the standalone admin.html),
   this sub-header is a normal flow element so it never overlaps the appbar. */
.admin-subheader {
  padding: 14px 0;
  border-bottom: 1px solid var(--line);
}

.admin-subheader__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.admin-subheader__actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

@media (max-width: 780px) {
  .admin-subheader { padding: 10px 0; }
  .admin-subheader__inner { flex-direction: column; align-items: flex-start; }
  .admin-subheader__actions { width: 100%; justify-content: flex-start; flex-wrap: wrap; }
  .admin-subheader .btn { flex: 1; text-align: center; }
}

/* ---------------------------------- TOAST --------------------------------- */
.toast-root {
  position: fixed;
  z-index: 120;
  bottom: 18px;
  left: 50%;
  transform: translateX(-50%);
  display: grid;
  gap: 8px;
  width: min(400px, calc(100vw - 24px));
}

.toast {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--ink);
  color: #fff;
  padding: 12px 15px;
  border-radius: var(--r);
  box-shadow: var(--sh-3);
  font-size: 0.89rem;
  font-weight: 600;
  animation: toastIn 0.22s var(--ease);
}

.toast--success {
  background: var(--success);
}

.toast--error {
  background: var(--danger);
}

.toast--info {
  background: var(--info);
}

@keyframes toastIn {
  from {
    opacity: 0;
    transform: translateY(16px);
  }
}

@media (max-width: 780px) {
  .toast-root {
    bottom: 78px;
  }
}

/* ---------------------------------- FORM NOTE ----------------------------- */
.form-note {
  background: var(--info-soft);
  color: var(--info);
  padding: 10px 12px;
  border-radius: 10px;
  font-size: 0.85rem;
  font-weight: 600;
}

/* ---------------------------------- PAGE HEAD ----------------------------- */
.page-head {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: flex-end;
  justify-content: space-between;
  margin-bottom: 18px;
}

.page-head p {
  margin: 0;
  color: var(--muted);
}

/* ---------------------------------- BRAND --------------------------------- */
.brand {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  font-weight: 800;
  letter-spacing: -0.03em;
  color: var(--ink);
}

.brand__logo {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  font-size: 18px;
  background: linear-gradient(135deg, var(--brand), var(--brand-700));
  border-radius: 11px;
  box-shadow: var(--sh-1);
}

.brand__text {
  font-size: 1.06rem;
}

.brand__text span {
  color: var(--brand);
}

/* ---------------------------------- CONTAINER ----------------------------- */
.container {
  width: 100%;
  max-width: var(--maxw);
  margin-inline: auto;
  padding-inline: var(--container-pad, 20px);
}

/* ---------------------------------- SECTION ------------------------------- */
/* padding-block only — must NOT reset the horizontal padding .container applies */
.section {
  padding-block: 26px;
}

/* ---------------------------------- ADMIN FILTERS ------------------------ */
.admin-filters {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  padding: 12px 0;
}

.filter-tabs {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.filter-tab {
  border: 1px solid var(--line);
  background: var(--surface-2);
  border-radius: var(--r-pill);
  padding: 6px 14px;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--ink-2);
  cursor: pointer;
  transition: all 0.15s var(--ease);
}

.filter-tab:hover {
  background: var(--surface);
  border-color: var(--brand);
}

.filter-tab.is-active {
  background: var(--brand);
  color: #fff;
  border-color: var(--brand);
}

.filter-date {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.filter-date__label {
  font-size: 0.74rem;
  font-weight: 700;
  color: var(--muted);
}

.input--sm {
  padding: 6px 10px;
  font-size: 0.82rem;
  max-width: 150px;
}

.select--sm {
  padding: 6px 10px;
  font-size: 0.82rem;
  max-width: 200px;
  border-radius: var(--r-sm);
}

/* ---------------------------------- ORDER STATUS BADGES -------------------- */
.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  border-radius: var(--r-pill);
  font-size: 0.74rem;
  font-weight: 800;
  letter-spacing: 0.02em;
  border: 1px solid transparent;
  white-space: nowrap;
}

.status--completed {
  background: var(--success-soft);
  color: var(--success);
}

.status--cancelled {
  background: var(--danger-soft);
  color: var(--danger);
}

.status--active {
  background: var(--accent-soft);
  color: var(--accent);
}

/* ---------------------------------- ORDERS ERROR --------------------------- */
.orders-error {
  background: var(--danger-soft);
  color: var(--danger);
  padding: 10px 12px;
  border-radius: 10px;
  font-size: 0.85rem;
  font-weight: 600;
  margin: 12px 0;
}

/* ---------------------------------- REDUCED MOTION ------------------------ */
@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}