/* ============================================================
   OPSDE Portal — DacEasy Operations Dashboard
   ============================================================ */

/* --- Reset & Base --- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 14px; }
body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: #f0f2f5;
  color: #1a1a2e;
  min-height: 100vh;
}

/* --- Navigation --- */
.main-nav {
  background: #1a1a2e;
  color: #fff;
  padding: 0 24px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  height: 52px;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}
.nav-left { display: flex; align-items: center; gap: 6px; }
.nav-logo { height: 32px; margin-right: 10px; }
.nav-links { display: flex; align-items: center; gap: 0; }
.nav-right { display: flex; align-items: center; gap: 16px; }
.nav-brand {
  font-weight: 800;
  font-size: 18px;
  color: #7ec8e3;
  margin-right: 4px;
  letter-spacing: 1px;
}
.nav-subtitle {
  font-size: 11px;
  color: #8899aa;
  margin-right: 20px;
  border-right: 1px solid #334;
  padding-right: 20px;
}
.main-nav a {
  color: #aab;
  text-decoration: none;
  font-weight: 500;
  font-size: 13px;
  padding: 16px 12px;
  border-bottom: 2px solid transparent;
  transition: color 0.15s, border-color 0.15s;
}
.main-nav a:hover { color: #fff; }
.main-nav a.active { color: #7ec8e3; border-bottom-color: #7ec8e3; }
.nav-user { font-size: 12px; color: #8899aa; }
.nav-logout {
  background: none;
  border: 1px solid #445;
  color: #aab;
  padding: 5px 12px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 12px;
  transition: all 0.15s;
}
.nav-logout:hover { border-color: #e74c3c; color: #e74c3c; }

/* --- Page Layout --- */
.page-container {
  max-width: 1440px;
  margin: 0 auto;
  padding: 24px;
}
.page-title {
  font-size: 22px;
  font-weight: 700;
  margin-bottom: 20px;
  color: #1a1a2e;
}

/* --- Stat Cards --- */
.stats-grid {
  display: flex;
  gap: 16px;
  margin-bottom: 24px;
  flex-wrap: wrap;
}
.stat-card {
  background: #fff;
  border-radius: 10px;
  padding: 20px 28px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.06);
  min-width: 180px;
  flex: 1;
}
.stat-value {
  font-size: 30px;
  font-weight: 800;
  color: #1a1a2e;
  font-variant-numeric: tabular-nums;
}
.stat-label {
  font-size: 12px;
  color: #666;
  margin-top: 4px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* --- Filters --- */
.filters {
  background: #fff;
  border-radius: 10px;
  padding: 16px 20px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.06);
  margin-bottom: 20px;
  display: flex;
  gap: 12px;
  align-items: center;
  flex-wrap: wrap;
}
.filters input,
.filters select {
  padding: 8px 12px;
  border: 1px solid #dde;
  border-radius: 6px;
  font-size: 13px;
  background: #fafbfc;
  transition: border-color 0.15s;
}
.filters input:focus,
.filters select:focus { border-color: #7ec8e3; outline: none; }
.filters input[type="text"] { width: 260px; }
.filters button {
  padding: 8px 20px;
  background: #1a1a2e;
  color: #fff;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  transition: background 0.15s;
}
.filters button:hover { background: #16213e; }
.filter-count {
  color: #888;
  font-size: 13px;
  margin-left: auto;
}

/* --- Table Wrapper (scroll) --- */
.table-wrap {
  overflow-x: auto;
  overflow-y: auto;
  max-height: 520px;
  border-radius: 10px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.06);
  margin-bottom: 8px;
}

/* --- Tables --- */
table {
  width: 100%;
  border-collapse: collapse;
  background: #fff;
  overflow: hidden;
}
thead th {
  background: #1a1a2e;
  color: #fff;
  padding: 11px 14px;
  text-align: left;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  white-space: nowrap;
  position: sticky;
  top: 0;
  z-index: 10;
}
td {
  padding: 9px 14px;
  border-bottom: 1px solid #f0f0f0;
  font-size: 13px;
}
tbody tr { transition: background 0.1s; }
tbody tr:hover { background: #f5f8ff; }
.num { text-align: right; font-variant-numeric: tabular-nums; }

/* --- Tags --- */
.tag {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 600;
}
.tag-active { background: #dcfce7; color: #166534; }
.tag-inactive { background: #fee2e2; color: #991b1b; }
.tag-brand { background: #e8eaf6; color: #283593; }
.stock-yes { color: #16a34a; font-weight: 700; }
.stock-no { color: #bbb; }

/* --- Pagination --- */
.pagination {
  margin: 24px 0;
  display: flex;
  gap: 6px;
  justify-content: center;
}
.pagination a {
  padding: 8px 14px;
  background: #fff;
  border: 1px solid #dde;
  border-radius: 6px;
  text-decoration: none;
  color: #333;
  font-size: 13px;
  transition: all 0.15s;
}
.pagination a:hover { border-color: #7ec8e3; color: #1a1a2e; }
.pagination a.active {
  background: #1a1a2e;
  color: #fff;
  border-color: #1a1a2e;
}

/* --- Login Page --- */
.login-wrapper {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 100vh;
  background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
}
.login-card {
  background: #fff;
  border-radius: 16px;
  padding: 48px 40px;
  width: 400px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.3);
}
.login-brand {
  font-size: 28px;
  font-weight: 800;
  color: #1a1a2e;
  text-align: center;
  margin-bottom: 4px;
  letter-spacing: 2px;
}
.login-subtitle {
  text-align: center;
  color: #888;
  font-size: 13px;
  margin-bottom: 32px;
}
.login-card label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: #555;
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.login-card input[type="email"],
.login-card input[type="password"] {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid #dde;
  border-radius: 8px;
  font-size: 14px;
  margin-bottom: 20px;
  transition: border-color 0.15s;
}
.login-card input:focus { border-color: #7ec8e3; outline: none; }
.login-btn {
  width: 100%;
  padding: 14px;
  background: #1a1a2e;
  color: #fff;
  border: none;
  border-radius: 8px;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.15s;
}
.login-btn:hover { background: #16213e; }
.login-btn:disabled { background: #999; cursor: not-allowed; }
.login-error {
  background: #fee2e2;
  color: #991b1b;
  padding: 10px 14px;
  border-radius: 8px;
  font-size: 13px;
  margin-bottom: 16px;
  display: none;
}

/* --- Empty State --- */
.empty-state {
  text-align: center;
  padding: 48px;
  color: #999;
  font-size: 15px;
}

/* --- Loading --- */
.loading {
  text-align: center;
  padding: 48px;
  color: #888;
}
.loading::after {
  content: '';
  display: inline-block;
  width: 20px;
  height: 20px;
  border: 2px solid #dde;
  border-top-color: #7ec8e3;
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
  margin-left: 8px;
  vertical-align: middle;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* --- Hamburger Button --- */
.hamburger {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  padding: 8px;
  margin-left: auto;
}
.hamburger span {
  display: block;
  width: 22px;
  height: 2px;
  background: #aab;
  margin: 5px 0;
  border-radius: 2px;
  transition: all 0.3s;
}
.hamburger:hover span { background: #fff; }
.hamburger.open span:nth-child(1) { transform: rotate(45deg) translate(5px, 5px); }
.hamburger.open span:nth-child(2) { opacity: 0; }
.hamburger.open span:nth-child(3) { transform: rotate(-45deg) translate(5px, -5px); }

/* --- Mobile Menu Overlay --- */
.mobile-menu {
  display: none;
  position: fixed;
  top: 52px;
  left: 0;
  right: 0;
  bottom: 0;
  background: #1a1a2e;
  z-index: 99;
  flex-direction: column;
  padding: 16px 0;
  overflow-y: auto;
}
.mobile-menu.open { display: flex; }
.mobile-menu a {
  color: #aab;
  text-decoration: none;
  font-size: 16px;
  font-weight: 500;
  padding: 14px 24px;
  border-left: 3px solid transparent;
  transition: all 0.15s;
}
.mobile-menu a:hover { color: #fff; background: rgba(255,255,255,0.05); }
.mobile-menu a.active { color: #7ec8e3; border-left-color: #7ec8e3; background: rgba(126,200,227,0.05); }
.mobile-menu .mobile-user {
  margin-top: auto;
  padding: 16px 24px;
  border-top: 1px solid #334;
}
.mobile-menu .mobile-user-email { color: #8899aa; font-size: 13px; display: block; margin-bottom: 12px; }
.mobile-menu .mobile-logout {
  background: none;
  border: 1px solid #445;
  color: #aab;
  padding: 8px 20px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 13px;
  width: 100%;
}
.mobile-menu .mobile-logout:hover { border-color: #e74c3c; color: #e74c3c; }

/* --- Responsive --- */
@media (max-width: 768px) {
  .main-nav { padding: 0 12px; }
  .nav-subtitle { display: none; }
  .nav-links { display: none; }
  .nav-right { display: none; }
  .hamburger { display: block; }
  .page-container { padding: 16px; }
  .page-title { font-size: 18px; }
  .stats-grid { flex-direction: column; }
  .stat-card { padding: 14px 18px; }
  .stat-value { font-size: 24px; }
  .filters { flex-direction: column; }
  .filters input[type="text"] { width: 100%; }
  table { font-size: 12px; }
  td { padding: 7px 10px; }
  thead th { padding: 9px 10px; font-size: 11px; }
}
