/* ============================================
   VULCAN ADMIN PORTAL — STYLESHEET
   Colours: Red #DA0211 | Black #333333 | White #ffffff
   Font: Lato, Sans-serif
   Desktop-first staff portal (sidebar + tables)
   ============================================ */

@import url('https://fonts.googleapis.com/css2?family=Lato:wght@300;400;700;900&display=swap');

:root {
  /* Brand colours — matches the trader portal's css/style.css (kept separate so the admin portal can be deployed standalone) */
  --red:        #DA0211;
  --red-dark:   #b30000;
  --red-light:  #ff1a2a;
  --black:      #333333;
  --black-deep: #1a1a1a;
  --white:      #ffffff;

  --bg:         #1a1a1a;
  --bg-card:    #2a2a2a;
  --bg-input:   #222222;
  --border:     #3a3a3a;
  --border-light: #444444;
  --text:       #ffffff;
  --text-muted: #aaaaaa;
  --text-dim:   #777777;
  --success:    #2ecc71;
  --warning:    #f39c12;
  --danger:     #DA0211;

  --space-xs:   4px;
  --space-sm:   8px;
  --space-md:   16px;
  --space-lg:   24px;
  --space-xl:   32px;
  --space-2xl:  48px;

  --font:       'Lato', sans-serif;
  --text-xs:    11px;
  --text-sm:    13px;
  --text-base:  15px;
  --text-md:    17px;
  --text-lg:    20px;
  --text-xl:    24px;
  --text-2xl:   30px;

  --radius:     8px;
  --radius-lg:  14px;
  --radius-full: 999px;
  --sidebar-width: 240px;
  --shadow:     0 2px 12px rgba(0,0,0,0.4);
  --shadow-lg:  0 4px 24px rgba(0,0,0,0.6);
}

/* --- Reset --- */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: var(--font);
  font-size: var(--text-base);
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  min-height: 100vh;
}

img { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }
button, select, input { font-family: var(--font); }
button { cursor: pointer; border: none; background: none; }

/* --- Admin Shell --- */
.admin-shell {
  display: flex;
  min-height: 100vh;
}

/* --- Sidebar --- */
.admin-sidebar {
  width: var(--sidebar-width);
  flex-shrink: 0;
  background: var(--black-deep);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
}

.admin-sidebar__logo {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding: var(--space-lg);
}

.admin-sidebar__logo img {
  height: 28px;
  width: auto;
}

.admin-sidebar__logo-text {
  font-size: var(--text-xs);
  font-weight: 700;
  color: var(--text-muted);
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.admin-nav {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: var(--space-sm) 0;
}

.admin-nav__link {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding: 12px var(--space-lg);
  color: var(--text-muted);
  font-weight: 700;
  font-size: var(--text-sm);
  border-left: 3px solid transparent;
  transition: all 0.15s;
}

.admin-nav__link i {
  font-size: 18px;
  width: 20px;
  text-align: center;
}

.admin-nav__link:hover {
  color: var(--white);
  background: rgba(255,255,255,0.03);
}

.admin-nav__link.active {
  color: var(--white);
  background: rgba(218, 2, 17, 0.1);
  border-left-color: var(--red);
}

.admin-sidebar__footer {
  padding: var(--space-md) var(--space-lg);
  border-top: 1px solid var(--border);
}

.admin-signout {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  color: var(--text-muted);
  font-size: var(--text-sm);
  font-weight: 700;
  width: 100%;
  padding: 8px 0;
  transition: color 0.15s;
}

.admin-signout:hover {
  color: var(--red);
}

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

.admin-topbar {
  height: 64px;
  flex-shrink: 0;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 var(--space-lg);
}

.admin-topbar__title-group {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}

.admin-topbar__logo-mobile {
  display: none;
  height: 26px;
  width: auto;
}

.admin-topbar__title {
  font-size: var(--text-lg);
  font-weight: 900;
}

.admin-topbar__user {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  font-size: var(--text-sm);
  color: var(--text-muted);
}

.admin-topbar__avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: rgba(218, 2, 17, 0.15);
  color: var(--red);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 900;
  font-size: var(--text-xs);
}

.admin-content {
  flex: 1;
  overflow-y: auto;
  padding: var(--space-lg);
}

/* --- Stat tiles --- */
.admin-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: var(--space-md);
  margin-bottom: var(--space-lg);
  max-width: 720px;
}

.admin-stat {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--space-md);
}

.admin-stat__label {
  font-size: var(--text-xs);
  font-weight: 700;
  color: var(--text-muted);
  letter-spacing: 0.05em;
  text-transform: uppercase;
  margin-bottom: var(--space-xs);
}

.admin-stat__value {
  font-size: var(--text-2xl);
  font-weight: 900;
  line-height: 1;
}

.admin-stat__value--red { color: var(--red); }

/* --- Filters --- */
.admin-filters {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  margin-bottom: var(--space-md);
  flex-wrap: wrap;
}

.admin-search {
  position: relative;
  flex: 1;
  min-width: 200px;
  max-width: 320px;
}

.admin-search input {
  width: 100%;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--white);
  padding: 10px var(--space-md) 10px 40px;
  font-size: var(--text-sm);
}

.admin-search input:focus {
  outline: none;
  border-color: var(--red);
}

.admin-search i {
  position: absolute;
  left: 13px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-dim);
  font-size: 16px;
}

.chip {
  padding: 8px 16px;
  border-radius: var(--radius-full);
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--text-muted);
  font-size: var(--text-sm);
  font-weight: 700;
  white-space: nowrap;
  transition: all 0.15s;
}

.chip:hover {
  color: var(--white);
}

.chip.active {
  background: var(--red);
  border-color: var(--red);
  color: var(--white);
}

.result-count {
  font-size: var(--text-sm);
  color: var(--text-muted);
  margin-bottom: var(--space-md);
}

/* --- Table --- */
.admin-table-wrap {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.admin-table {
  width: 100%;
  border-collapse: collapse;
}

.admin-table th {
  text-align: left;
  font-size: var(--text-xs);
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--text-muted);
  padding: 12px var(--space-md);
  background: var(--bg-input);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

.admin-table td {
  padding: 14px var(--space-md);
  border-bottom: 1px solid var(--border);
  font-size: var(--text-sm);
  vertical-align: middle;
}

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

.admin-table tbody tr:hover td {
  background: rgba(255,255,255,0.02);
}

.admin-table__order-num {
  color: var(--red);
  font-weight: 900;
}

.admin-table__trader,
.admin-table__name {
  font-weight: 700;
  color: var(--white);
}

.admin-table__total {
  font-weight: 900;
  color: var(--white);
}

/* --- Status select (styled like a badge) --- */
.status-select {
  appearance: none;
  -webkit-appearance: none;
  border-radius: var(--radius-full);
  padding: 5px 28px 5px 12px;
  font-size: var(--text-xs);
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  border: 1px solid transparent;
  cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath fill='%23ffffff' d='M0 0l5 6 5-6z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
}

.status-select--processing { background-color: rgba(243, 156, 18, 0.15); color: var(--warning); }
.status-select--dispatched  { background-color: rgba(46, 204, 113, 0.15); color: var(--success); }
.status-select--cancelled   { background-color: var(--border); color: var(--text-muted); }
.status-select--active      { background-color: rgba(46, 204, 113, 0.15); color: var(--success); }
.status-select--hidden      { background-color: var(--border); color: var(--text-muted); }

.status-select--processing option,
.status-select--dispatched option,
.status-select--cancelled option,
.status-select--active option,
.status-select--hidden option {
  background: var(--bg-card);
  color: var(--white);
}

/* --- Buttons --- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-sm);
  padding: 10px var(--space-md);
  border-radius: var(--radius);
  font-size: var(--text-sm);
  font-weight: 700;
  transition: all 0.15s;
}

.btn--primary {
  background: var(--red);
  color: var(--white);
}

.btn--primary:hover { background: var(--red-dark); }

.btn--secondary {
  background: var(--bg-input);
  color: var(--white);
  border: 1px solid var(--border-light);
}

.btn--secondary:hover { border-color: var(--red); }

.btn--sm { padding: 6px 12px; font-size: var(--text-xs); }

.btn:disabled { opacity: 0.4; pointer-events: none; }

/* --- Field (login form) --- */
.field { margin-bottom: var(--space-md); }

.field__label {
  display: block;
  font-size: var(--text-sm);
  font-weight: 700;
  color: var(--text-muted);
  letter-spacing: 0.03em;
  text-transform: uppercase;
  margin-bottom: var(--space-xs);
}

.field__input {
  width: 100%;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--white);
  padding: 12px var(--space-md);
  font-size: var(--text-base);
}

.field__input:focus {
  outline: none;
  border-color: var(--red);
}

.field__error {
  font-size: var(--text-xs);
  color: var(--red);
  margin-top: var(--space-xs);
}

/* --- Empty state --- */
.empty {
  text-align: center;
  padding: var(--space-2xl) var(--space-lg);
}

.empty__icon { font-size: 40px; color: var(--text-dim); margin-bottom: var(--space-md); }
.empty__title { font-size: var(--text-lg); font-weight: 700; margin-bottom: var(--space-sm); }
.empty__sub { font-size: var(--text-sm); color: var(--text-muted); margin-bottom: var(--space-lg); }

/* --- Modal (order detail slide-over) --- */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.6);
  display: flex;
  justify-content: flex-end;
  z-index: 300;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s;
}

.modal-overlay.show {
  opacity: 1;
  pointer-events: auto;
}

.modal-panel {
  width: 420px;
  max-width: 100%;
  background: var(--bg);
  border-left: 1px solid var(--border);
  height: 100%;
  overflow-y: auto;
  padding: var(--space-lg);
  transform: translateX(20px);
  transition: transform 0.2s;
}

.modal-overlay.show .modal-panel {
  transform: translateX(0);
}

.modal-panel__header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: var(--space-lg);
}

.modal-panel__close {
  color: var(--text-muted);
  font-size: 22px;
}

.modal-panel__close:hover { color: var(--white); }

.detail-row {
  display: flex;
  justify-content: space-between;
  padding: var(--space-sm) 0;
  border-bottom: 1px solid var(--border);
  font-size: var(--text-sm);
}

.detail-row:last-child { border-bottom: none; }

.detail-row__label { color: var(--text-muted); }
.detail-row__value { color: var(--white); font-weight: 700; text-align: right; }

/* --- Toast --- */
.toast {
  position: fixed;
  top: var(--space-lg);
  right: var(--space-lg);
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  padding: var(--space-sm) var(--space-md);
  font-size: var(--text-sm);
  font-weight: 700;
  color: var(--white);
  z-index: 400;
  opacity: 0;
  transform: translateY(-8px);
  pointer-events: none;
  transition: all 0.3s;
}

.toast.show {
  opacity: 1;
  transform: translateY(0);
}

.toast--success { border-color: var(--success); color: var(--success); }

/* --- Utilities --- */
.text-muted { color: var(--text-muted); }
.text-sm { font-size: var(--text-sm); }
.font-bold { font-weight: 700; }
.hidden { display: none !important; }

/* --- Mobile bottom nav (hidden on desktop; shown below the breakpoint) --- */
.admin-bottom-nav {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: 64px;
  background: var(--black-deep);
  border-top: 1px solid var(--border);
  align-items: stretch;
  z-index: 100;
  padding-bottom: env(safe-area-inset-bottom);
}

.admin-bottom-nav__link {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  color: var(--text-dim);
  font-size: var(--text-xs);
  font-weight: 700;
  position: relative;
}

.admin-bottom-nav__link i { font-size: 20px; }

.admin-bottom-nav__link.active {
  color: var(--red);
}

.admin-bottom-nav__link.active::before {
  content: '';
  position: absolute;
  top: 0;
  left: 20%;
  right: 20%;
  height: 2px;
  background: var(--red);
}

/* ============================================
   RESPONSIVE — below this width the admin portal
   collapses to a single-column mobile layout
   ============================================ */
@media (max-width: 859px) {
  .admin-sidebar {
    display: none;
  }

  .admin-topbar__logo-mobile {
    display: block;
  }

  .admin-content {
    padding: var(--space-md);
    padding-bottom: calc(64px + var(--space-lg));
  }

  .admin-bottom-nav {
    display: flex;
  }

  .admin-filters {
    width: 100%;
  }

  .admin-search {
    max-width: none;
    width: 100%;
  }

  /* Table -> stacked cards. Each <td> carries a data-label
     attribute (see admin/orders.html) shown via ::before. */
  .admin-table-wrap {
    background: transparent;
    border: none;
  }

  .admin-table,
  .admin-table tbody,
  .admin-table tr,
  .admin-table td {
    display: block;
    width: 100%;
  }

  .admin-table thead {
    display: none;
  }

  .admin-table tr {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    margin-bottom: var(--space-sm);
    padding: var(--space-sm) var(--space-md);
  }

  .admin-table td {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-md);
    padding: 8px 0;
    border-bottom: 1px dashed var(--border);
    white-space: normal;
  }

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

  .admin-table td::before {
    content: attr(data-label);
    color: var(--text-muted);
    font-weight: 700;
    font-size: var(--text-xs);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    flex-shrink: 0;
  }

  .admin-table td[data-label=""] {
    justify-content: flex-end;
  }

  .admin-table td[data-label=""]::before {
    content: none;
  }

  .modal-panel {
    width: 100%;
  }
}
