/* ══════════════════════════════════════════════════════════════════
   Rimage Parts Portal — High-Tech Glassmorphism Theme
   ══════════════════════════════════════════════════════════════════ */

/* ── Custom properties ─────────────────────────────────────────── */
:root {
  --accent:        #00c8ff;
  --accent-dim:    rgba(0, 200, 255, 0.18);
  --accent-glow:   rgba(0, 200, 255, 0.35);
  --surface:       rgba(8, 22, 50, 0.65);
  --surface-hover: rgba(8, 22, 50, 0.82);
  --border:        rgba(0, 200, 255, 0.14);
  --border-bright: rgba(0, 200, 255, 0.35);
  --text:          #dde6f5;
  --text-muted:    #7a90b0;
  --bg-base:       #050d1e;
}

/* ── Body & background ─────────────────────────────────────────── */
html, body {
  min-height: 100%;
  background-color: var(--bg-base);
  color: var(--text);
}

body {
  background:
    radial-gradient(ellipse at 15% 40%, rgba(0, 80, 180, 0.22) 0%, transparent 55%),
    radial-gradient(ellipse at 85% 15%, rgba(0, 160, 220, 0.14) 0%, transparent 45%),
    radial-gradient(ellipse at 60% 85%, rgba(60, 0, 180, 0.12) 0%, transparent 45%),
    var(--bg-base);
  background-attachment: fixed;
}

/* Circuit-grid overlay */
body::after {
  content: '';
  position: fixed;
  inset: 0;
  background-image:
    linear-gradient(rgba(0, 200, 255, 0.028) 1px, transparent 1px),
    linear-gradient(90deg, rgba(0, 200, 255, 0.028) 1px, transparent 1px);
  background-size: 44px 44px;
  pointer-events: none;
  z-index: 0;
}

/* ── Navbar ────────────────────────────────────────────────────── */
.navbar {
  background: rgba(5, 13, 30, 0.78) !important;
  backdrop-filter: blur(22px);
  -webkit-backdrop-filter: blur(22px);
  border-bottom: 1px solid var(--border);
  box-shadow: 0 2px 32px rgba(0, 0, 0, 0.5);
  position: sticky;
  top: 0;
  z-index: 1040;
}

.navbar-brand {
  color: var(--accent) !important;
  letter-spacing: .04em;
  font-size: 1.15rem !important;
}

.navbar .nav-link {
  color: #9bb5d0 !important;
  font-size: .88rem;
  transition: color .2s;
}
.navbar .nav-link:hover { color: var(--accent) !important; }

.navbar .form-control {
  background: rgba(0, 200, 255, 0.06);
  border: 1px solid var(--border);
  color: var(--text);
}
.navbar .form-control:focus {
  background: rgba(0, 200, 255, 0.1);
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-dim);
  color: var(--text);
}
.navbar .form-control::placeholder { color: var(--text-muted); }

/* ── Dropdown ──────────────────────────────────────────────────── */
.dropdown-menu {
  background: rgba(6, 16, 38, 0.92) !important;
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--border-bright) !important;
  box-shadow: 0 8px 40px rgba(0, 0, 0, 0.5);
}
.dropdown-item { color: var(--text) !important; font-size: .9rem; }
.dropdown-item:hover {
  background: var(--accent-dim) !important;
  color: var(--accent) !important;
}
.dropdown-divider { border-color: var(--border) !important; }

/* ── Cards ─────────────────────────────────────────────────────── */
.card {
  background: var(--surface) !important;
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border: 1px solid var(--border) !important;
  box-shadow: 0 4px 28px rgba(0, 0, 0, 0.35);
  color: var(--text);
  border-radius: .6rem !important;
  transition: box-shadow .22s, border-color .22s, transform .22s;
  position: relative;
  z-index: 1;
}
.card:hover {
  border-color: rgba(0, 200, 255, 0.3) !important;
  box-shadow: 0 6px 36px rgba(0, 200, 255, 0.12), 0 2px 8px rgba(0,0,0,.5);
}
.card-header {
  background: rgba(0, 200, 255, 0.06) !important;
  border-bottom: 1px solid var(--border) !important;
  color: var(--text);
  font-size: .88rem;
  letter-spacing: .03em;
}
.card-footer {
  background: rgba(0, 0, 0, 0.25) !important;
  border-top: 1px solid var(--border) !important;
}

/* Part cards in catalog */
.part-card { transition: box-shadow .2s, border-color .2s, transform .2s !important; }
.part-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 8px 40px rgba(0, 200, 255, 0.18), 0 2px 8px rgba(0,0,0,.5) !important;
  border-color: rgba(0, 200, 255, 0.4) !important;
}

.part-thumb { height: 160px; object-fit: contain; padding: 8px; filter: drop-shadow(0 2px 6px rgba(0,200,255,.15)); }
.part-thumb-placeholder { height: 160px; background: rgba(0,200,255,0.04) !important; }

/* ── Buttons ───────────────────────────────────────────────────── */
.btn-primary {
  background: linear-gradient(135deg, #0096c7 0%, #0077a8 100%) !important;
  border: 1px solid rgba(0, 200, 255, 0.4) !important;
  box-shadow: 0 0 14px rgba(0, 200, 255, 0.25);
  color: #fff !important;
  transition: box-shadow .2s, transform .15s;
}
.btn-primary:hover, .btn-primary:focus {
  box-shadow: 0 0 22px rgba(0, 200, 255, 0.5) !important;
  transform: translateY(-1px);
  background: linear-gradient(135deg, #00b4d8 0%, #0096c7 100%) !important;
}

.btn-success {
  background: linear-gradient(135deg, #059669 0%, #047857 100%) !important;
  border-color: rgba(16, 185, 129, 0.4) !important;
  box-shadow: 0 0 12px rgba(16, 185, 129, 0.2);
}
.btn-success:hover {
  box-shadow: 0 0 20px rgba(16, 185, 129, 0.4) !important;
  transform: translateY(-1px);
}

.btn-danger {
  background: linear-gradient(135deg, #dc2626 0%, #b91c1c 100%) !important;
  border-color: rgba(239, 68, 68, 0.4) !important;
}

.btn-outline-primary {
  color: var(--accent) !important;
  border-color: rgba(0, 200, 255, 0.4) !important;
  background: transparent !important;
}
.btn-outline-primary:hover {
  background: var(--accent-dim) !important;
  box-shadow: 0 0 14px rgba(0,200,255,.25);
}

.btn-outline-secondary {
  color: var(--text-muted) !important;
  border-color: rgba(122, 144, 176, 0.35) !important;
  background: transparent !important;
}
.btn-outline-secondary:hover {
  background: rgba(122, 144, 176, 0.12) !important;
  color: var(--text) !important;
}

.btn-outline-danger {
  color: #f87171 !important;
  border-color: rgba(248, 113, 113, 0.35) !important;
}
.btn-outline-danger:hover {
  background: rgba(248,113,113,0.1) !important;
}

.btn-outline-warning {
  color: #fbbf24 !important;
  border-color: rgba(251,191,36,.35) !important;
}
.btn-outline-success {
  color: #34d399 !important;
  border-color: rgba(52,211,153,.35) !important;
}

/* ── Forms ─────────────────────────────────────────────────────── */
.form-control, .form-select {
  background: rgba(0, 200, 255, 0.05) !important;
  border: 1px solid var(--border) !important;
  color: var(--text) !important;
  transition: border-color .2s, box-shadow .2s;
}
.form-control:focus, .form-select:focus {
  background: rgba(0, 200, 255, 0.09) !important;
  border-color: var(--accent) !important;
  box-shadow: 0 0 0 3px var(--accent-dim) !important;
  color: var(--text) !important;
}
.form-control::placeholder { color: var(--text-muted) !important; }
.form-select option { background: #071428; color: var(--text); }
.form-label { color: #9bb5d0; font-size: .82rem; letter-spacing: .04em; text-transform: uppercase; }
.form-text { color: var(--text-muted) !important; }
.form-check-input {
  background-color: rgba(0,200,255,0.08) !important;
  border-color: var(--border-bright) !important;
}
.form-check-input:checked {
  background-color: var(--accent) !important;
  border-color: var(--accent) !important;
}

/* Input group text */
.input-group-text {
  background: rgba(0, 200, 255, 0.07) !important;
  border-color: var(--border) !important;
  color: var(--text-muted) !important;
}

/* ── Tables ────────────────────────────────────────────────────── */
.table {
  color: var(--text) !important;
  --bs-table-bg: transparent;
  --bs-table-hover-bg: rgba(0, 200, 255, 0.05);
}
.table > thead th {
  background: rgba(0, 200, 255, 0.08) !important;
  color: var(--accent) !important;
  border-color: var(--border) !important;
  font-size: .78rem;
  letter-spacing: .06em;
  text-transform: uppercase;
  font-weight: 600;
}
.table > :not(caption) > * > * {
  border-color: rgba(0, 200, 255, 0.07) !important;
  background-color: transparent !important;
  color: var(--text);
}
.table-hover > tbody > tr:hover > * {
  background-color: rgba(0, 200, 255, 0.05) !important;
  color: #fff !important;
}
.table-dark { --bs-table-bg: rgba(0,200,255,0.06) !important; }
.table-light { --bs-table-bg: rgba(0,200,255,0.04) !important; }
.table-secondary { opacity: .5; }

/* ── Badges ────────────────────────────────────────────────────── */
.badge.bg-primary   { background: rgba(0,150,199,0.85) !important; color: #e0f6ff !important; }
.badge.bg-success   { background: rgba(5,150,105,0.85) !important; }
.badge.bg-warning   { background: rgba(217,119,6,0.85)  !important; color: #fff8e0 !important; }
.badge.bg-danger    { background: rgba(185,28,28,0.85)  !important; }
.badge.bg-secondary { background: rgba(60,80,110,0.85)  !important; color: #c0cfe0 !important; }
.badge.bg-info      { background: rgba(0,180,216,0.7)   !important; color: #e0f9ff !important; }

/* ── Alerts ────────────────────────────────────────────────────── */
.alert {
  backdrop-filter: blur(10px);
  border-radius: .5rem;
  font-size: .88rem;
}
.alert-success  { background: rgba(5,150,105,.15)  !important; border-color: rgba(16,185,129,.35) !important; color: #6ee7b7 !important; }
.alert-danger   { background: rgba(185,28,28,.15)  !important; border-color: rgba(239,68,68,.35)  !important; color: #fca5a5 !important; }
.alert-warning  { background: rgba(180,83,9,.15)   !important; border-color: rgba(251,191,36,.35) !important; color: #fde68a !important; }
.alert-info     { background: rgba(0,150,200,.15)  !important; border-color: rgba(0,200,255,.3)   !important; color: #7dd3fc !important; }
.alert .btn-close { filter: invert(1) brightness(.7); }

/* ── Pagination ────────────────────────────────────────────────── */
.page-link {
  background: var(--surface) !important;
  border-color: var(--border) !important;
  color: var(--text-muted) !important;
}
.page-link:hover {
  background: var(--accent-dim) !important;
  color: var(--accent) !important;
  border-color: var(--border-bright) !important;
}
.page-item.active .page-link {
  background: rgba(0,150,199,.7) !important;
  border-color: var(--accent) !important;
  color: #fff !important;
  box-shadow: 0 0 10px rgba(0,200,255,.35);
}
.page-item.disabled .page-link { opacity: .3; }

/* ── Nav tabs ──────────────────────────────────────────────────── */
.nav-tabs {
  border-color: var(--border) !important;
}
.nav-tabs .nav-link {
  color: var(--text-muted) !important;
  border-color: transparent !important;
  font-size: .85rem;
}
.nav-tabs .nav-link:hover { color: var(--accent) !important; }
.nav-tabs .nav-link.active {
  background: var(--accent-dim) !important;
  border-color: var(--border-bright) var(--border-bright) transparent !important;
  color: var(--accent) !important;
}

/* ── Footer ────────────────────────────────────────────────────── */
footer {
  background: rgba(5,13,30,0.75) !important;
  backdrop-filter: blur(12px);
  border-top: 1px solid var(--border) !important;
  color: var(--text-muted) !important;
}

/* ── Admin sidebar ─────────────────────────────────────────────── */
.admin-sidebar-wrap {
  background: rgba(5, 13, 30, 0.78);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-right: 1px solid var(--border);
  min-height: 100vh;
  width: 220px;
  min-width: 220px;
  display: flex;
  flex-direction: column;
  padding: 1.25rem 1rem;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}

.admin-sidebar-wrap .brand {
  color: var(--accent) !important;
  text-decoration: none;
  font-weight: 700;
  font-size: 1.1rem;
  letter-spacing: .05em;
  margin-bottom: 1.75rem;
  display: flex;
  align-items: center;
  gap: .5rem;
}

.admin-sidebar .nav-link {
  color: var(--text-muted) !important;
  border-radius: .4rem;
  padding: .42rem .75rem;
  font-size: .875rem;
  display: flex;
  align-items: center;
  gap: .5rem;
  transition: background .18s, color .18s;
  border: 1px solid transparent;
}
.admin-sidebar .nav-link:hover {
  color: var(--accent) !important;
  background: var(--accent-dim);
}
.admin-sidebar .nav-link.active {
  color: var(--accent) !important;
  background: rgba(0, 200, 255, 0.1);
  border-color: rgba(0, 200, 255, 0.25);
  box-shadow: 0 0 10px rgba(0,200,255,.12);
}
.admin-sidebar .nav-link i { font-size: .95rem; }

/* ── Admin main area ───────────────────────────────────────────── */
.admin-main {
  flex: 1;
  padding: 1.75rem 2rem;
  min-width: 0;
}

/* ── Misc utilities ────────────────────────────────────────────── */
.text-muted { color: var(--text-muted) !important; }
.text-primary { color: var(--accent) !important; }
.text-white-50 { color: rgba(180,210,240,.5) !important; }
.bg-light { background: rgba(0,200,255,0.04) !important; }
.bg-dark  { background: rgba(5,13,30,0.8) !important; }
.border   { border-color: var(--border) !important; }
.border-primary { border-color: rgba(0,200,255,.45) !important; }

h1, h2, h3, h4, h5, h6 { color: var(--text); }
.fw-bold, .fw-semibold { color: #e8f0fc; }

/* Subtle glow on headings */
h3 { text-shadow: 0 0 30px rgba(0,200,255,.12); }

/* Collapse bg override */
.bg-light.border.rounded { background: rgba(0,200,255,0.04) !important; }

/* Stat cards on dashboard */
.stat-card {
  border-left: 3px solid var(--accent) !important;
  box-shadow: -3px 0 18px rgba(0,200,255,.15), 0 4px 24px rgba(0,0,0,.3);
}

/* Progress / dividers */
hr { border-color: var(--border); opacity: 1; }
.dropdown-divider { border-color: var(--border) !important; }

/* ── Catalog grid density ──────────────────────────────────────── */

/* Bootstrap only ships up to row-cols-6; extend to 8 */
@media (min-width: 1200px) {
  .row-cols-xl-8 > * { flex: 0 0 auto; width: 12.5%; }
  .row-cols-xl-7 > * { flex: 0 0 auto; width: 14.286%; }
  .row-cols-xl-6 > * { flex: 0 0 auto; width: 16.666%; }
}

/* Thumbnail height scales with density */
#parts-grid[data-cols="4"] .part-thumb,
#parts-grid[data-cols="4"] .part-thumb-placeholder { height: 160px; }

#parts-grid[data-cols="6"] .part-thumb,
#parts-grid[data-cols="6"] .part-thumb-placeholder { height: 120px; }
#parts-grid[data-cols="6"] .card-title  { font-size: .82rem; }
#parts-grid[data-cols="6"] .card-text   { font-size: .75rem; }
#parts-grid[data-cols="6"] .card-footer { padding-bottom: .5rem !important; }

#parts-grid[data-cols="8"] .part-thumb,
#parts-grid[data-cols="8"] .part-thumb-placeholder { height: 90px; }
#parts-grid[data-cols="8"] .card-title  { font-size: .76rem; margin-bottom: .2rem !important; }
#parts-grid[data-cols="8"] .card-text   { font-size: .7rem; margin-bottom: 0 !important; }
#parts-grid[data-cols="8"] .card-body   { padding: .5rem .6rem; }
#parts-grid[data-cols="8"] .card-footer { padding: .3rem .6rem .5rem !important; gap: .3rem !important; }
#parts-grid[data-cols="8"] .btn-sm      { padding: .2rem .4rem; font-size: .72rem; }
#parts-grid[data-cols="8"] .badge       { font-size: .65rem; }

/* Density toggle button active state */
.cols-btn.active {
  background: var(--accent-dim) !important;
  border-color: var(--border-bright) !important;
  color: var(--accent) !important;
  box-shadow: 0 0 8px rgba(0,200,255,.2);
}

/* Scrollbar */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: rgba(0,0,0,.2); }
::-webkit-scrollbar-thumb { background: rgba(0,200,255,.25); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: rgba(0,200,255,.45); }
