/* =============================================================
   BBAS DESIGN SYSTEM — PIXEL-PERFECT RESPONSIVE STYLESHEET
   ============================================================= */

@import url("https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800;900&display=swap");

:root {
  --primary: #1E3A8A;
  --primary-hover: #1D4ED8;
  --primary-light: #EFF6FF;
  --primary-text: #1E40AF;
  
  --success: #10B981;
  --success-light: #DCFCE7;
  --success-text: #15803D;

  --warning: #F59E0B;
  --warning-light: #FEF3C7;
  --warning-text: #B45309;

  --danger: #EF4444;
  --danger-light: #FEE2E2;
  --danger-text: #B91C1C;

  --bg: #F8FAFC;
  --surface: #FFFFFF;
  --border: #E2E8F0;
  --border-focus: #3B82F6;
  
  --text-main: #0F172A;
  --text-muted: #64748B;
  --text-subtle: #94A3B8;

  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.07), 0 2px 4px -2px rgba(0, 0, 0, 0.05);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.08), 0 4px 6px -4px rgba(0, 0, 0, 0.03);
}

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

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text-main);
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}

/* ─── App Shell Layout ─── */
.st-layout {
  display: flex;
  min-height: 100vh;
  width: 100%;
}

/* ─── Sidebar ─── */
.st-sidebar {
  width: 260px;
  background: #FFFFFF;
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  z-index: 1000;
  flex-shrink: 0;
  transition: transform 0.25s ease;
}

.st-sidebar-header {
  padding: 20px 16px 16px;
  display: flex;
  align-items: center;
  border-bottom: 1px solid var(--border);
}

.st-sidebar-header img {
  height: 40px;
  max-width: 100%;
  display: block;
}

.st-nav {
  flex: 1;
  padding: 16px 0;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}

.st-nav-section {
  font-size: 0.72rem;
  font-weight: 800;
  color: var(--text-subtle);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 12px 20px 6px;
  display: block;
}

.st-nav-link {
  display: flex !important;
  align-items: center;
  gap: 12px;
  padding: 10px 16px;
  margin: 2px 12px;
  border-radius: 8px;
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.88rem;
  font-weight: 600;
  transition: all 0.15s ease;
}

.st-nav-link span {
  display: inline-block;
}

.st-nav-link .material-symbols-outlined {
  font-size: 20px;
  color: inherit;
}

.st-nav-link:hover {
  background: #F1F5F9;
  color: var(--primary);
}

.st-nav-link.active {
  background: var(--primary-light);
  color: var(--primary);
  font-weight: 700;
}

.st-sidebar-footer {
  padding: 14px 16px;
  border-top: 1px solid var(--border);
  background: #FAFAFA;
  margin-top: auto;
}

.st-user-profile-box {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 10px;
  border-radius: 10px;
  cursor: pointer;
  transition: background 0.15s ease;
}

.st-user-profile-box:hover {
  background: #F1F5F9;
}

.st-user-avatar {
  width: 38px;
  height: 38px;
  border-radius: 9999px;
  background: #1E3A8A;
  color: #FFFFFF;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 0.95rem;
  flex-shrink: 0;
  box-shadow: 0 2px 6px rgba(30, 58, 138, 0.25);
}

.st-user-info {
  flex: 1;
  min-width: 0;
}

.st-user-name {
  margin: 0;
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--text-main);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.st-user-role {
  margin: 2px 0 0;
  font-size: 0.7rem;
  font-weight: 800;
  color: var(--primary);
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.st-logout-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 6px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s ease;
}

.st-logout-btn:hover {
  background: #FEE2E2;
  color: #EF4444;
}

/* ─── Main Content & Header ─── */
.st-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  background: var(--bg);
}

.st-header {
  height: 68px;
  background: #FFFFFF;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 28px;
  position: sticky;
  top: 0;
  z-index: 900;
}

.st-header h2 {
  font-size: 1.25rem;
  font-weight: 800;
  margin: 0;
  color: var(--text-main);
  letter-spacing: -0.01em;
}

.st-page-body {
  padding: 28px;
  max-width: 1500px;
  width: 100%;
  margin: 0 auto;
}

/* ─── Stats Cards Grid ─── */
.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.stat {
  background: #FFFFFF;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 20px;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
}

.st-stat-icon {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.st-stat-icon.primary { background: rgba(30, 58, 138, 0.1); color: var(--primary); }
.st-stat-icon.secondary { background: rgba(16, 185, 129, 0.1); color: var(--success); }
.st-stat-icon.tertiary { background: rgba(139, 92, 246, 0.1); color: #8B5CF6; }

.st-stat-label {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin: 12px 0 4px;
}

.st-stat-value {
  font-size: 2rem;
  font-weight: 900;
  color: var(--text-main);
  margin: 0;
  line-height: 1.1;
  letter-spacing: -0.02em;
}

.st-stat-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px;
  border-radius: 9999px;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.st-stat-badge.success { background: var(--success-light); color: var(--success-text); }
.st-stat-badge.info { background: #E0E7FF; color: #4338CA; }
.st-stat-badge.warning { background: var(--warning-light); color: var(--warning-text); }
.st-stat-badge.danger { background: var(--danger-light); color: var(--danger-text); }

/* ─── Cards & Containers ─── */
.st-card-soft {
  background: #FFFFFF;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 24px;
  box-shadow: var(--shadow-sm);
  margin-bottom: 24px;
}

/* ─── Buttons ─── */
.st-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 18px;
  border-radius: 8px;
  font-size: 0.88rem;
  font-weight: 700;
  cursor: pointer;
  text-decoration: none;
  border: 1px solid transparent;
  transition: all 0.15s ease;
  white-space: nowrap;
}

.st-btn-sm {
  padding: 6px 12px;
  font-size: 0.8rem;
}

.st-btn-primary {
  background: var(--primary);
  color: #FFFFFF;
  border-color: var(--primary);
}
.st-btn-primary:hover:not(:disabled) {
  background: var(--primary-hover);
  box-shadow: 0 4px 12px rgba(30, 58, 138, 0.25);
}

.st-btn-secondary {
  background: #EF4444;
  color: #FFFFFF;
  border-color: #EF4444;
}
.st-btn-secondary:hover:not(:disabled) {
  background: #DC2626;
}

.st-btn-ghost {
  background: #F1F5F9;
  color: #334155;
  border-color: #E2E8F0;
}
.st-btn-ghost:hover:not(:disabled) {
  background: #E2E8F0;
  color: #0F172A;
}

.st-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* ─── Badges & Status Tags ─── */
.bot-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 12px;
  border-radius: 9999px;
  font-size: 0.78rem;
  font-weight: 700;
  background: var(--success-light);
  color: var(--success-text);
  border: 1px solid rgba(16, 185, 129, 0.25);
}

.hash-code {
  font-family: 'Consolas', 'Courier New', monospace;
  font-size: 0.82rem;
  background: #F1F5F9;
  color: #1E3A8A;
  padding: 3px 6px;
  border-radius: 4px;
  word-break: break-all;
  border: 1px solid #E2E8F0;
}

.status-badge {
  display: inline-block;
  padding: 3px 8px;
  border-radius: 6px;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
}

.status-PRESENT { background: #DCFCE7; color: #15803D; }
.status-LATE { background: #FEF3C7; color: #B45309; }
.status-INSUFFICIENT_TIME { background: #FEE2E2; color: #B91C1C; }
.status-SPOOF_ATTEMPT { background: #7F1D1D; color: #FEE2E2; }

/* ─── Tables ─── */
table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
}

th {
  padding: 12px 16px;
  font-size: 0.75rem;
  font-weight: 800;
  color: var(--text-subtle);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  background: #F8FAFC;
  border-bottom: 1px solid var(--border);
}

td {
  padding: 14px 16px;
  font-size: 0.88rem;
  color: var(--text-main);
  border-bottom: 1px solid #F1F5F9;
  vertical-align: middle;
}

tbody tr:hover {
  background: #FAFAFA;
}

/* ─── Form Inputs ─── */
input[type="text"],
input[type="password"],
input[type="number"],
select,
textarea {
  font-family: inherit;
  font-size: 0.88rem;
  color: var(--text-main);
  background: #FFFFFF;
  border: 1px solid #CBD5E1;
  border-radius: 8px;
  padding: 10px 14px;
  outline: none;
  transition: all 0.15s ease;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}

/* ─── Mobile Navigation Toggle & Drawer ─── */
.mobile-nav-toggle {
  display: none;
  background: #F1F5F9;
  border: 1px solid #CBD5E1;
  cursor: pointer;
  color: #1E293B;
  padding: 7px;
  border-radius: 8px;
  margin-right: 8px;
}

.sidebar-backdrop {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(15, 23, 42, 0.5);
  backdrop-filter: blur(3px);
  z-index: 999;
}

/* ─── Responsive Media Queries ─── */
@media (max-width: 1024px) {
  .st-sidebar {
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    transform: translateX(-100%);
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.2);
  }

  .st-sidebar.open {
    transform: translateX(0);
  }

  .sidebar-backdrop.active {
    display: block;
  }

  .mobile-nav-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }

  .st-header {
    padding: 0 16px;
    height: 64px;
  }

  .st-page-body {
    padding: 16px;
  }
}

@media (max-width: 640px) {
  .st-header h2 {
    font-size: 1.05rem !important;
  }

  .bot-badge {
    display: none !important;
  }

  .stats {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .st-card-soft {
    padding: 16px;
  }

  th, td {
    padding: 10px 12px;
    font-size: 0.8rem;
  }
}
