/* Admin console — overrides on top of the shared JMWS theme.
   Swings the primary palette to red and adds admin-specific table
   patterns. Everything else inherits from /css/shared.css so the
   look matches the other systems. */

@import url('/css/shared.css?v=1');

/* ─── Red primary override ───────────────────────────────────────── */
:root {
  --primary: #DC2626;
  --primary-dark: #991B1B;
  --primary-light: #FEE2E2;
}
[data-theme="dark"] {
  --primary-light: #7f1d1d;
}

/* ─── Stat cards ─── */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  margin-bottom: 16px;
}
@media (min-width: 720px) {
  .stat-grid { grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); }
}
.stat-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
  box-shadow: var(--shadow);
}
.stat-card .stat-label { font-size: 10.5px; color: var(--text2); text-transform: uppercase; letter-spacing: 0.5px; font-weight: 700; margin-bottom: 4px; }
.stat-card .stat-value { font-size: 26px; font-weight: 800; color: var(--text); line-height: 1; }
.stat-card .stat-sub { font-size: 11px; color: var(--text3); margin-top: 4px; }

/* ─── Cards / sections ─── */
.adm-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 16px;
  overflow: hidden;
  box-shadow: var(--shadow);
}
.adm-card-head {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
}
.adm-card-head h2 { margin: 0; font-size: 14px; font-weight: 700; display: flex; align-items: center; gap: 8px; }
.adm-card-head h2 i { color: var(--primary); font-size: 18px; }

/* ─── Tables ─── */
table.adm-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.adm-table th {
  text-align: left; padding: 10px 14px;
  background: var(--card2); color: var(--text2);
  font-weight: 700; font-size: 11px;
  text-transform: uppercase; letter-spacing: 0.4px;
  border-bottom: 1px solid var(--border);
}
.adm-table td { padding: 12px 14px; border-bottom: 1px solid var(--border); color: var(--text); vertical-align: middle; }
.adm-table tbody tr:hover { background: var(--card2); }
.adm-table tbody tr:last-child td { border-bottom: none; }
.adm-table .actions { display: flex; gap: 6px; flex-wrap: wrap; }

.user-cell { display: flex; align-items: center; gap: 10px; min-width: 0; }
.user-avatar-sm { width: 34px; height: 34px; border-radius: 50%; background: var(--primary); color: white; display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 14px; flex-shrink: 0; }
.user-name { font-weight: 600; }

.adm-muted { color: var(--text3); font-size: 12px; }
.adm-badge { display: inline-block; padding: 2px 8px; background: var(--card2); color: var(--text2); border-radius: 999px; font-size: 11px; font-weight: 600; }

/* ─── Pager + bar chart ─── */
.adm-pager { padding: 12px 16px; display: flex; align-items: center; justify-content: space-between; font-size: 12px; color: var(--text2); gap: 8px; flex-wrap: wrap; }
.adm-bar-chart { display: flex; align-items: end; gap: 2px; height: 80px; padding: 14px 16px; }
.adm-bar-chart .bar { flex: 1; background: var(--primary); border-radius: 2px 2px 0 0; min-height: 2px; opacity: 0.85; transition: opacity 0.15s; }
.adm-bar-chart .bar:hover { opacity: 1; }

/* ─── Form rows (used by modals + login) ─── */
.adm-form-group { margin-bottom: 14px; }
.adm-form-group label { display: block; font-size: 11px; font-weight: 700; color: var(--text2); margin-bottom: 6px; text-transform: uppercase; letter-spacing: 0.5px; }
.adm-form-group input {
  width: 100%; box-sizing: border-box;
  background: var(--card2); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 12px 14px;
  font: inherit; color: var(--text); font-size: 16px;
}
.adm-form-group input:focus { outline: none; border-color: var(--primary); }
.adm-form-error { background: #fee2e2; color: #991b1b; padding: 10px 12px; border-radius: var(--radius-sm); font-size: 13px; margin-bottom: 12px; }
[data-theme="dark"] .adm-form-error { background: rgba(220,38,38,0.18); color: #fecaca; }

/* ─── Login screen ─── */
#login-screen { min-height: 100vh; min-height: 100dvh; display: flex; align-items: center; justify-content: center; padding: 20px; }
.login-card {
  background: var(--card); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 28px 22px; width: 100%; max-width: 380px; box-shadow: var(--shadow);
}
.login-card .logo { display: flex; flex-direction: column; align-items: center; gap: 8px; margin-bottom: 22px; }
.login-card .logo img { width: 72px; height: 72px; border-radius: 18px; box-shadow: 0 8px 24px rgba(220,38,38,0.18); }
.login-card .logo h1 { margin: 6px 0 0; font-size: 22px; font-weight: 800; }
.login-card .logo p { margin: 0; color: var(--text2); font-size: 13px; text-align: center; }

/* ─── Nav (mobile bottom + desktop top) — 1:1 with ShopSmart ──────── */
.app-header {
  height: var(--header-height, 56px);
  background: var(--card);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  flex-shrink: 0;
  position: sticky; top: 0; z-index: 10;
}
.header-left { display: flex; align-items: center; gap: 10px; min-width: 0; }
.header-right { display: flex; align-items: center; gap: 8px; }

.bottom-nav {
  height: calc(var(--nav-height, 86px) + env(safe-area-inset-bottom, 0px));
  background: var(--card);
  border-top: 1px solid var(--border);
  display: flex;
  align-items: flex-start;
  flex-shrink: 0;
  position: sticky; bottom: 0;
  padding-bottom: env(safe-area-inset-bottom, 0px);
  z-index: 5;
}
.nav-btn {
  flex: 1;
  height: var(--nav-height, 86px);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  background: none;
  border: none;
  color: var(--text2);
  font: inherit;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
}
.nav-btn i.nav-icon { font-size: 22px; line-height: 1; flex-shrink: 0; }
.nav-btn span { font-size: 11px; font-weight: 600; }
.nav-btn.active { color: var(--primary); }

.app-header-nav { display: none; }

@media (min-width: 900px) {
  .app-header { height: 64px; padding: 0 28px; justify-content: flex-start; gap: 0; }
  /* Top-nav becomes content-width text links, left-aligned — 1:1 with ShopSmart */
  .app-header-nav {
    display: flex;
    flex: 0 0 auto;
    justify-content: flex-start;
    align-items: stretch;
    gap: 0;
    margin: 0 0 0 24px;
    height: 100%;
    background: transparent;
    border: none;
    box-shadow: none;
  }
  .header-right { margin-left: auto; }
  .app-header-nav .nav-btn {
    background: transparent;
    border: none;
    cursor: pointer;
    color: var(--primary);
    font-weight: 500;
    font-size: 15px;
    padding: 0 16px;
    border-radius: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0;
    flex-direction: row;
    height: 100%;
    min-height: 0;
    width: auto;
    min-width: 0;
    flex: 0 0 auto;
  }
  .app-header-nav .nav-btn i,
  .app-header-nav .nav-btn .nav-icon { display: none; }
  .app-header-nav .nav-btn span {
    opacity: 1 !important;
    line-height: 1;
    font-size: 15px;
    font-weight: 500;
    text-transform: none;
    letter-spacing: 0;
    color: var(--primary);
  }
  .app-header-nav .nav-btn:hover span { color: var(--primary-dark); }
  /* Active item: underline only the text characters */
  .app-header-nav .nav-btn.active span {
    font-weight: 700;
    text-decoration: underline;
    text-decoration-thickness: 2px;
    text-underline-offset: 10px;
  }
  .bottom-nav { display: none; }
}

/* ─── Mobile-only: table → card list ─── */
@media (max-width: 720px) {
  .adm-table thead { display: none; }
  .adm-table, .adm-table tbody, .adm-table tr { display: block; }
  .adm-table tr {
    background: var(--card2); border: 1px solid var(--border); border-radius: var(--radius-sm);
    margin: 10px; padding: 12px;
  }
  .adm-table tbody tr:hover { background: var(--card2); }
  .adm-table td {
    display: flex; justify-content: space-between; align-items: center; gap: 12px;
    padding: 8px 0; border-bottom: 1px dashed var(--border);
    text-align: right; font-size: 13px;
  }
  .adm-table td:last-child { border-bottom: none; padding-top: 10px; }
  .adm-table td[data-label]::before {
    content: attr(data-label); color: var(--text2);
    font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.4px;
    text-align: left; flex-shrink: 0;
  }
  .adm-table td:has(.user-cell) { justify-content: flex-start; }
  .adm-table td:has(.user-cell)::before { display: none; }
  .adm-table td.actions { justify-content: flex-end; flex-wrap: wrap; }
  .adm-table td.actions::before { display: none; }
}

/* === JMWS unified page / modal animations — ALL systems 1:1 ========= */
@keyframes jmws-page-in {
  from { opacity: 0; transform: scale(0.985); }
  to { opacity: 1; transform: scale(1); }
}
@keyframes jmws-modal-in {
  from { opacity: 0; transform: scale(0.97); }
  to { opacity: 1; transform: scale(1); }
}
.is-mounting > * { animation: jmws-page-in 0.45s cubic-bezier(0.16, 1, 0.3, 1) both; transform-origin: center center; }
@media (prefers-reduced-motion: reduce) {
  .is-mounting > *, .is-mounting > * > * { animation: none; }
}
