/* ═══════════════════════════════════════════════════════════════
   Performance Cards Management System - Global Styles
   ═══════════════════════════════════════════════════════════════ */

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

/* ─── CSS Variables ─────────────────────────────────────── */
:root {
  --font-main: 'Outfit', sans-serif;
  --font-mono: 'Space Mono', monospace;
  --radius: 16px;
  --radius-sm: 10px;
  --shadow: 0 4px 24px rgba(0,0,0,0.08);
  --shadow-lg: 0 12px 48px rgba(0,0,0,0.14);
  --transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Admin Theme */
.theme-admin {
  --primary: #6C3FE8;
  --primary-dark: #4F2CB0;
  --primary-light: #EEE9FF;
  --accent: #FF6B6B;
  --sidebar-bg: #0F0A2A;
  --sidebar-text: rgba(255,255,255,0.75);
  --sidebar-active: rgba(108, 63, 232, 0.3);
  --topbar-bg: #ffffff;
  --body-bg: #F4F2FF;
  --card-bg: #ffffff;
  --text-primary: #1A1033;
  --text-secondary: #6B6888;
  --border: rgba(108, 63, 232, 0.15);
}

/* Sub-Admin Theme */
.theme-subadmin {
  --primary: #0EA5E9;
  --primary-dark: #0369A1;
  --primary-light: #E0F2FE;
  --accent: #F59E0B;
  --sidebar-bg: #0A192F;
  --sidebar-text: rgba(255,255,255,0.75);
  --sidebar-active: rgba(14, 165, 233, 0.25);
  --topbar-bg: #ffffff;
  --body-bg: #F0F9FF;
  --card-bg: #ffffff;
  --text-primary: #0C1A2E;
  --text-secondary: #5B7A9D;
  --border: rgba(14, 165, 233, 0.15);
}

/* Employee Theme */
.theme-employee {
  --primary: #10B981;
  --primary-dark: #047857;
  --primary-light: #D1FAE5;
  --accent: #F59E0B;
  --sidebar-bg: #0A1F17;
  --sidebar-text: rgba(255,255,255,0.75);
  --sidebar-active: rgba(16, 185, 129, 0.25);
  --topbar-bg: #ffffff;
  --body-bg: #F0FDF4;
  --card-bg: #ffffff;
  --text-primary: #052E16;
  --text-secondary: #4A7B65;
  --border: rgba(16, 185, 129, 0.15);
}

/* ─── Base ──────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }
body {
  font-family: var(--font-main);
  background: var(--body-bg);
  color: var(--text-primary);
  margin: 0;
  min-height: 100vh;
  overflow-x: hidden;
}

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

/* ─── Sidebar ───────────────────────────────────────────── */
.sidebar {
  width: 260px;
  background: var(--sidebar-bg);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  z-index: 1000;
  transition: var(--transition);
  overflow-y: auto;
  overflow-x: hidden;
}

.sidebar-brand {
  padding: 24px 20px;
  display: flex;
  align-items: center;
  gap: 12px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
}

.sidebar-brand .brand-icon {
  width: 42px; height: 42px;
  border-radius: 12px;
  background: var(--primary);
  display: flex; align-items: center; justify-content: center;
  font-size: 20px;
  flex-shrink: 0;
  box-shadow: 0 4px 15px rgba(0,0,0,0.3);
}

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

.sidebar-brand .brand-sub {
  font-size: 10px;
  color: var(--primary);
  font-weight: 600;
  letter-spacing: 2px;
  text-transform: uppercase;
}

.sidebar-nav { padding: 16px 12px; flex: 1; }
.nav-label {
  font-size: 10px;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: rgba(255,255,255,0.3);
  font-weight: 600;
  padding: 16px 8px 8px;
}

.sidebar-nav .nav-link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 14px;
  border-radius: 12px;
  color: var(--sidebar-text);
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
  transition: var(--transition);
  margin-bottom: 2px;
}

.sidebar-nav .nav-link:hover,
.sidebar-nav .nav-link.active {
  background: var(--sidebar-active);
  color: #fff;
}
.sidebar-nav .nav-link.active { box-shadow: 0 2px 12px rgba(0,0,0,0.2); }

.sidebar-nav .nav-link .nav-icon {
  width: 32px; height: 32px;
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  font-size: 16px;
  background: rgba(255,255,255,0.06);
  flex-shrink: 0;
}
.sidebar-nav .nav-link.active .nav-icon,
.sidebar-nav .nav-link:hover .nav-icon {
  background: var(--primary);
}

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

.user-card {
  display: flex; align-items: center; gap: 10px;
  padding: 10px;
  border-radius: 12px;
  background: rgba(255,255,255,0.06);
}
.user-card .avatar {
  width: 36px; height: 36px;
  border-radius: 50%;
  background: var(--primary);
  display: flex; align-items: center; justify-content: center;
  font-size: 14px; color: #fff; font-weight: 700;
  flex-shrink: 0;
}
.user-card .user-info { min-width: 0; flex: 1; }
.user-card .user-name { font-size: 13px; color: #fff; font-weight: 600; truncate; }
.user-card .user-role { font-size: 10px; color: var(--primary); font-weight: 500; text-transform: uppercase; letter-spacing: 1px; }
.user-card .logout-btn { color: rgba(255,255,255,0.4); text-decoration: none; font-size: 16px; }
.user-card .logout-btn:hover { color: #FF6B6B; }

/* ─── Main Content ──────────────────────────────────────── */
.main-content {
  margin-left: 260px;
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  transition: var(--transition);
}

/* ─── Topbar ────────────────────────────────────────────── */
.topbar {
  background: var(--topbar-bg);
  border-bottom: 1px solid var(--border);
  padding: 0 28px;
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky; top: 0; z-index: 900;
  box-shadow: var(--shadow);
}

.topbar-title { font-size: 18px; font-weight: 700; color: var(--text-primary); }
.topbar-actions { display: flex; align-items: center; gap: 12px; }

.topbar .btn-icon {
  width: 40px; height: 40px;
  border-radius: 12px;
  border: 1px solid var(--border);
  display: flex; align-items: center; justify-content: center;
  background: transparent;
  color: var(--text-secondary);
  cursor: pointer;
  transition: var(--transition);
  text-decoration: none;
}
.topbar .btn-icon:hover { background: var(--primary-light); color: var(--primary); border-color: var(--primary); }

.hamburger-btn { display: none; }

/* ─── Page Content ──────────────────────────────────────── */
.page-content { padding: 28px; flex: 1; }
.page-header { margin-bottom: 28px; }
.page-header h1 { font-size: 26px; font-weight: 800; margin: 0 0 4px; }
.page-header p { color: var(--text-secondary); margin: 0; font-size: 14px; }

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

.stat-card {
  background: var(--card-bg);
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
  position: relative;
  overflow: hidden;
  transition: var(--transition);
}
.stat-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); }

.stat-card::before {
  content: '';
  position: absolute;
  top: 0; right: 0;
  width: 80px; height: 80px;
  border-radius: 0 16px 0 100%;
  opacity: 0.08;
}
.stat-card.stat-primary::before { background: var(--primary); }
.stat-card.stat-success::before { background: #10B981; }
.stat-card.stat-warning::before { background: #F59E0B; }
.stat-card.stat-danger::before  { background: #EF4444; }

.stat-icon {
  width: 48px; height: 48px;
  border-radius: 14px;
  display: flex; align-items: center; justify-content: center;
  font-size: 22px;
  margin-bottom: 16px;
}
.stat-primary .stat-icon { background: var(--primary-light); }
.stat-success .stat-icon { background: #D1FAE5; }
.stat-warning .stat-icon { background: #FEF3C7; }
.stat-danger  .stat-icon { background: #FEE2E2; }

.stat-value { font-size: 32px; font-weight: 800; line-height: 1; margin-bottom: 4px; }
.stat-label { font-size: 13px; color: var(--text-secondary); font-weight: 500; }
.stat-change { font-size: 12px; font-weight: 600; margin-top: 8px; }
.stat-change.up   { color: #10B981; }
.stat-change.down { color: #EF4444; }

/* ─── Cards (content panels) ────────────────────────────── */
.content-card {
  background: var(--card-bg);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
  overflow: hidden;
}
.content-card .card-header {
  padding: 20px 24px;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
}
.content-card .card-header h5 { margin: 0; font-size: 16px; font-weight: 700; }
.content-card .card-body { padding: 24px; }

/* ─── Performance Card Visuals ──────────────────────────── */
.perf-card {
  border-radius: 20px;
  padding: 24px;
  position: relative;
  overflow: hidden;
  color: white;
  cursor: pointer;
  transition: var(--transition);
  min-height: 160px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}
.perf-card:hover { transform: translateY(-5px) scale(1.02); box-shadow: 0 20px 60px rgba(0,0,0,0.25); }

.perf-card.gold {
  background: linear-gradient(135deg, #FFD700 0%, #FFA500 50%, #FF8C00 100%);
  box-shadow: 0 8px 32px rgba(255, 165, 0, 0.4);
  color: #4A2800;
}
.perf-card.silver {
  background: linear-gradient(135deg, #E8E8E8 0%, #C0C0C0 50%, #A0A0A0 100%);
  box-shadow: 0 8px 32px rgba(160, 160, 160, 0.4);
  color: #2C2C2C;
}
.perf-card.platinum {
  background: linear-gradient(135deg, #E8F4F8 0%, #A0BEC8 50%, #607D8B 100%);
  box-shadow: 0 8px 32px rgba(96, 125, 139, 0.4);
  color: #1A3A4A;
}

.perf-card::before {
  content: '';
  position: absolute;
  top: -30px; right: -30px;
  width: 120px; height: 120px;
  border-radius: 50%;
  background: rgba(255,255,255,0.15);
}
.perf-card::after {
  content: '';
  position: absolute;
  bottom: -40px; left: -20px;
  width: 100px; height: 100px;
  border-radius: 50%;
  background: rgba(255,255,255,0.08);
}

.perf-card .card-number {
  font-family: var(--font-mono);
  font-size: 28px;
  font-weight: 700;
  letter-spacing: 2px;
}
.perf-card .card-type-badge {
  display: inline-flex; align-items: center; gap: 4px;
  background: rgba(255,255,255,0.3);
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  backdrop-filter: blur(10px);
}
.perf-card .card-name { font-size: 16px; font-weight: 700; }
.perf-card .card-points { font-size: 13px; opacity: 0.8; }
.perf-card .card-status-pill {
  position: absolute;
  top: 14px; right: 14px;
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 1px;
  text-transform: uppercase;
}

.perf-card.disabled { opacity: 0.5; cursor: not-allowed; }
.perf-card.disabled:hover { transform: none; }

/* ─── Tables ────────────────────────────────────────────── */
.table-container { overflow-x: auto; }
table.dataTable { border-collapse: separate !important; border-spacing: 0; width: 100% !important; }
table.dataTable thead th {
  background: var(--primary-light) !important;
  color: var(--primary-dark) !important;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.5px;
  padding: 14px 16px !important;
  border: none !important;
  white-space: nowrap;
}
table.dataTable tbody td {
  padding: 14px 16px !important;
  border-bottom: 1px solid var(--border) !important;
  font-size: 14px;
  vertical-align: middle;
  border-left: none !important;
  border-right: none !important;
  border-top: none !important;
}
table.dataTable tbody tr:hover td { background: var(--primary-light) !important; }
table.dataTable tbody tr:last-child td { border-bottom: none !important; }

/* ─── Badges ────────────────────────────────────────────── */
.badge-active { background: #D1FAE5; color: #047857; }
.badge-inactive { background: #FEE2E2; color: #B91C1C; }
.badge-gold { background: #FEF3C7; color: #92400E; }
.badge-silver { background: #F1F5F9; color: #475569; }
.badge-platinum { background: #E0F2FE; color: #0369A1; }

/* ─── Buttons ───────────────────────────────────────────── */
.btn-primary-custom {
  background: var(--primary);
  color: #fff;
  border: none;
  padding: 10px 22px;
  border-radius: var(--radius-sm);
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
  transition: var(--transition);
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.btn-primary-custom:hover { background: var(--primary-dark); color: #fff; transform: translateY(-1px); box-shadow: 0 4px 15px rgba(0,0,0,0.2); }

/* ─── Forms ─────────────────────────────────────────────── */
.form-control, .form-select {
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  font-family: var(--font-main);
  font-size: 14px;
  transition: var(--transition);
  background: var(--body-bg);
}
.form-control:focus, .form-select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(108, 63, 232, 0.12);
  background: #fff;
  outline: none;
}

/* ─── Login Page ────────────────────────────────────────── */
.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  position: relative;
  overflow: hidden;
}

.login-page::before {
  content: '';
  position: fixed;
  inset: 0;
  z-index: 0;
}

.login-card {
  background: rgba(255,255,255,0.95);
  backdrop-filter: blur(20px);
  border-radius: 24px;
  padding: 40px;
  width: 100%;
  max-width: 440px;
  box-shadow: 0 24px 80px rgba(0,0,0,0.2);
  position: relative; z-index: 1;
}

.login-logo {
  width: 64px; height: 64px;
  border-radius: 18px;
  display: flex; align-items: center; justify-content: center;
  font-size: 28px;
  margin: 0 auto 20px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.2);
}

.login-card h2 { font-size: 26px; font-weight: 800; margin-bottom: 6px; text-align: center; }
.login-card .subtitle { color: #6B6888; font-size: 14px; text-align: center; margin-bottom: 32px; }

/* ─── Toasts / Alerts ───────────────────────────────────── */
.alert-custom {
  border-radius: var(--radius-sm);
  border: none;
  padding: 14px 18px;
  font-size: 14px;
  font-weight: 500;
  display: flex; align-items: center; gap: 10px;
}
.alert-custom.success { background: #D1FAE5; color: #047857; }
.alert-custom.error   { background: #FEE2E2; color: #B91C1C; }

/* ─── Modal Styling ─────────────────────────────────────── */
.modal-content { border-radius: var(--radius); border: none; box-shadow: var(--shadow-lg); }
.modal-header { border-bottom: 1px solid var(--border); padding: 20px 24px; }
.modal-header .modal-title { font-size: 18px; font-weight: 700; }
.modal-body { padding: 24px; }
.modal-footer { border-top: 1px solid var(--border); padding: 16px 24px; }

/* ─── Responsive ────────────────────────────────────────── */
@media (max-width: 991px) {
  .sidebar {
    transform: translateX(-100%);
    z-index: 1050;
  }
  .sidebar.open { transform: translateX(0); }
  .sidebar-overlay {
    position: fixed; inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 1040;
    display: none;
  }
  .sidebar-overlay.show { display: block; }
  .main-content { margin-left: 0; }
  .hamburger-btn { display: flex !important; }
  .page-content { padding: 16px; }
  .stats-grid { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 576px) {
  .stats-grid { grid-template-columns: 1fr; }
  .login-card { padding: 28px 20px; }
  .topbar { padding: 0 16px; }
}

/* ─── Utilities ─────────────────────────────────────────── */
.text-truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fw-800 { font-weight: 800; }
.rounded-pill-custom { border-radius: 50px; }

/* ─── Scrollbar ─────────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--primary); }

/* DataTables custom */
.dataTables_wrapper .dataTables_length select,
.dataTables_wrapper .dataTables_filter input {
  border: 1.5px solid var(--border);
  border-radius: 8px;
  padding: 6px 10px;
  font-family: var(--font-main);
  font-size: 13px;
}
.dataTables_wrapper .dataTables_paginate .paginate_button {
  border-radius: 8px !important;
  font-family: var(--font-main) !important;
  font-size: 13px !important;
}
.dataTables_wrapper .dataTables_paginate .paginate_button.current,
.dataTables_wrapper .dataTables_paginate .paginate_button.current:hover {
  background: var(--primary) !important;
  color: white !important;
  border-color: var(--primary) !important;
}
