/* ============================================================
   KHAYAE — Admin Panel Styles
   Uses the same design tokens as the main store
   ============================================================ */

/* ---------- Layout Shell ---------- */
.admin-layout {
  display: flex;
  min-height: 100vh;
  background-color: var(--white);
  color: var(--ink);
  font-family: var(--sans);
}

/* ---------- Sidebar ---------- */
.admin-sidebar {
  width: 260px;
  min-width: 260px;
  background-color: var(--paper);
  border-right: 1px solid var(--line-soft);
  display: flex;
  flex-direction: column;
  padding-top: 32px;
}

.admin-sidebar__logo {
  padding: 0 28px;
  margin-bottom: 40px;
  font-family: var(--serif);
  font-style: italic;
  font-size: 22px;
  display: flex;
  align-items: center;
  gap: 10px;
  letter-spacing: 0.01em;
}

.admin-sidebar__logo .mark {
  width: 22px;
  height: 22px;
  color: var(--brown);
}

.admin-nav {
  display: flex;
  flex-direction: column;
  flex: 1;
  gap: 2px;
  padding: 0 12px;
}

.admin-nav__item {
  padding: 11px 16px;
  cursor: pointer;
  font-family: var(--sans);
  font-size: 13px;
  font-weight: 400;
  letter-spacing: 0.02em;
  color: var(--ink-soft);
  transition: all 0.2s var(--ease);
  display: flex;
  align-items: center;
  gap: 10px;
  border-radius: 0;
}

.admin-nav__item:hover {
  color: var(--ink);
  background-color: var(--paper-2);
}

.admin-nav__item.active {
  color: var(--ink);
  background-color: var(--paper-2);
  font-weight: 400;
  position: relative;
}

.admin-nav__item.active::before {
  content: "";
  position: absolute;
  left: 0;
  top: 6px;
  bottom: 6px;
  width: 2px;
  background: var(--brown);
}

.admin-sidebar__foot {
  padding: 24px 28px;
  border-top: 1px solid var(--line-soft);
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.admin-sidebar__foot button {
  font-family: var(--sans);
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--stone);
  cursor: pointer;
  text-align: left;
  transition: color 0.2s var(--ease);
}

.admin-sidebar__foot button:hover {
  color: var(--ink);
}

/* ---------- Main Content ---------- */
.admin-main {
  flex: 1;
  padding: 40px 48px;
  overflow-y: auto;
  max-height: 100vh;
}

/* ---------- Page Header ---------- */
.admin-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 40px;
  padding-bottom: 24px;
  border-bottom: 1px solid var(--line-soft);
}

.admin-header h1 {
  margin: 0;
  font-family: var(--serif);
  font-size: 36px;
  font-weight: 400;
  line-height: 1;
}

.admin-header__actions {
  display: flex;
  gap: 10px;
}

/* ---------- Section Title ---------- */
.admin-section-title {
  font-family: var(--serif);
  font-size: 22px;
  font-weight: 400;
  margin-bottom: 20px;
  color: var(--ink);
}

/* ---------- Dashboard KPI Cards ---------- */
.admin-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 20px;
  margin-bottom: 48px;
}

.admin-card {
  background-color: var(--paper);
  border: 1px solid var(--line-soft);
  padding: 24px 28px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  transition: border-color 0.2s var(--ease);
}

.admin-card:hover {
  border-color: var(--line);
}

.admin-card__title {
  font-family: var(--sans);
  font-size: 10px;
  font-weight: 400;
  color: var(--stone);
  text-transform: uppercase;
  letter-spacing: 0.18em;
}

.admin-card__value {
  font-size: 30px;
  font-family: var(--serif);
  font-weight: 400;
  line-height: 1.1;
  color: var(--ink);
}

.admin-card__sub {
  font-family: var(--sans);
  font-size: 11px;
  color: var(--stone-2);
  margin-top: 2px;
}

/* ---------- Table ---------- */
.admin-table-wrap {
  background-color: var(--paper);
  border: 1px solid var(--line-soft);
  overflow-x: auto;
}

.admin-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 13px;
  font-weight: 300;
  line-height: 1.5;
}

.admin-table th {
  font-family: var(--sans);
  font-weight: 400;
  color: var(--stone);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  padding: 14px 24px;
  border-bottom: 1px solid var(--line-soft);
  background: var(--white);
  white-space: nowrap;
}

.admin-table td {
  padding: 16px 24px;
  border-bottom: 1px solid var(--line-soft);
  vertical-align: middle;
  color: var(--ink-soft);
}

.admin-table tbody tr {
  transition: background 0.15s var(--ease);
  cursor: pointer;
}

.admin-table tbody tr:hover td {
  background-color: rgba(244, 237, 230, 0.5);
}

.admin-table tbody tr:last-child td {
  border-bottom: none;
}

.admin-table td strong,
.admin-table td .admin-table__primary {
  font-weight: 400;
  color: var(--ink);
}

/* ---------- Status Badges ---------- */
.admin-status {
  display: inline-block;
  padding: 4px 12px;
  font-family: var(--sans);
  font-size: 10px;
  font-weight: 400;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  background-color: var(--paper-2);
  color: var(--stone);
  white-space: nowrap;
}

.admin-status--green {
  background-color: var(--mint);
  color: #3d5a2c;
}

.admin-status--brown {
  background-color: var(--peach);
  color: var(--brown);
}

.admin-status--ink {
  background-color: var(--ink);
  color: var(--paper);
}

/* ---------- Product Thumbnail in Table ---------- */
.admin-thumb {
  width: 40px;
  height: 52px;
  overflow: hidden;
  position: relative;
  background: var(--paper-2);
  flex-shrink: 0;
}

.admin-thumb .ph {
  position: absolute;
  inset: 0;
}

/* ---------- Login Page ---------- */
.admin-login {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  background-color: var(--paper);
}

.admin-login__box {
  background-color: var(--white);
  padding: 48px 40px;
  border: 1px solid var(--line-soft);
  width: 100%;
  max-width: 380px;
  text-align: center;
}

.admin-login__box .mark {
  display: block;
  width: 44px;
  height: 44px;
  margin: 0 auto 24px;
  color: var(--brown);
}

.admin-login__box h1 {
  font-family: var(--serif);
  font-size: 30px;
  font-weight: 400;
  margin-bottom: 32px;
  line-height: 1;
}

.admin-login__box .field {
  text-align: left;
}

.admin-login__box .field input {
  width: 100%;
}

.admin-login__return {
  display: inline-block;
  margin-top: 28px;
  font-family: var(--sans);
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--stone);
  cursor: pointer;
  transition: color 0.2s var(--ease);
}

.admin-login__return:hover {
  color: var(--ink);
}

/* ---------- Empty / Placeholder State ---------- */
.admin-empty {
  padding: 60px 0;
  text-align: center;
}

.admin-empty__icon {
  font-size: 48px;
  color: var(--line);
  margin-bottom: 20px;
}

.admin-empty__title {
  font-family: var(--serif);
  font-size: 22px;
  font-weight: 400;
  margin-bottom: 8px;
}

.admin-empty__desc {
  font-size: 14px;
  color: var(--stone);
  max-width: 360px;
  margin: 0 auto 24px;
  line-height: 1.6;
}

/* ---------- Mobile Top Bar (hidden on desktop) ---------- */
.admin-topbar {
  display: none;
}

/* ---------- Sidebar Scrim (hidden on desktop) ---------- */
.admin-scrim {
  display: none;
}

/* ---------- Responsive ---------- */
@media (max-width: 1024px) {
  .admin-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  .admin-main {
    padding: 32px 28px;
  }
}

@media (max-width: 768px) {
  .admin-layout {
    flex-direction: column;
  }

  /* -- Mobile top bar -- */
  .admin-topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 20px;
    border-bottom: 1px solid var(--line-soft);
    background: var(--paper);
    position: sticky;
    top: 0;
    z-index: 100;
  }

  .admin-topbar__toggle {
    width: 36px;
    height: 36px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 5px;
    cursor: pointer;
    background: none;
    border: none;
    padding: 0;
  }

  .admin-topbar__toggle span {
    display: block;
    width: 20px;
    height: 1.5px;
    background: var(--ink);
    transition: transform 0.3s var(--ease), opacity 0.3s var(--ease);
  }

  .admin-topbar__toggle.open span:nth-child(1) {
    transform: translateY(6.5px) rotate(45deg);
  }
  .admin-topbar__toggle.open span:nth-child(2) {
    opacity: 0;
  }
  .admin-topbar__toggle.open span:nth-child(3) {
    transform: translateY(-6.5px) rotate(-45deg);
  }

  .admin-topbar__brand {
    font-family: var(--serif);
    font-style: italic;
    font-size: 18px;
    display: flex;
    align-items: center;
    gap: 8px;
  }

  .admin-topbar__brand .mark {
    width: 18px;
    height: 18px;
    color: var(--brown);
  }

  /* -- Layout becomes vertical -- */
  .admin-layout {
    flex-direction: column;
  }

  /* -- Sidebar slides in from left -- */
  .admin-sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: 280px;
    min-width: 280px;
    z-index: 200;
    transform: translateX(-100%);
    transition: transform 0.35s var(--ease);
    overflow-y: auto;
  }

  .admin-sidebar.open {
    transform: translateX(0);
  }

  /* -- Scrim behind sidebar -- */
  .admin-scrim {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(33, 30, 26, 0.4);
    z-index: 199;
    opacity: 0;
    transition: opacity 0.35s var(--ease);
  }

  .admin-scrim.open {
    display: block;
    opacity: 1;
  }

  /* -- Main content adjustments -- */
  .admin-main {
    padding: 24px 20px;
    max-height: none;
    min-height: calc(100vh - 60px);
  }

  .admin-grid {
    grid-template-columns: 1fr;
  }

  .admin-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 16px;
    margin-bottom: 28px;
  }

  .admin-header h1 {
    font-size: 28px;
  }

  .admin-header__actions {
    width: 100%;
  }

  .admin-header__actions .btn {
    flex: 1;
  }

  .admin-card__value {
    font-size: 24px;
  }

  .admin-table th {
    padding: 12px 16px;
  }

  .admin-table td {
    padding: 14px 16px;
    font-size: 12px;
  }
}
