/* ============================================================
   EDCL MD Command Center — Main Stylesheet
   Professional Government Office Dashboard Design
   ============================================================ */

:root {
  --primary:       #1a3a5c;   /* Navy blue - government */
  --primary-light: #2563a8;
  --secondary:     #0d6efd;
  --success:       #198754;
  --warning:       #ffc107;
  --danger:        #dc3545;
  --info:          #0dcaf0;
  --light:         #f8f9fa;
  --dark:          #212529;
  --sidebar-width: 260px;
  --topbar-height: 60px;
  --border-radius: 8px;
  --shadow:        0 2px 12px rgba(0,0,0,.10);
  --shadow-sm:     0 1px 4px rgba(0,0,0,.07);
}

/* ── Base ──────────────────────────────────────────── */
* { box-sizing: border-box; }

body {
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  background: #eef2f7;
  color: #333;
  font-size: 14px;
}

a { color: var(--primary-light); text-decoration: none; }
a:hover { color: var(--primary); }

/* ── Layout ────────────────────────────────────────── */
.page-wrapper {
  display: flex;
  min-height: 100vh;
}

/* ── Sidebar ───────────────────────────────────────── */
.sidebar {
  width: var(--sidebar-width);
  background: var(--primary);
  color: #fff;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  z-index: 1000;
  overflow-y: auto;
  transition: transform .25s ease;
  display: flex;
  flex-direction: column;
}

.sidebar-brand {
  padding: 16px 20px;
  border-bottom: 1px solid rgba(255,255,255,.12);
  background: rgba(0,0,0,.2);
}

.sidebar-brand .brand-title {
  font-size: 15px;
  font-weight: 700;
  color: #fff;
  line-height: 1.3;
}

.sidebar-brand .brand-sub {
  font-size: 11px;
  color: rgba(255,255,255,.65);
  text-transform: uppercase;
  letter-spacing: .5px;
}

.sidebar-menu {
  padding: 8px 0;
  flex: 1;
}

.sidebar-section-title {
  padding: 12px 20px 4px;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: rgba(255,255,255,.45);
}

.sidebar-menu .nav-link {
  display: flex;
  align-items: center;
  padding: 9px 20px;
  color: rgba(255,255,255,.8);
  font-size: 13.5px;
  border-left: 3px solid transparent;
  transition: all .15s;
  gap: 10px;
}

.sidebar-menu .nav-link:hover {
  background: rgba(255,255,255,.1);
  color: #fff;
  border-left-color: rgba(255,255,255,.5);
}

.sidebar-menu .nav-link.active {
  background: rgba(255,255,255,.15);
  color: #fff;
  border-left-color: #fff;
  font-weight: 600;
}

.sidebar-menu .nav-link i {
  width: 18px;
  text-align: center;
  font-size: 14px;
  opacity: .85;
}

.sidebar-footer {
  padding: 12px 20px;
  border-top: 1px solid rgba(255,255,255,.12);
  font-size: 12px;
  color: rgba(255,255,255,.5);
}

/* ── Main Content ──────────────────────────────────── */
.main-content {
  margin-left: var(--sidebar-width);
  flex: 1;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ── Top Bar ───────────────────────────────────────── */
.topbar {
  height: var(--topbar-height);
  background: #fff;
  border-bottom: 1px solid #dee2e6;
  display: flex;
  align-items: center;
  padding: 0 24px;
  position: sticky;
  top: 0;
  z-index: 900;
  box-shadow: var(--shadow-sm);
  gap: 12px;
}

.topbar-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--primary);
  flex: 1;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.notif-bell {
  position: relative;
  color: #666;
  font-size: 18px;
}

.notif-badge {
  position: absolute;
  top: -5px; right: -5px;
  background: var(--danger);
  color: #fff;
  font-size: 10px;
  width: 18px; height: 18px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700;
}

.user-info {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: #444;
}

.user-avatar {
  width: 34px; height: 34px;
  background: var(--primary);
  color: #fff;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700;
  font-size: 13px;
}

/* ── Page Content ──────────────────────────────────── */
.content-area {
  padding: 24px;
  flex: 1;
}

.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
  flex-wrap: wrap;
  gap: 10px;
}

.page-header h1 {
  font-size: 22px;
  font-weight: 700;
  color: var(--primary);
  margin: 0;
}

/* ── Status Cards ──────────────────────────────────── */
.stat-card {
  background: #fff;
  border-radius: var(--border-radius);
  padding: 20px;
  box-shadow: var(--shadow-sm);
  border-left: 4px solid transparent;
  transition: transform .15s, box-shadow .15s;
}

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

.stat-card.card-primary   { border-left-color: var(--primary-light); }
.stat-card.card-success   { border-left-color: var(--success); }
.stat-card.card-warning   { border-left-color: var(--warning); }
.stat-card.card-danger    { border-left-color: var(--danger); }
.stat-card.card-info      { border-left-color: var(--info); }
.stat-card.card-secondary { border-left-color: #6c757d; }

.stat-card .stat-value {
  font-size: 32px;
  font-weight: 800;
  line-height: 1.1;
  color: var(--primary);
}

.stat-card .stat-label {
  font-size: 12px;
  color: #888;
  text-transform: uppercase;
  letter-spacing: .5px;
  margin-top: 4px;
}

.stat-card .stat-icon {
  font-size: 28px;
  opacity: .15;
  float: right;
  margin-top: -8px;
}

/* ── Content Cards ─────────────────────────────────── */
.card {
  border: none;
  border-radius: var(--border-radius);
  box-shadow: var(--shadow-sm);
}

.card-header {
  background: #fff;
  border-bottom: 1px solid #eee;
  font-weight: 600;
  color: var(--primary);
  padding: 14px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.card-body { padding: 18px; }

/* ── Status Badges ─────────────────────────────────── */
.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .3px;
}

.status-green  { background: #d1fae5; color: #065f46; }
.status-yellow { background: #fef9c3; color: #854d0e; }
.status-red    { background: #fee2e2; color: #991b1b; }
.status-none   { background: #f3f4f6; color: #6b7280; }

.status-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  display: inline-block;
}
.dot-green  { background: #22c55e; }
.dot-yellow { background: #eab308; }
.dot-red    { background: #ef4444; animation: pulse-red 1.5s infinite; }
.dot-none   { background: #9ca3af; }

@keyframes pulse-red {
  0%, 100% { opacity: 1; }
  50%       { opacity: .4; }
}

/* ── Priority Badges ───────────────────────────────── */
.priority-low      { background: #f0fdf4; color: #166534; border: 1px solid #bbf7d0; }
.priority-medium   { background: #fffbeb; color: #92400e; border: 1px solid #fde68a; }
.priority-high     { background: #fff7ed; color: #9a3412; border: 1px solid #fed7aa; }
.priority-critical { background: #fef2f2; color: #7f1d1d; border: 1px solid #fecaca; }

.priority-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .5px;
}

/* ── Tables ────────────────────────────────────────── */
.table-card {
  background: #fff;
  border-radius: var(--border-radius);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}

.table { margin: 0; font-size: 13.5px; }
.table th {
  background: #f8fafc;
  color: #555;
  font-weight: 600;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: .4px;
  border-bottom: 2px solid #e9ecef;
  padding: 10px 14px;
  white-space: nowrap;
}

.table td {
  padding: 10px 14px;
  vertical-align: middle;
  border-color: #f0f2f5;
}

.table-hover tbody tr:hover {
  background: #f8fafd;
}

.table-striped tbody tr:nth-of-type(odd) {
  background: #fafbfc;
}

/* ── Forms ─────────────────────────────────────────── */
.form-card {
  background: #fff;
  border-radius: var(--border-radius);
  box-shadow: var(--shadow-sm);
  padding: 28px;
}

.form-label {
  font-weight: 600;
  font-size: 13px;
  color: #444;
  margin-bottom: 5px;
}

.form-control, .form-select {
  border-radius: 6px;
  border-color: #d1d5db;
  font-size: 13.5px;
  padding: 8px 12px;
}

.form-control:focus, .form-select:focus {
  border-color: var(--primary-light);
  box-shadow: 0 0 0 3px rgba(37,99,168,.15);
}

/* ── Buttons ───────────────────────────────────────── */
.btn {
  border-radius: 6px;
  font-size: 13.5px;
  font-weight: 500;
  padding: 7px 16px;
}

.btn-primary {
  background: var(--primary);
  border-color: var(--primary);
}
.btn-primary:hover {
  background: var(--primary-light);
  border-color: var(--primary-light);
}

/* ── Alerts / Messages ─────────────────────────────── */
.alert {
  border-radius: 6px;
  border: none;
  font-size: 13.5px;
}

/* ── Progress bar ──────────────────────────────────── */
.progress {
  height: 8px;
  border-radius: 4px;
  background: #e9ecef;
}

/* ── Login Page ────────────────────────────────────── */
.login-wrapper {
  min-height: 100vh;
  background: linear-gradient(135deg, #1a3a5c 0%, #2563a8 60%, #0d6efd 100%);
  display: flex;
  align-items: center;
  justify-content: center;
}

.login-card {
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 20px 60px rgba(0,0,0,.3);
  padding: 40px 36px;
  width: 100%;
  max-width: 420px;
}

.login-logo {
  text-align: center;
  margin-bottom: 28px;
}

.login-logo .logo-circle {
  width: 70px; height: 70px;
  background: var(--primary);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  margin: 0 auto 12px;
  font-size: 28px;
  color: #fff;
}

.login-logo h2 {
  color: var(--primary);
  font-size: 20px;
  font-weight: 800;
  margin: 0;
}

.login-logo p {
  color: #888;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 1px;
}

/* ── Notification Bell Animation ───────────────────── */
.bell-animate { animation: bell-ring .5s ease-in-out; }

@keyframes bell-ring {
  0%  { transform: rotate(0); }
  25% { transform: rotate(15deg); }
  50% { transform: rotate(-15deg); }
  75% { transform: rotate(8deg); }
  100%{ transform: rotate(0); }
}

/* ── Filter Bar ────────────────────────────────────── */
.filter-bar {
  background: #fff;
  border-radius: var(--border-radius);
  padding: 14px 18px;
  margin-bottom: 16px;
  box-shadow: var(--shadow-sm);
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: flex-end;
}

/* ── Chart containers ──────────────────────────────── */
.chart-container {
  position: relative;
  height: 260px;
}

/* ── Overdue highlight ─────────────────────────────── */
.overdue-row { background: #fff5f5 !important; }
.overdue-row td { color: #991b1b; }

/* ── Mobile sidebar toggle ─────────────────────────── */
.sidebar-toggle {
  display: none;
  background: none;
  border: none;
  font-size: 20px;
  color: var(--primary);
  cursor: pointer;
  padding: 4px 8px;
}

/* ── Responsive ────────────────────────────────────── */
@media (max-width: 991px) {
  .sidebar {
    transform: translateX(-100%);
  }
  .sidebar.open {
    transform: translateX(0);
  }
  .main-content {
    margin-left: 0;
  }
  .sidebar-toggle {
    display: block;
  }
  .content-area {
    padding: 16px;
  }
}

@media (max-width: 576px) {
  .stat-card .stat-value { font-size: 24px; }
  .page-header h1 { font-size: 18px; }
}

/* ── Misc ──────────────────────────────────────────── */
.empty-state {
  text-align: center;
  padding: 48px 24px;
  color: #aaa;
}
.empty-state i { font-size: 48px; display: block; margin-bottom: 12px; }

.breadcrumb { font-size: 12.5px; }
.breadcrumb-item + .breadcrumb-item::before { color: #aaa; }

.text-truncate-2 {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.dept-status-row td { vertical-align: middle; }

.sidebar-overlay {
  display: none;
  position: fixed; inset: 0;
  background: rgba(0,0,0,.4);
  z-index: 999;
}
.sidebar-overlay.show { display: block; }
