/* ================================================
   Escalation Tracking System - Global Styles
   Theme: Dark Blue #1E3A8A | Accent Orange #F97316
   Font: Inter (Google Fonts)
   ================================================ */

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

:root {
  --primary:       #1E3A8A;
  --primary-dark:  #152A6B;
  --primary-light: #2d53c8;
  --accent:        #F97316;
  --accent-dark:   #ea6c0a;
  --success:       #16a34a;
  --danger:        #dc2626;
  --warning:       #d97706;
  --info:          #0284c7;
  --sidebar-width: 240px;
  --sidebar-collapsed-width: 66px;
  --topbar-height: 60px;
  --text-main:     #1e293b;
  --text-muted:    #64748b;
  --bg-body:       #f1f5f9;
  --bg-card:       #ffffff;
  --border-color:  #e2e8f0;
}

* { box-sizing: border-box; }

body {
  font-family: 'Inter', sans-serif;
  background-color: var(--bg-body);
  color: var(--text-main);
  margin: 0;
  font-size: 0.9rem;
}

/* ========== SIDEBAR ========== */
.sidebar {
  position: fixed;
  top: 0; left: 0;
  height: 100vh;
  width: var(--sidebar-width);
  background: var(--primary);
  display: flex;
  flex-direction: column;
  z-index: 1000;
  transition: width 0.25s ease;
  overflow: hidden;
}
.sidebar.collapsed { width: var(--sidebar-collapsed-width); }

.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 18px 16px;
  height: var(--topbar-height);
  border-bottom: 1px solid rgba(255,255,255,0.08);
  white-space: nowrap;
  overflow: hidden;
  text-decoration: none;
}
.sidebar-logo .logo-icon {
  font-size: 1.5rem;
  color: var(--accent);
  flex-shrink: 0;
}
.sidebar-logo .logo-text {
  font-weight: 700;
  font-size: 0.95rem;
  color: #fff;
  line-height: 1.2;
}
.sidebar-logo .logo-sub {
  font-size: 0.7rem;
  color: rgba(255,255,255,0.55);
  font-weight: 400;
}

.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 10px 0;
  scrollbar-width: none;
}
.sidebar-nav::-webkit-scrollbar { display: none; }

.nav-section-label {
  font-size: 0.65rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: rgba(255,255,255,0.4);
  padding: 12px 20px 4px;
  white-space: nowrap;
  overflow: hidden;
}
.sidebar.collapsed .nav-section-label { opacity: 0; }

.sidebar-link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 18px;
  color: rgba(255,255,255,0.75);
  text-decoration: none;
  font-size: 0.875rem;
  font-weight: 500;
  border-radius: 0;
  transition: background 0.15s, color 0.15s;
  white-space: nowrap;
  position: relative;
}
.sidebar-link i {
  font-size: 1.1rem;
  flex-shrink: 0;
  width: 22px;
  text-align: center;
}
.sidebar-link:hover {
  background: rgba(255,255,255,0.08);
  color: #fff;
}
.sidebar-link.active {
  background: rgba(255,255,255,0.12);
  color: #fff;
  border-right: 3px solid var(--accent);
}
.sidebar-link .link-text { overflow: hidden; }
.sidebar.collapsed .link-text,
.sidebar.collapsed .badge  { display: none; }

/* Tooltip for collapsed sidebar */
.sidebar.collapsed .sidebar-link::after {
  content: attr(data-tooltip);
  position: absolute;
  left: 100%;
  top: 50%;
  transform: translateY(-50%);
  background: var(--primary-dark);
  color: #fff;
  padding: 5px 10px;
  border-radius: 6px;
  font-size: 0.78rem;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.15s;
  margin-left: 8px;
  z-index: 999;
}
.sidebar.collapsed .sidebar-link:hover::after { opacity: 1; }

.sidebar-footer {
  padding: 12px 0;
  border-top: 1px solid rgba(255,255,255,0.08);
}

/* ========== MAIN WRAPPER ========== */
.main-wrapper {
  margin-left: var(--sidebar-width);
  min-height: 100vh;
  transition: margin-left 0.25s ease;
  display: flex;
  flex-direction: column;
}
.main-wrapper.expanded { margin-left: var(--sidebar-collapsed-width); }

/* ========== TOP BAR ========== */
.topbar {
  height: var(--topbar-height);
  background: #fff;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 1px 4px rgba(0,0,0,0.06);
}
.topbar-left { display: flex; align-items: center; gap: 14px; }
.topbar-right { display: flex; align-items: center; gap: 14px; }

.sidebar-toggle-btn {
  background: none;
  border: none;
  font-size: 1.3rem;
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 6px;
  transition: background 0.15s;
}
.sidebar-toggle-btn:hover { background: var(--bg-body); }

.topbar-page-title {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-main);
}

.topbar-icon-btn {
  position: relative;
  background: var(--bg-body);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  width: 36px; height: 36px;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  font-size: 1rem;
  color: var(--text-muted);
  transition: background 0.15s;
  text-decoration: none;
}
.topbar-icon-btn:hover { background: var(--border-color); color: var(--text-main); }
.topbar-icon-btn .notif-badge {
  position: absolute;
  top: -4px; right: -4px;
  background: var(--danger);
  color: #fff;
  font-size: 0.6rem;
  width: 16px; height: 16px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700;
}

.user-avatar-btn {
  display: flex; align-items: center; gap: 8px;
  background: none; border: none; cursor: pointer;
  padding: 4px 8px; border-radius: 8px;
  transition: background 0.15s;
}
.user-avatar-btn:hover { background: var(--bg-body); }
.user-avatar {
  width: 32px; height: 32px; border-radius: 50%;
  background: var(--primary);
  color: #fff; font-weight: 700; font-size: 0.8rem;
  display: flex; align-items: center; justify-content: center;
}
.user-avatar-name { font-size: 0.85rem; font-weight: 600; color: var(--text-main); }
.user-avatar-role { font-size: 0.7rem; color: var(--text-muted); }

/* ========== PAGE CONTENT ========== */
.page-content { flex: 1; padding: 24px; }

/* ========== KPI CARDS ========== */
.kpi-card {
  background: var(--bg-card);
  border-radius: 16px;
  padding: 16px 20px;
  display: flex; 
  align-items: center; 
  gap: 16px;
  box-shadow: 0 4px 6px -1px rgba(0,0,0,0.1), 0 2px 4px -1px rgba(0,0,0,0.06);
  transition: all 0.2s ease-in-out;
  cursor: pointer;
  border: 1px solid var(--border-color);
  text-decoration: none;
  color: inherit;
  position: relative;
  overflow: hidden;
}
.kpi-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; width: 100%; height: 4px;
  opacity: 0.8;
}
.kpi-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 10px 15px -3px rgba(0,0,0,0.1), 0 4px 6px -2px rgba(0,0,0,0.05);
  border-color: rgba(0,0,0,0.1);
}
.kpi-icon {
  width: 44px; height: 44px; border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.4rem; flex-shrink: 0;
}
.kpi-info { flex: 1; display: flex; flex-direction: column; }
.kpi-value { font-size: 1.6rem; font-weight: 800; line-height: 1; letter-spacing: -0.02em; }
.kpi-label { font-size: 0.7rem; color: var(--text-muted); font-weight: 600; text-transform: uppercase; letter-spacing: 0.03em; margin-top: 4px; }

.kpi-red::before    { background: var(--danger); }
.kpi-orange::before { background: var(--accent); }
.kpi-green::before  { background: var(--success); }
.kpi-blue::before   { background: var(--info); }
.kpi-purple::before { background: #7c3aed; }
.kpi-teal::before   { background: #0d9488; }

.kpi-red    .kpi-icon { background: #fef2f2; color: var(--danger); }
.kpi-orange .kpi-icon { background: #fff7ed; color: var(--accent); }
.kpi-green  .kpi-icon { background: #f0fdf4; color: var(--success); }
.kpi-blue   .kpi-icon { background: #f0f9ff; color: var(--info); }
.kpi-purple .kpi-icon { background: #f5f3ff; color: #7c3aed; }
.kpi-teal   .kpi-icon { background: #f0fdfa; color: #0d9488; }

/* ========== CARDS ========== */
.content-card {
  background: var(--bg-card);
  border-radius: 12px;
  border: 1px solid var(--border-color);
  box-shadow: 0 1px 4px rgba(0,0,0,0.05);
  overflow: hidden;
}
.content-card .card-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border-color);
}
.content-card .card-title {
  font-size: 0.9rem; font-weight: 700;
  color: var(--text-main); display: flex; align-items: center; gap: 8px;
}
.content-card .card-title i { color: var(--primary); }
.content-card .card-body-inner { padding: 20px; }

/* ========== TABLES ========== */
.data-table { width: 100%; border-collapse: collapse; font-size: 0.875rem; }
.data-table thead th {
  background: #f8fafc;
  color: var(--text-muted);
  font-weight: 600;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 12px 16px;
  border-bottom: 2px solid var(--border-color);
  white-space: nowrap;
}
.data-table tbody td {
  padding: 12px 16px;
  border-bottom: 1px solid #f1f5f9;
  vertical-align: middle;
}
.data-table tbody tr:hover { background: #f8fafc; }
.data-table tbody tr:last-child td { border-bottom: none; }
.data-table tbody tr.row-overdue { background: #fff5f5; }
.data-table tbody tr.row-overdue:hover { background: #fee2e2; }

/* ========== BADGES ========== */
.status-badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 3px 10px; border-radius: 20px;
  font-size: 0.72rem; font-weight: 600;
}
.status-open     { background: #fee2e2; color: #b91c1c; }
.status-closed   { background: #dcfce7; color: #15803d; }
.status-progress { background: #dbeafe; color: #1d4ed8; }
.status-waiting  { background: #ffedd5; color: #c2410c; }

.priority-high   { background: #fee2e2; color: #b91c1c; }
.priority-medium { background: #ffedd5; color: #c2410c; }
.priority-low    { background: #d1fae5; color: #065f46; }

/* ========== QUICK ACTIONS ========== */
.quick-actions { display: flex; gap: 4px; opacity: 0; transition: opacity 0.15s; }
.data-table tbody tr:hover .quick-actions { opacity: 1; }
.action-btn {
  background: var(--bg-body); border: 1px solid var(--border-color);
  border-radius: 6px; width: 30px; height: 30px;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; font-size: 0.8rem; color: var(--text-muted);
  text-decoration: none; transition: all 0.15s;
}
.action-btn:hover { background: var(--primary); color: #fff; border-color: var(--primary); }
.action-btn.danger:hover { background: var(--danger); border-color: var(--danger); color: #fff; }
.action-btn.success:hover { background: var(--success); border-color: var(--success); color: #fff; }

/* ========== FILTER BAR ========== */
.filter-bar {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 10px;
  padding: 14px 20px;
  display: flex; flex-wrap: wrap; align-items: center; gap: 10px;
}
.filter-bar .form-select,
.filter-bar .form-control {
  font-size: 0.82rem;
  height: 36px;
  border-color: var(--border-color);
  border-radius: 8px;
}
.filter-bar .form-select:focus,
.filter-bar .form-control:focus {
  box-shadow: 0 0 0 3px rgba(30,58,138,0.1);
  border-color: var(--primary);
}

/* ========== BUTTONS ========== */
.btn-primary-custom {
  background: var(--primary); color: #fff;
  border: none; border-radius: 8px; padding: 8px 18px;
  font-size: 0.85rem; font-weight: 600;
  display: inline-flex; align-items: center; gap: 6px;
  cursor: pointer; transition: background 0.15s;
  text-decoration: none;
}
.btn-primary-custom:hover { background: var(--primary-dark); color: #fff; }
.btn-accent-custom {
  background: var(--accent); color: #fff;
  border: none; border-radius: 8px; padding: 8px 18px;
  font-size: 0.85rem; font-weight: 600;
  display: inline-flex; align-items: center; gap: 6px;
  cursor: pointer; transition: background 0.15s;
  text-decoration: none;
}
.btn-accent-custom:hover { background: var(--accent-dark); color: #fff; }

/* ========== ACTIVITY FEED ========== */
.activity-feed { display: flex; flex-direction: column; }
.activity-item {
  display: flex; gap: 12px;
  padding: 12px 0; border-bottom: 1px solid #f1f5f9;
}
.activity-item:last-child { border-bottom: none; }
.activity-dot {
  width: 32px; height: 32px; border-radius: 50%;
  background: #dbeafe; color: var(--info);
  display: flex; align-items: center; justify-content: center;
  font-size: 0.8rem; flex-shrink: 0; margin-top: 2px;
}
.activity-text { font-size: 0.83rem; line-height: 1.5; }
.activity-time { font-size: 0.72rem; color: var(--text-muted); margin-top: 2px; }

/* ========== LOGIN PAGE ========== */
.login-wrapper {
  min-height: 100vh;
  display: flex;
}
.login-branding {
  background: var(--primary);
  flex: 0 0 45%;
  display: flex; flex-direction: column;
  justify-content: center; align-items: center;
  padding: 40px;
  text-align: center;
  position: relative;
  overflow: hidden;
}
.login-branding::before {
  content: '';
  position: absolute;
  width: 400px; height: 400px;
  background: rgba(255,255,255,0.04);
  border-radius: 50%;
  top: -100px; right: -100px;
}
.login-branding::after {
  content: '';
  position: absolute;
  width: 300px; height: 300px;
  background: rgba(249,115,22,0.12);
  border-radius: 50%;
  bottom: -80px; left: -80px;
}
.login-form-panel {
  flex: 1;
  display: flex; flex-direction: column;
  justify-content: center; align-items: center;
  padding: 48px;
  background: #fff;
}
.login-card {
  width: 100%; max-width: 400px;
}

/* ========== CHART CONTAINERS ========== */
.chart-container { position: relative; }
.chart-container canvas { width: 100% !important; }

/* ========== ALERTS ========== */
.page-alert {
  border-radius: 10px;
  padding: 12px 16px;
  font-size: 0.85rem;
  display: flex; align-items: center; gap: 10px;
  margin-bottom: 20px;
}
.page-alert-success { background: #dcfce7; color: #15803d; border: 1px solid #bbf7d0; }
.page-alert-error   { background: #fee2e2; color: #b91c1c; border: 1px solid #fecaca; }
.page-alert-warning { background: #fffbeb; color: #92400e; border: 1px solid #fde68a; }

/* ========== MODALS ========== */
.modal-content { border-radius: 14px; border: none; box-shadow: 0 20px 60px rgba(0,0,0,0.18); }
.modal-header { border-bottom: 1px solid var(--border-color); padding: 18px 24px; }
.modal-footer { border-top: 1px solid var(--border-color); padding: 14px 24px; }
.modal-body   { padding: 24px; }

/* ========== RESPONSIVE ========== */
@media (max-width: 992px) {
  .sidebar { width: var(--sidebar-collapsed-width); }
  .sidebar .link-text,
  .sidebar .nav-section-label,
  .sidebar .badge { display: none; }
  .main-wrapper { margin-left: var(--sidebar-collapsed-width); }

  .login-branding { display: none; }
  .login-form-panel { padding: 24px; }

  .page-content { padding: 16px; }
}

@media (max-width: 576px) {
  .filter-bar { flex-direction: column; }
  .filter-bar > * { width: 100% !important; }
  .kpi-value { font-size: 1.4rem; }

  .sidebar { transform: translateX(-100%); }
  .sidebar.mobile-open { transform: translateX(0); width: var(--sidebar-width); }
  .sidebar.mobile-open .link-text,
  .sidebar.mobile-open .nav-section-label { display: block; }
  .main-wrapper { margin-left: 0; }
}

/* ========== PRINT ========== */
@media print {
  .sidebar, .topbar, .filter-bar .btn, .quick-actions,
  .modal, .action-btn { display: none !important; }
  .main-wrapper { margin-left: 0; }
  .page-content { padding: 0; }
}
