/* ================================================================
   Knight Optical RFQ Web — main.css
   Typography: DM Sans (UI) + DM Mono (data/codes)
   Palette: Deep navy + vibrant blue accent, clean surfaces
   ================================================================ */

:root {
  --navy:       #0A1628;
  --navy-2:     #162D50;
  --navy-3:     #1E3F6E;
  --accent:     #3B8BF5;
  --accent-2:   #5CA0F7;
  --accent-dim: rgba(59,139,245,0.12);
  --accent-glow:rgba(59,139,245,0.25);
  --success:    #10B981;
  --warning:    #F59E0B;
  --danger:     #EF4444;
  --surface:    #F0F4FA;
  --surface-2:  #FFFFFF;
  --border:     #E2E8F2;
  --border-2:   #CBD5E1;
  --text:       #1A2332;
  --text-2:     #5A6F87;
  --text-3:     #94A3B8;
  --text-light: #94A3B8;
  --shadow-xs:  0 1px 3px rgba(10,22,40,0.04);
  --shadow:     0 2px 8px rgba(10,22,40,0.06), 0 1px 3px rgba(10,22,40,0.04);
  --shadow-md:  0 4px 16px rgba(10,22,40,0.08), 0 2px 6px rgba(10,22,40,0.04);
  --shadow-lg:  0 8px 32px rgba(10,22,40,0.12), 0 4px 12px rgba(10,22,40,0.06);
  --shadow-xl:  0 20px 60px rgba(10,22,40,0.15);
  --radius:     10px;
  --radius-lg:  16px;
  --radius-xl:  20px;
  --ease:       cubic-bezier(0.4, 0, 0.2, 1);
}

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

html { font-size: 15px; scroll-behavior: smooth; }

body {
  font-family: 'DM Sans', sans-serif;
  background: var(--surface);
  color: var(--text);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ── TOPBAR ─────────────────────────────────────────────── */
.topbar {
  background: linear-gradient(135deg, var(--navy) 0%, #0F2341 100%);
  color: #fff;
  display: flex;
  align-items: center;
  gap: 2rem;
  padding: 0 1.75rem;
  height: 60px;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 4px 24px rgba(10,22,40,0.35);
  border-bottom: 1px solid rgba(255,255,255,0.06);
}

.topbar-brand {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  flex-shrink: 0;
}

.brand-name {
  font-weight: 600;
  font-size: 1.05rem;
  color: #fff;
  letter-spacing: 0.02em;
}

.brand-sub {
  font-size: 0.7rem;
  color: var(--accent-2);
  background: rgba(59,139,245,0.15);
  padding: 2px 10px;
  border-radius: 99px;
  font-weight: 500;
  letter-spacing: 0.03em;
  border: 1px solid rgba(59,139,245,0.2);
}

.topbar-nav {
  display: flex;
  gap: 0.15rem;
  flex: 1;
}

.topbar-nav a {
  color: rgba(255,255,255,0.6);
  text-decoration: none;
  font-size: 0.85rem;
  font-weight: 500;
  padding: 0.4rem 0.9rem;
  border-radius: var(--radius);
  transition: all 0.2s var(--ease);
  position: relative;
}

.topbar-nav a:hover {
  color: #fff;
  background: rgba(255,255,255,0.08);
}

.topbar-nav a.active {
  color: #fff;
  background: rgba(59,139,245,0.2);
  box-shadow: inset 0 0 0 1px rgba(59,139,245,0.3);
}

/* Nav dropdown for dept dashboards */
.nav-dropdown { position: relative; }
.nav-dropdown > a {
  color: rgba(255,255,255,0.6);
  text-decoration: none;
  font-size: 0.85rem;
  font-weight: 500;
  padding: 0.4rem 0.9rem;
  border-radius: 6px;
  transition: all 0.15s;
  display: inline-block;
  cursor: pointer;
}
.nav-dropdown > a:hover { color: #fff; background: rgba(255,255,255,0.08); }
.nav-dropdown > a.active { color: #fff; background: rgba(59,139,245,0.2); box-shadow: inset 0 0 0 1px rgba(59,139,245,0.3); }
.nav-dropdown-menu {
  display: none;
  position: absolute;
  top: 100%;
  left: 0;
  background: #1e293b;
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 8px;
  padding: 0.35rem 0;
  min-width: 160px;
  z-index: 1000;
  box-shadow: 0 8px 24px rgba(0,0,0,0.3);
  margin-top: 4px;
}
.nav-dropdown.open .nav-dropdown-menu { display: block; }
.nav-dropdown-menu a {
  display: block;
  padding: 0.45rem 1rem;
  color: rgba(255,255,255,0.7);
  text-decoration: none;
  font-size: 0.82rem;
  white-space: nowrap;
}
.nav-dropdown-menu a:hover {
  background: rgba(255,255,255,0.08);
  color: #fff;
}

.topbar-user {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  flex-shrink: 0;
  font-size: 0.82rem;
}

.user-badge {
  font-weight: 600;
  color: #fff;
}

.user-dept {
  color: rgba(255,255,255,0.5);
  background: rgba(255,255,255,0.07);
  padding: 3px 10px;
  border-radius: 99px;
  font-size: 0.75rem;
}

.btn-logout {
  color: rgba(255,255,255,0.5);
  text-decoration: none;
  border: 1px solid rgba(255,255,255,0.12);
  padding: 4px 12px;
  border-radius: 8px;
  font-size: 0.78rem;
  transition: all 0.2s var(--ease);
}
.btn-logout:hover {
  color: #fff;
  border-color: rgba(255,255,255,0.35);
  background: rgba(255,255,255,0.06);
}

/* ── PAGE WRAPPER ───────────────────────────────────────── */
.page-wrap {
  flex: 1;
  padding: 1.75rem 2.25rem 3rem;
  max-width: 1600px;
  width: 100%;
  margin: 0 auto;
}

.page-header {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1.75rem;
}

.page-title {
  font-size: 1.6rem;
  font-weight: 600;
  color: var(--navy);
  letter-spacing: -0.01em;
}

.page-title small {
  font-size: 0.85rem;
  font-weight: 400;
  color: var(--text-2);
  margin-left: 0.6rem;
}

/* ── CARDS ──────────────────────────────────────────────── */
.card {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  padding: 1.35rem 1.6rem;
  margin-bottom: 1.1rem;
  transition: box-shadow 0.25s var(--ease);
}

.card:hover {
  box-shadow: var(--shadow-md);
}

.card-title {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--navy-2);
  margin-bottom: 1.1rem;
  padding-bottom: 0.7rem;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

/* ── STATS ROW ──────────────────────────────────────────── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(185px, 1fr));
  gap: 1rem;
  margin-bottom: 1.75rem;
}

.stat-card {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.1rem 1.35rem;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  box-shadow: var(--shadow);
  transition: all 0.25s var(--ease);
  position: relative;
  overflow: hidden;
}

.stat-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  opacity: 0;
  transition: opacity 0.25s var(--ease);
}

.stat-card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
}

.stat-card:hover::before {
  opacity: 1;
}

.stat-label {
  font-size: 0.72rem;
  color: var(--text-2);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.stat-value {
  font-size: 2rem;
  font-weight: 600;
  color: var(--navy);
  font-family: 'DM Mono', monospace;
  line-height: 1;
}

.stat-sub {
  font-size: 0.78rem;
  color: var(--text-3);
}

/* ── TABLE ──────────────────────────────────────────────── */
.table-wrap {
  overflow-x: auto;
  border-radius: var(--radius);
  border: 1px solid var(--border);
}

table.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
}

table.data-table thead th {
  background: linear-gradient(135deg, var(--navy) 0%, var(--navy-2) 100%);
  color: rgba(255,255,255,0.88);
  font-weight: 500;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 0.7rem 0.9rem;
  text-align: left;
  white-space: nowrap;
  position: sticky;
  top: 0;
}

table.data-table tbody tr {
  border-bottom: 1px solid var(--border);
  transition: all 0.15s var(--ease);
  cursor: pointer;
}

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

table.data-table tbody tr:hover {
  background: linear-gradient(90deg, rgba(59,139,245,0.04), rgba(59,139,245,0.08));
}

table.data-table tbody td {
  padding: 0.6rem 0.9rem;
  vertical-align: middle;
  font-family: 'DM Mono', monospace;
  font-size: 0.82rem;
  color: var(--text);
}

table.data-table tbody td.text-cell {
  font-family: 'DM Sans', sans-serif;
  font-size: 0.85rem;
}

/* alternating row tint */
table.data-table tbody tr:nth-child(even) {
  background: rgba(240,244,250,0.5);
}
table.data-table tbody tr:nth-child(even):hover {
  background: linear-gradient(90deg, rgba(59,139,245,0.04), rgba(59,139,245,0.08));
}

/* ── BADGES ─────────────────────────────────────────────── */
.badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 99px;
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border: 1px solid transparent;
}

.badge-open    { background: #DBEAFE; color: #1D4ED8; border-color: #BFDBFE; }
.badge-close   { background: #D1FAE5; color: #065F46; border-color: #A7F3D0; }
.badge-nobid   { background: #FEE2E2; color: #991B1B; border-color: #FECACA; }
.badge-done    { background: #D1FAE5; color: #065F46; border-color: #A7F3D0; font-weight: 600; }
.badge-itar    { background: #FEF3C7; color: #92400E; border-color: #FDE68A; }
.badge-yes     { background: #DBEAFE; color: #1E40AF; border-color: #BFDBFE; }
.badge-dept    { background: var(--accent-dim); color: var(--navy-2); border-color: rgba(59,139,245,0.2); }

/* ── TABS ───────────────────────────────────────────────── */
.tab-bar {
  display: flex;
  gap: 0;
  border-bottom: 2px solid var(--border);
  margin-bottom: 1.5rem;
  overflow-x: auto;
}

.tab-btn {
  padding: 0.65rem 1.2rem;
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--text-2);
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.2s var(--ease);
}

.tab-btn:hover { color: var(--navy); }
.tab-btn.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
  font-weight: 600;
}

.tab-panel { display: none; }
.tab-panel.active { display: block; }

/* ── FORMS ──────────────────────────────────────────────── */
.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 1rem;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}

.form-group.full { grid-column: 1 / -1; }

label {
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--text-2);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

input[type=text],
input[type=date],
input[type=email],
input[type=number],
input[type=password],
select,
textarea {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.55rem 0.85rem;
  font-size: 0.875rem;
  font-family: 'DM Sans', sans-serif;
  color: var(--text);
  transition: all 0.2s var(--ease);
  width: 100%;
}

input[type=text]:hover,
input[type=date]:hover,
input[type=email]:hover,
input[type=number]:hover,
input[type=password]:hover,
select:hover,
textarea:hover {
  border-color: var(--border-2);
}

input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-dim);
  background: #fff;
}

input:disabled, select:disabled, textarea:disabled {
  background: var(--surface);
  color: var(--text-2);
  cursor: not-allowed;
}

textarea { min-height: 80px; resize: vertical; }

/* ── BUTTONS ────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  padding: 0.55rem 1.1rem;
  border-radius: var(--radius);
  font-size: 0.85rem;
  font-weight: 500;
  font-family: 'DM Sans', sans-serif;
  border: none;
  cursor: pointer;
  transition: all 0.2s var(--ease);
  text-decoration: none;
  position: relative;
}

.btn:active {
  transform: scale(0.97);
}

.btn-primary {
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent-2) 100%);
  color: #fff;
  box-shadow: 0 2px 8px rgba(59,139,245,0.3);
}
.btn-primary:hover {
  box-shadow: 0 4px 16px rgba(59,139,245,0.4);
  transform: translateY(-1px);
}
.btn-primary:active {
  transform: translateY(0) scale(0.97);
}

.btn-navy {
  background: linear-gradient(135deg, var(--navy) 0%, var(--navy-2) 100%);
  color: #fff;
  box-shadow: 0 2px 8px rgba(10,22,40,0.2);
}
.btn-navy:hover {
  box-shadow: 0 4px 12px rgba(10,22,40,0.3);
  transform: translateY(-1px);
}

.btn-ghost {
  background: transparent;
  color: var(--text-2);
  border: 1px solid var(--border);
}
.btn-ghost:hover {
  background: var(--surface);
  color: var(--text);
  border-color: var(--border-2);
}

.btn-danger {
  background: linear-gradient(135deg, #EF4444, #F87171);
  color: #fff;
  box-shadow: 0 2px 8px rgba(239,68,68,0.25);
}
.btn-danger:hover {
  box-shadow: 0 4px 12px rgba(239,68,68,0.35);
  transform: translateY(-1px);
}

.btn-warning {
  background: linear-gradient(135deg, #D97706, #F59E0B);
  color: #fff;
  border: none;
}
.btn-warning:hover {
  box-shadow: 0 4px 12px rgba(217,119,6,0.3);
  transform: translateY(-1px);
}

.btn-success {
  background: linear-gradient(135deg, #059669, #10B981);
  color: #fff;
  border: none;
}
.btn-success:hover {
  box-shadow: 0 4px 12px rgba(16,185,129,0.3);
  transform: translateY(-1px);
}

.btn-sm {
  padding: 0.3rem 0.75rem;
  font-size: 0.78rem;
  border-radius: 8px;
}

/* ── ALERT ──────────────────────────────────────────────── */
.alert {
  padding: 0.8rem 1.1rem;
  border-radius: var(--radius);
  font-size: 0.85rem;
  margin-bottom: 1rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.alert-error {
  background: #FEF2F2;
  color: #991B1B;
  border: 1px solid #FECACA;
  box-shadow: 0 1px 4px rgba(239,68,68,0.08);
}
.alert-success {
  background: #F0FDF4;
  color: #166534;
  border: 1px solid #BBF7D0;
  box-shadow: 0 1px 4px rgba(34,197,94,0.08);
}
.alert-warn {
  background: #FFFBEB;
  color: #92400E;
  border: 1px solid #FDE68A;
  box-shadow: 0 1px 4px rgba(245,158,11,0.08);
}

/* ── SEARCH BAR ─────────────────────────────────────────── */
.search-bar {
  display: flex;
  gap: 0.6rem;
  align-items: center;
  margin-bottom: 1rem;
}

.search-bar input {
  flex: 1;
  max-width: 360px;
}

/* ── DEPT CHECKBOXES ────────────────────────────────────── */
.dept-checks {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.dept-check {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  background: var(--surface-2);
  border: 1px solid var(--border);
  padding: 0.35rem 0.8rem;
  border-radius: var(--radius);
  cursor: pointer;
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--text-2);
  transition: all 0.2s var(--ease);
  user-select: none;
}

.dept-check input[type=checkbox] { accent-color: var(--accent); }
.dept-check:has(input:checked) {
  background: var(--accent-dim);
  border-color: var(--accent);
  color: var(--navy-2);
  box-shadow: 0 0 0 1px var(--accent-dim);
}

/* ── PAGINATION ─────────────────────────────────────────── */
.pagination {
  display: flex;
  gap: 0.3rem;
  align-items: center;
  justify-content: flex-end;
  margin-top: 0.75rem;
}

.page-link {
  padding: 0.35rem 0.7rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 0.8rem;
  color: var(--text-2);
  text-decoration: none;
  transition: all 0.2s var(--ease);
}

.page-link:hover  { background: var(--surface); color: var(--text); border-color: var(--border-2); }
.page-link.active {
  background: linear-gradient(135deg, var(--navy), var(--navy-2));
  color: #fff;
  border-color: var(--navy);
}

/* ── MODAL ──────────────────────────────────────────────── */
.modal-overlay {
  backdrop-filter: blur(4px);
}

/* ── FOOTER ─────────────────────────────────────────────── */
.site-footer {
  background: linear-gradient(135deg, var(--navy) 0%, #0F2341 100%);
  text-align: center;
  padding: 1.1rem 1.5rem;
  border-top: 1px solid rgba(255,255,255,0.08);
}

#world-clocks {
  display: flex;
  gap: 2rem;
  justify-content: center;
  align-items: center;
  margin-bottom: 0.5rem;
  flex-wrap: wrap;
}

.clock-item {
  display: flex;
  align-items: center;
  gap: 0.45rem;
}

.clock-label {
  font-size: 0.85rem;
  font-weight: 600;
  color: rgba(255,255,255,0.7);
  letter-spacing: 0.01em;
}

.clock-time {
  font-family: 'DM Mono', monospace;
  font-size: 0.88rem;
  font-weight: 500;
  color: var(--accent-2);
  background: rgba(59,139,245,0.1);
  padding: 2px 8px;
  border-radius: 6px;
  border: 1px solid rgba(59,139,245,0.15);
}

.footer-copy {
  font-size: 0.8rem;
  color: rgba(255,255,255,0.35);
}

/* ── SCROLLBAR ─────────────────────────────────────────── */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: var(--border-2);
  border-radius: 99px;
}
::-webkit-scrollbar-thumb:hover {
  background: var(--text-3);
}

/* ── SELECTION ─────────────────────────────────────────── */
::selection {
  background: var(--accent-dim);
  color: var(--navy);
}

/* ── RESPONSIVE ─────────────────────────────────────────── */
@media (max-width: 768px) {
  .topbar { padding: 0 1rem; }
  .topbar-nav { display: none; }
  .page-wrap  { padding: 1rem; }
  .form-grid  { grid-template-columns: 1fr; }
}

/* ── UTILITIES ──────────────────────────────────────────── */
.mono { font-family: 'DM Mono', monospace; }
.text-right { text-align: right; }
.text-center { text-align: center; }
.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mb-1 { margin-bottom: 0.5rem; }
.flex { display: flex; }
.gap-1 { gap: 0.5rem; }
.gap-2 { gap: 1rem; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.flex-1 { flex: 1; }
