/* ============================================================
   UP Criminal System – Enterprise UI
   ============================================================ */

/* --- Google Fonts (Inter) --- */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');

:root {
  --sidebar-width: 250px;
  --topbar-height: 60px;
  --primary: #1e3a5f;
  --primary-light: #2a5298;
  --primary-dark: #0f2440;
  --secondary: #6c757d;
  --accent: #00b4d8;
  --accent-light: #48cae4;
  --success: #059669;
  --danger: #dc2626;
  --warning: #d97706;
  --info: #0284c7;
  --bg-body: #f0f2f5;
  --bg-card: #ffffff;
  --text-dark: #1e293b;
  --text-muted: #64748b;
  --border-color: #e2e8f0;
  --shadow-sm: 0 1px 3px rgba(0,0,0,.08);
  --shadow-md: 0 4px 12px rgba(0,0,0,.1);
  --shadow-lg: 0 8px 30px rgba(0,0,0,.12);
  --radius: 12px;
  --radius-sm: 8px;
}

* { font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif; }

body {
  background: var(--bg-body);
  color: var(--text-dark);
  font-size: .875rem;
  overflow-x: hidden;
}

/* ========== SIDEBAR ========== */
.sidebar {
  position: fixed;
  top: 0;
  left: 0;
  width: var(--sidebar-width);
  height: 100vh;
  background: linear-gradient(180deg, var(--primary-dark) 0%, var(--primary) 100%);
  z-index: 1040;
  transition: transform .3s ease;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
}
.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 18px 20px;
  color: #fff;
  font-size: 1.15rem;
  font-weight: 700;
  text-decoration: none;
  border-bottom: 1px solid rgba(255,255,255,.08);
  min-height: var(--topbar-height);
}
.sidebar-brand:hover { color: #fff; }
.sidebar-brand .brand-icon {
  width: 36px; height: 36px;
  background: rgba(255,255,255,.15);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
}
.sidebar .nav {
  flex: 1;
  padding: 12px 0;
}
.sidebar .nav-section {
  padding: 8px 20px 4px;
  font-size: .65rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: rgba(255,255,255,.35);
}
.sidebar .nav-item { margin: 1px 10px; border-radius: var(--radius-sm); }
.sidebar .nav-link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  color: rgba(255,255,255,.7);
  border-radius: var(--radius-sm);
  font-size: .85rem;
  font-weight: 500;
  transition: all .15s ease;
  text-decoration: none;
}
.sidebar .nav-link:hover {
  background: rgba(255,255,255,.1);
  color: #fff;
}
.sidebar .nav-link.active {
  background: rgba(255,255,255,.15);
  color: #fff;
  font-weight: 600;
}
.sidebar .nav-link i { width: 20px; text-align: center; font-size: 1rem; }
.sidebar-footer {
  padding: 14px 20px;
  border-top: 1px solid rgba(255,255,255,.08);
}
.sidebar-footer .user-info {
  display: flex;
  align-items: center;
  gap: 10px;
  color: rgba(255,255,255,.8);
  font-size: .8rem;
}

/* ========== TOPBAR ========== */
.topbar {
  position: fixed;
  top: 0;
  left: var(--sidebar-width);
  right: 0;
  height: var(--topbar-height);
  background: #fff;
  border-bottom: 1px solid var(--border-color);
  z-index: 1030;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  box-shadow: var(--shadow-sm);
}
.topbar-left {
  display: flex;
  align-items: center;
  gap: 16px;
}
.topbar-left .page-title {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-dark);
  margin: 0;
}
.topbar-right {
  display: flex;
  align-items: center;
  gap: 12px;
}
.topbar-right .dropdown-toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  text-decoration: none;
  color: var(--text-dark);
  font-size: .85rem;
  background: transparent;
  border: none;
  cursor: pointer;
}
.topbar-right .dropdown-toggle:hover { background: var(--bg-body); }
.topbar-right .avatar {
  width: 32px; height: 32px;
  background: var(--primary);
  color: #fff;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: .8rem;
}
.sidebar-toggle {
  display: none;
  background: none;
  border: none;
  font-size: 1.3rem;
  color: var(--text-dark);
  cursor: pointer;
  padding: 4px;
}

/* ========== MAIN CONTENT ========== */
.main-content {
  margin-left: var(--sidebar-width);
  padding-top: calc(var(--topbar-height) + 16px);
  padding-left: 24px;
  padding-right: 24px;
  padding-bottom: 24px;
  min-height: 100vh;
}

/* ========== CARDS ========== */
.card {
  background: var(--bg-card);
  border: none;
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  transition: box-shadow .2s;
}
.card:hover { box-shadow: var(--shadow-md); }
.card-header {
  background: transparent;
  border-bottom: 1px solid var(--border-color);
  padding: 14px 20px;
  font-weight: 600;
  font-size: .9rem;
  border-radius: var(--radius) var(--radius) 0 0 !important;
}
.card-body { padding: 20px; }

/* Stats / Metric cards */
.stat-card {
  border-radius: var(--radius);
  padding: 20px;
  position: relative;
  overflow: hidden;
  border: none;
}
.stat-card .stat-icon {
  position: absolute;
  right: 16px;
  top: 16px;
  font-size: 2.5rem;
  opacity: .15;
}
.stat-card .stat-label {
  font-size: .8rem;
  font-weight: 500;
  color: rgba(255,255,255,.8);
  margin-bottom: 4px;
}
.stat-card .stat-value {
  font-size: 1.75rem;
  font-weight: 700;
  color: #fff;
}
.stat-card .stat-footer {
  font-size: .75rem;
  color: rgba(255,255,255,.7);
  margin-top: 8px;
}
.stat-card.primary { background: linear-gradient(135deg, var(--primary), var(--primary-light)); }
.stat-card.success { background: linear-gradient(135deg, #059669, #10b981); }
.stat-card.warning { background: linear-gradient(135deg, #d97706, #f59e0b); }
.stat-card.danger { background: linear-gradient(135deg, #dc2626, #ef4444); }
.stat-card.info { background: linear-gradient(135deg, #0284c7, #38bdf8); }
.stat-card.dark { background: linear-gradient(135deg, #334155, #475569); }

/* ========== TABLES ========== */
.table-container {
  background: #fff;
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}
.table-container .table-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
}
.table-container .table-header h5 { margin: 0; font-weight: 600; }
.table {
  margin: 0;
  font-size: .85rem;
}
.table thead th {
  background: #f8fafc;
  border-bottom: 2px solid var(--border-color);
  color: var(--text-muted);
  font-weight: 600;
  font-size: .75rem;
  text-transform: uppercase;
  letter-spacing: .04em;
  padding: 12px 16px;
  white-space: nowrap;
}
.table tbody td {
  padding: 12px 16px;
  vertical-align: middle;
  border-color: var(--border-color);
}
.table tbody tr:hover { background: #f8fafc; }
.table tbody tr:last-child td { border-bottom: none; }

/* ========== BADGES ========== */
.badge {
  font-weight: 500;
  padding: 4px 10px;
  border-radius: 20px;
  font-size: .75rem;
}
.badge-undertrial { background: #dbeafe; color: #1d4ed8; }
.badge-convict { background: #fee2e2; color: #b91c1c; }
.badge-bari { background: #d1fae5; color: #065f46; }
.badge-released { background: #fef3c7; color: #92400e; }

/* ========== FORMS ========== */
.form-label { font-weight: 500; font-size: .8rem; color: var(--text-muted); margin-bottom: 4px; }
.form-control, .form-select {
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-color);
  padding: 8px 14px;
  font-size: .875rem;
  transition: border-color .15s, box-shadow .15s;
}
.form-control:focus, .form-select:focus {
  border-color: var(--primary-light);
  box-shadow: 0 0 0 3px rgba(30, 58, 95, .1);
}
.form-control-sm { padding: 6px 10px; font-size: .8rem; }

/* ========== BUTTONS ========== */
.btn {
  border-radius: var(--radius-sm);
  font-weight: 500;
  font-size: .85rem;
  padding: 8px 18px;
  transition: all .15s;
}
.btn-primary { background: var(--primary); border-color: var(--primary); }
.btn-primary:hover { background: var(--primary-light); border-color: var(--primary-light); }
.btn-outline-primary { color: var(--primary); border-color: var(--primary); }
.btn-outline-primary:hover { background: var(--primary); border-color: var(--primary); }
.btn-sm { padding: 5px 12px; font-size: .8rem; }
.btn-icon { padding: 6px 10px; }

/* ========== LOGIN PAGE ========== */
.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--primary-dark), var(--primary), var(--primary-light));
  padding: 20px;
}
.login-card {
  width: 100%;
  max-width: 420px;
  background: #fff;
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
}
.login-card .login-header {
  padding: 32px 32px 0;
  text-align: center;
}
.login-card .login-header .icon {
  width: 64px; height: 64px;
  background: linear-gradient(135deg, var(--primary), var(--primary-light));
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 16px;
  font-size: 1.5rem;
  color: #fff;
}
.login-card .login-header h4 { font-weight: 700; color: var(--text-dark); }
.login-card .login-header p { color: var(--text-muted); font-size: .85rem; }
.login-card .login-body { padding: 24px 32px 32px; }

/* ========== UTILITY ========== */
.text-primary { color: var(--primary) !important; }
.bg-primary { background-color: var(--primary) !important; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }

/* ========== RESPONSIVE ========== */
@media (max-width: 767.98px) {
  .sidebar {
    transform: translateX(-100%);
  }
  .sidebar.show { transform: translateX(0); }
  .sidebar-toggle { display: block; }
  .topbar { left: 0; }
  .main-content { margin-left: 0; padding-left: 16px; padding-right: 16px; }
  .sidebar-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.4);
    z-index: 1035;
    display: none;
  }
  .sidebar-overlay.show { display: block; }
}
@media (min-width: 768px) and (max-width: 991.98px) {
  .main-content { padding-left: 20px; padding-right: 20px; }
}

/* ========== ANIMATIONS ========== */
@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}
.animate-in { animation: fadeInUp .3s ease forwards; }
.animate-in-delay-1 { animation-delay: .05s; }
.animate-in-delay-2 { animation-delay: .1s; }

/* ========== TIMELINE (view.php status logs) ========== */
.timeline { position: relative; padding-left: 24px; }
.timeline::before {
  content: '';
  position: absolute;
  left: 7px;
  top: 4px;
  bottom: 4px;
  width: 2px;
  background: var(--border-color);
}
.timeline-item {
  position: relative;
  margin-bottom: 16px;
  padding-left: 16px;
}
.timeline-item::before {
  content: '';
  position: absolute;
  left: -20px;
  top: 6px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--primary);
  border: 2px solid #fff;
  box-shadow: 0 0 0 2px var(--primary);
}
.timeline-item .time { font-size: .75rem; color: var(--text-muted); }

/* ========== MISC ========== */
.alert { border-radius: var(--radius-sm); border: none; }
.dropdown-menu { border: none; border-radius: var(--radius-sm); box-shadow: var(--shadow-md); }
.pagination .page-link { border-radius: var(--radius-sm) !important; margin: 0 2px; }
.modal-content { border: none; border-radius: var(--radius); }
.modal-header { border-bottom: 1px solid var(--border-color); }
pre { background: #1e293b; color: #e2e8f0; padding: 16px; border-radius: var(--radius-sm); }
