/* ============================================================
   Aurelia Admin — Design Tokens
   Palette:  royal green #0B3D2E (structure), crisp ivory #F7F8F5 (canvas),
             gold #D4AF37 (signature accent),
             garnet #7A2E3B (alerts / delete states),
             emerald #1C5C43 (secondary / success accent)
   Type:     Cormorant Garamond (display), Work Sans (body),
             IBM Plex Mono (SKU / codes / data)
   Signature: a soft gold gradient hairline along the top edge of
              hero surfaces (stat cards, the sign-in card) — a
              glint of light catching a cut gem's table facet.
   ============================================================ */

:root {
  --ink: #0b3d2e;
  --ink-raised: #0f4a38;
  --canvas: #f7f8f5;
  --canvas-raised: #ffffff;
  --gold: #d4af37;
  --gold-light: #e8c766;
  --gold-dark: #b8952e;
  --garnet: #7a2e3b;
  --teal: #1c5c43;
  --border: #e1e6dc;
  --text-body: #232922;
  --text-muted: #7a8272;

  --font-display: "Cormorant Garamond", Georgia, serif;
  --font-body: "Work Sans", -apple-system, BlinkMacSystemFont, sans-serif;
  --font-mono: "IBM Plex Mono", monospace;

  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --radius-full: 999px;

  --gradient-primary: linear-gradient(135deg, var(--ink) 0%, #145c45 100%);
  --gradient-gold: linear-gradient(135deg, var(--gold-light) 0%, var(--gold) 55%, var(--gold-dark) 100%);
  --gradient-wash: radial-gradient(circle at 15% 0%, rgba(212, 175, 55, 0.08), transparent 45%), radial-gradient(circle at 100% 20%, rgba(11, 61, 46, 0.05), transparent 50%);

  --shadow-sm: 0 1px 2px rgba(11, 61, 46, 0.06), 0 1px 3px rgba(11, 61, 46, 0.05);
  --shadow-md: 0 8px 24px rgba(11, 61, 46, 0.09), 0 2px 6px rgba(11, 61, 46, 0.06);
  --shadow-lg: 0 20px 48px rgba(11, 61, 46, 0.16), 0 4px 12px rgba(11, 61, 46, 0.08);
  --shadow-gold: 0 8px 20px rgba(212, 175, 55, 0.28);
}

* {
  box-sizing: border-box;
}

body {
  background: var(--canvas);
  background-image: var(--gradient-wash);
  background-attachment: fixed;
  font-family: var(--font-body);
  color: var(--text-body);
  margin: 0;
}

h1,
h2,
h3,
h4,
h5,
.display-font {
  font-family: var(--font-display);
  color: var(--ink);
  font-weight: 600;
}

a {
  color: var(--gold-dark);
  transition: color 0.15s ease;
}
a:hover {
  color: var(--garnet);
  text-decoration: none;
}

::selection {
  background: rgba(212, 175, 55, 0.3);
}

/* ---------- App shell ---------- */
.app-shell {
  display: flex;
  min-height: 100vh;
}

.app-sidebar {
  width: 260px;
  flex-shrink: 0;
  background: var(--gradient-primary);
  color: #e7eee8;
  display: flex;
  flex-direction: column;
  padding: 1.5rem 0;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0 1.5rem 1.5rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  margin-bottom: 1.25rem;
}

.brand-mark {
  width: 46px;
  height: 46px;
  border-radius: var(--radius-full);
  background: var(--gradient-primary);
  box-shadow: var(--shadow-gold);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--ink);
  font-size: 0.95rem;
}

.brand-text {
  font-family: "Italiana", serif;
  font-size: 1.3rem;
  font-weight: 700;
  line-height: 1;
  letter-spacing: 0.05em;
  text-transform: uppercase;

  background: linear-gradient(135deg, #d4af37 0%, #b8860b 25%, #ffd700 50%, #daa520 75%, #c5a267 100%);

  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  color: transparent;
}

.brand-logo {
  width: 40px;
}

.nav-eyebrow {
  display: block;
  font-size: 0.68rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: rgba(231, 238, 232, 0.4);
  padding: 1rem 1.5rem 0.5rem;
}

.sidebar-nav {
  padding: 0 0.85rem;
}

.sidebar-nav .nav-link {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.65rem 0.9rem;
  margin: 0.15rem 0;
  color: #e7eee8;
  font-size: 0.92rem;
  border-radius: var(--radius-sm);
  transition:
    background 0.15s ease,
    transform 0.15s ease;
}

.sidebar-nav .nav-link i {
  width: 18px;
  text-align: center;
  color: rgba(231, 238, 232, 0.6);
  transition: color 0.15s ease;
}

.sidebar-nav .nav-link:hover {
  background: rgba(255, 255, 255, 0.06);
  color: #fff;
  transform: translateX(2px);
}

.sidebar-nav .nav-link.active {
  background: var(--gradient-gold);
  color: var(--ink);
  font-weight: 600;
  box-shadow: var(--shadow-gold);
}
.sidebar-nav .nav-link.active i {
  color: var(--ink);
}

.sidebar-footer {
  margin-top: auto;
  padding: 1rem 1.5rem 0;
  font-size: 0.75rem;
  color: rgba(231, 238, 232, 0.4);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.sidebar-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(6, 26, 20, 0.45);
  backdrop-filter: blur(1px);
  z-index: 999;
  opacity: 0;
  transition: opacity 0.2s ease;
}
.sidebar-backdrop.show {
  display: block;
  opacity: 1;
}

/* ---------- Main column ---------- */
.app-main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.app-topbar {
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: saturate(180%) blur(10px);
  border-bottom: 1px solid var(--border);
  padding: 1rem 1.75rem;
  display: flex;
  align-items: center;
  gap: 1rem;
  position: sticky;
  top: 0;
  z-index: 10;
}

.topbar-title {
  font-size: 1.35rem;
  margin: 0;
  flex: 1;
}

.sidebar-toggle {
  background: rgba(11, 61, 46, 0.06);
  border: none;
  width: 38px;
  height: 38px;
  border-radius: var(--radius-sm);
  font-size: 1.05rem;
  color: var(--ink);
  transition: background 0.15s ease;
}
.sidebar-toggle:hover {
  background: rgba(11, 61, 46, 0.12);
}

.topbar-user-toggle {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  color: var(--ink);
  font-size: 0.9rem;
  padding: 0.3rem 0.6rem 0.3rem 0.3rem;
  border-radius: var(--radius-full);
  transition: background 0.15s ease;
}
.topbar-user-toggle:hover {
  background: rgba(11, 61, 46, 0.06);
}

.user-avatar {
  width: 34px;
  height: 34px;
  border-radius: var(--radius-full);
  background: var(--gradient-primary);
  color: var(--gold-light);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-display);
  font-weight: 700;
  box-shadow: var(--shadow-sm);
}

.app-content {
  padding: 1.75rem;
  flex: 1;
}

.app-alert {
  border-radius: var(--radius-md);
  border: none;
  box-shadow: var(--shadow-sm);
}
.alert-success {
  background: rgba(28, 92, 67, 0.12);
  color: var(--teal);
}
.alert-danger {
  background: rgba(122, 46, 59, 0.1);
  color: var(--garnet);
}

/* ---------- Signature: gold hairline + rounded surfaces ---------- */
.facet-card {
  position: relative;
  background: var(--canvas-raised);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  padding: 1.5rem;
  overflow: hidden;
  transition:
    box-shadow 0.2s ease,
    transform 0.2s ease;
}
.facet-card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: var(--gradient-gold);
}
.facet-card:hover {
  box-shadow: var(--shadow-lg);
  transform: translateY(-2px);
}

.stat-card {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.stat-card .stat-icon {
  width: 52px;
  height: 52px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  background: var(--gradient-gold);
  color: var(--ink);
  box-shadow: var(--shadow-gold);
  flex-shrink: 0;
}

.stat-card .stat-value {
  font-family: var(--font-display);
  font-size: 2rem;
  font-weight: 700;
  color: var(--ink);
  line-height: 1;
}

.stat-card .stat-label {
  font-size: 0.78rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

/* ---------- Tables & panels ---------- */
.panel {
  background: var(--canvas-raised);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  overflow: hidden;
}

.panel-header {
  padding: 1.15rem 1.5rem;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: linear-gradient(180deg, rgba(212, 175, 55, 0.05), transparent);
}

.panel-header h2 {
  font-size: 1.15rem;
  margin: 0;
}

.table {
  margin-bottom: 0;
}

.table thead th {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  border-top: none;
  border-bottom: 1px solid var(--border);
  font-weight: 600;
  padding: 0.9rem 1rem;
}

.table td {
  vertical-align: middle;
  font-size: 0.9rem;
  padding: 0.85rem 1rem;
  border-color: var(--border);
}

.table tbody tr {
  transition: background 0.15s ease;
}
.table tbody tr:hover {
  background: rgba(11, 61, 46, 0.03);
}

.sku-code {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  background: rgba(11, 61, 46, 0.06);
  padding: 0.2rem 0.6rem;
  border-radius: var(--radius-sm);
  color: var(--ink);
}

.category-pill {
  display: inline-block;
  font-size: 0.72rem;
  padding: 0.25rem 0.75rem;
  border-radius: var(--radius-full);
  background: rgba(28, 92, 67, 0.1);
  color: var(--teal);
  font-weight: 500;
}

.thumb {
  width: 46px;
  height: 46px;
  object-fit: cover;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--canvas);
}

/* ---------- Forms ---------- */
.form-label-eyebrow {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  margin-bottom: 0.3rem;
  display: block;
}

.form-control {
  border-radius: var(--radius-sm);
  border-color: var(--border);
  padding: 0.6rem 0.85rem;
  transition:
    border-color 0.15s ease,
    box-shadow 0.15s ease;
}

.form-control:focus {
  border-color: var(--gold);
  box-shadow: 0 0 0 0.18rem rgba(212, 175, 55, 0.22);
}

.btn {
  border-radius: var(--radius-sm);
  font-weight: 500;
  transition:
    transform 0.12s ease,
    box-shadow 0.12s ease,
    background 0.15s ease;
}

.btn-gold {
  background: var(--gradient-gold);
  border: none;
  color: var(--ink);
  box-shadow: var(--shadow-gold);
}
.btn-gold:hover {
  color: var(--ink);
  box-shadow: 0 10px 24px rgba(212, 175, 55, 0.36);
  transform: translateY(-1px);
}

.btn-outline-secondary {
  border-radius: var(--radius-sm);
}

.btn-outline-garnet {
  color: var(--garnet);
  border-color: var(--garnet);
}
.btn-outline-garnet:hover {
  background: var(--garnet);
  color: #fff;
  transform: translateY(-1px);
}

.upload-drop {
  border: 1.5px dashed var(--border);
  border-radius: var(--radius-md);
  padding: 1.5rem;
  text-align: center;
  color: var(--text-muted);
  font-size: 0.85rem;
  cursor: pointer;
  background: rgba(11, 61, 46, 0.02);
  transition:
    border-color 0.15s ease,
    background 0.15s ease;
}
.upload-drop:hover {
  border-color: var(--gold);
  background: rgba(212, 175, 55, 0.05);
}

.upload-preview {
  max-height: 120px;
  border-radius: var(--radius-sm);
  margin-top: 0.75rem;
  border: 1px solid var(--border);
}

/* ---------- Auth page ---------- */
.auth-shell {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--gradient-primary);
  padding: 1.5rem;
  position: relative;
  overflow: hidden;
}
.auth-shell::before {
  content: "";
  position: absolute;
  width: 480px;
  height: 480px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(212, 175, 55, 0.18), transparent 70%);
  top: -120px;
  right: -120px;
}
.auth-shell::after {
  content: "";
  position: absolute;
  width: 380px;
  height: 380px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(212, 175, 55, 0.12), transparent 70%);
  bottom: -100px;
  left: -100px;
}

.auth-card {
  position: relative;
  width: 100%;
  max-width: 400px;
  background: var(--canvas-raised);
  padding: 2.5rem 2.25rem;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  z-index: 1;
}

.auth-brand {
  text-align: center;
  margin-bottom: 1.75rem;
}

.auth-brand .brand-mark {
  margin: 0 auto 0.75rem;
  width: 48px;
  height: 48px;
  font-size: 1.25rem;
}

/* ---------- Responsive ---------- */
@media (max-width: 991.98px) {
  .app-sidebar {
    position: fixed;
    left: -280px;
    z-index: 1000;
    transition: left 0.25s ease;
    box-shadow: var(--shadow-lg);
    border-radius: 0 var(--radius-lg) var(--radius-lg) 0;
  }
  .app-sidebar.open {
    left: 0;
  }
}

@media (max-width: 767.98px) {
  .app-content {
    padding: 1.1rem;
  }
  .app-topbar {
    padding: 0.85rem 1.1rem;
  }
  .topbar-title {
    font-size: 1.15rem;
  }
  .panel-header {
    flex-direction: column;
    align-items: stretch;
    gap: 0.75rem;
  }
  .panel-header form.form-inline {
    flex-wrap: wrap;
  }
  .panel-header form.form-inline .form-control {
    flex: 1 1 auto;
    margin-bottom: 0.5rem;
  }

  /* Card-style responsive table: header row hidden, each row becomes a card */
  .table-responsive-cards thead {
    display: none;
  }
  .table-responsive-cards,
  .table-responsive-cards tbody,
  .table-responsive-cards tr,
  .table-responsive-cards td {
    display: block;
    width: 100%;
  }
  .table-responsive-cards tr {
    background: var(--canvas-raised);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    margin-bottom: 0.85rem;
    padding: 0.5rem 0.25rem;
  }
  .table-responsive-cards td {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.55rem 0.85rem;
    border: none;
    text-align: right;
  }
  .table-responsive-cards td::before {
    content: attr(data-label);
    font-size: 0.68rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-muted);
    font-weight: 600;
    text-align: left;
  }
  .table-responsive-cards td[data-label=""]::before,
  .table-responsive-cards td:not([data-label])::before {
    content: none;
  }
  .table-responsive-cards td.cell-actions {
    justify-content: flex-end;
  }
  .table-responsive-cards td.cell-actions::before {
    content: none;
  }
}

/* ---------- Accessibility ---------- */
a:focus-visible,
button:focus-visible,
.form-control:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 2px;
}

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