/* Attendance Report Executive BI Cockpit Theme v3.1 */

/* === CSS VARIABLES === */
:root {
  /* Richer Neutral Palette */
  --neutral-50: #f8fafc;
  --neutral-100: #f1f5f9;
  --neutral-200: #e2e8f0;
  --neutral-300: #cbd5e1;
  --neutral-400: #94a3b8;
  --neutral-500: #64748b;
  --neutral-600: #475569;
  --neutral-700: #334155;
  --neutral-800: #1e293b;
  --neutral-900: #0f172a;
  
  /* Emerald Palette */
  --emerald-50: #ecfdf5;
  --emerald-100: #d1fae5;
  --emerald-200: #a7f3d0;
  --emerald-300: #6ee7b7;
  --emerald-400: #34d399;
  --emerald-500: #10b981;
  --emerald-600: #059669;
  --emerald-700: #047857;
  --emerald-800: #065f46;
  --emerald-900: #064e3b;
  
  /* Gold Palette */
  --gold-50: #fffbeb;
  --gold-100: #fef3c7;
  --gold-200: #fde68a;
  --gold-300: #fcd34d;
  --gold-400: #fbbf24;
  --gold-500: #f59e0b;
  --gold-600: #d97706;
  --gold-700: #b45309;
  --gold-800: #92400e;
  --gold-900: #78350f;
  
  /* Accent Colors */
  --rose-500: #f43f5e;
  --rose-100: #ffe4e6;
  --rose-200: #fecdd3;
  --rose-600: #e11d48;
  --rose-700: #be123c;
  --amber-500: #f59e0b;
  --amber-600: #d97706;
  --cyan-100: #cffafe;
  --cyan-500: #06b6d4;
  --cyan-600: #0891b2;
  --violet-500: #8b5cf6;
  
  /* Premium Gradients */
  --gradient-dark-emerald: linear-gradient(135deg, #064e3b 0%, #059669 50%, #10b981 100%);
  --gradient-gold: linear-gradient(135deg, #d97706 0%, #fbbf24 50%, #fcd34d 100%);
  --gradient-glass: linear-gradient(145deg, rgba(255,255,255,0.95) 0%, rgba(248,250,252,0.9) 100%);
  --gradient-glass-dark: linear-gradient(145deg, rgba(15,23,42,0.95) 0%, rgba(30,41,59,0.9) 100%);
  --gradient-hero: linear-gradient(135deg, #064e3b 0%, #059669 40%, #10b981 80%, #34d399 100%);
  --gradient-surface: linear-gradient(145deg, #ffffff 0%, #f8fafc 100%);
  
  /* Premium Shadows */
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.05);
  --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.1), 0 2px 4px -1px rgba(0,0,0,0.06);
  --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.1), 0 4px 6px -2px rgba(0,0,0,0.05);
  --shadow-xl: 0 20px 25px -5px rgba(0,0,0,0.1), 0 10px 10px -5px rgba(0,0,0,0.04);
  --shadow-glow: 0 0 40px rgba(16, 185, 129, 0.3);
  --shadow-gold: 0 8px 24px rgba(245, 158, 11, 0.3);
  --shadow-emerald: 0 8px 24px rgba(5, 150, 105, 0.3);
  
  /* Premium Border Radius */
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 24px;
  --radius-2xl: 32px;
}

/* === BASE & TYPOGRAPHY === */
* { box-sizing: border-box; }

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  font-size: 15px;
  line-height: 1.6;
  color: var(--neutral-800);
  background: var(--neutral-50);
  min-height: 100vh;
}

code {
  background: var(--neutral-100);
  border: 1px solid var(--neutral-200);
  border-radius: 6px;
  padding: 0.1rem 0.4rem;
}

h1, h2, h3, h4, h5, h6 {
  font-weight: 700;
  line-height: 1.3;
  color: var(--neutral-900);
  margin-bottom: 0.75rem;
}

h1 { font-size: 1.75rem; letter-spacing: -0.02em; }
h2 { font-size: 1.5rem; letter-spacing: -0.02em; }
h3 { font-size: 1.25rem; }
h4 { font-size: 1.125rem; }

/* === EXECUTIVE HERO HEADER === */
header.executive-hero {
  background: var(--gradient-hero);
  box-shadow: var(--shadow-lg);
  position: relative;
  z-index: 100;
  overflow: hidden;
  border-bottom: 1px solid rgba(255,255,255,0.1);
  padding: 1.5rem 0;
}

header.executive-hero::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(45deg, transparent 30%, rgba(255,255,255,0.1) 50%, transparent 70%);
  animation: shimmer 4s infinite;
}

header.executive-hero::after {
  content: '';
  position: absolute;
  bottom: -20px;
  left: 0;
  right: 0;
  height: 20px;
  background: linear-gradient(to bottom, rgba(0,0,0,0.15), transparent);
  pointer-events: none;
}

header.executive-hero .header-content {
  max-width: 1600px;
  margin: 0 auto;
  padding: 0 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

header.executive-hero h1 {
  color: white !important;
  text-shadow: 0 2px 4px rgba(0,0,0,0.2);
  font-size: 1.5rem !important;
  font-weight: 700;
  letter-spacing: -0.01em;
  margin: 0;
}

/* Golden Badge */
.golden-badge {
  background: var(--gradient-gold);
  color: white;
  padding: 0.5rem 1rem;
  border-radius: 9999px;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  box-shadow: var(--shadow-gold);
  display: flex;
  align-items: center;
  gap: 0.5rem;
  animation: pulse 2s infinite;
}

.golden-badge svg {
  width: 16px;
  height: 16px;
}

@keyframes pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.05); }
}

@keyframes shimmer {
  0% { transform: translateX(-100%); }
  100% { transform: translateX(100%); }
}

/* === EXECUTIVE SUMMARY ROW === */
.executive-summary {
  background: var(--gradient-surface);
  border-bottom: 1px solid var(--neutral-200);
  padding: 1rem 0;
  margin-bottom: 1.5rem;
}

.trust-strip {
  border-bottom: 1px solid var(--neutral-200);
  background: white;
}

.trust-strip-inner {
  max-width: 1600px;
  margin: 0 auto;
  padding: 0.75rem 1.5rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1rem;
  align-items: center;
}

.trust-pill {
  background: var(--emerald-100);
  color: var(--emerald-800);
  border: 1px solid var(--emerald-200);
  border-radius: 999px;
  padding: 0.25rem 0.75rem;
  font-weight: 700;
  font-size: 0.75rem;
}

.trust-note, .trust-time {
  color: var(--neutral-600);
  font-size: 0.825rem;
}

.summary-grid {
  max-width: 1600px;
  margin: 0 auto;
  padding: 0 1.5rem;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
}

.summary-item {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.summary-label {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--neutral-500);
}

.summary-value {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--emerald-700);
}

/* === 4 LARGE KPI CARDS === */
.kpi-grid {
  max-width: 1600px;
  margin: 0 auto 1.5rem;
  padding: 0 1.5rem;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1rem;
}

.kpi-card {
  background: var(--gradient-glass);
  backdrop-filter: blur(20px);
  border-radius: var(--radius-xl);
  padding: 1.5rem;
  border: 1px solid rgba(255,255,255,0.5);
  box-shadow: var(--shadow-md);
  transition: all 0.3s ease;
  position: relative;
  overflow: hidden;
}

.kpi-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: var(--gradient-gold);
}

.kpi-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-glow);
}

.kpi-card-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
}

.kpi-icon {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-lg);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
}

.kpi-icon.emerald { background: var(--emerald-100); color: var(--emerald-600); }
.kpi-icon.rose { background: var(--rose-100); color: var(--rose-600); }
.kpi-icon.gold { background: var(--gold-100); color: var(--gold-600); }
.kpi-icon.cyan { background: var(--cyan-100); color: var(--cyan-600); }

.kpi-title {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--neutral-600);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.kpi-value {
  font-size: 2.25rem;
  font-weight: 800;
  line-height: 1;
  margin-bottom: 0.25rem;
}

.kpi-subtext {
  font-size: 0.75rem;
  color: var(--neutral-500);
}

/* === TWO-COLUMN LAYOUT === */
.two-column-layout {
  max-width: 1600px;
  margin: 0 auto 1.5rem;
  padding: 0 1.5rem;
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 1rem;
}

/* === FULL-WIDTH HEATMAP === */
.full-width-heatmap {
  background: var(--gradient-glass);
  backdrop-filter: blur(20px);
  border-radius: var(--radius-xl);
  padding: 1.5rem;
  border: 1px solid rgba(255,255,255,0.5);
  box-shadow: var(--shadow-md);
  margin-bottom: 1.5rem;
}

.heatmap-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
}

.heatmap-title {
  font-size: 1.125rem;
  font-weight: 700;
  color: var(--neutral-800);
}

.heatmap-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 0.5rem;
}

.heatcell {
  aspect-ratio: 1;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: var(--shadow-sm);
}

.heatcell:hover {
  transform: scale(1.15);
  z-index: 10;
  box-shadow: var(--shadow-gold);
}

.heatcell.missing {
  background: var(--neutral-200);
  color: var(--neutral-500);
}

.heatcell.low {
  background: var(--emerald-200);
  color: var(--emerald-700);
}

.heatcell.medium {
  background: var(--gold-200);
  color: var(--gold-700);
}

.heatcell.high {
  background: var(--rose-200);
  color: var(--rose-700);
}

/* === DEPARTMENT SCORE CARDS === */
.dept-grid {
  max-width: 1600px;
  margin: 0 auto 1.5rem;
  padding: 0 1.5rem;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1rem;
}

.dept-card {
  background: var(--gradient-glass);
  backdrop-filter: blur(20px);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  border: 1px solid rgba(255,255,255,0.5);
  box-shadow: var(--shadow-md);
  transition: all 0.3s ease;
  border-left: 4px solid var(--emerald-500);
}

.dept-card:hover {
  transform: translateX(4px);
  box-shadow: var(--shadow-emerald);
}

.dept-name {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--neutral-700);
  margin-bottom: 0.5rem;
}

.dept-score {
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--emerald-700);
}

/* === TREND + RISK PANELS === */
.trend-panel, .risk-panel {
  background: var(--gradient-glass);
  backdrop-filter: blur(20px);
  border-radius: var(--radius-xl);
  padding: 1.5rem;
  border: 1px solid rgba(255,255,255,0.5);
  box-shadow: var(--shadow-md);
}

.trend-panel {
  min-height: 220px;
}

.risk-panel {
  min-height: 340px;
}

.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
}

.panel-title {
  font-size: 1.125rem;
  font-weight: 700;
  color: var(--neutral-800);
}

.panel-subtitle {
  font-size: 0.8rem;
  color: var(--neutral-500);
  margin-top: 0.2rem;
}

.insight-cta {
  margin-top: 0.75rem;
  display: flex;
  align-items: center;
}

.trend-chart-wrap {
  position: relative;
  height: 240px;
  max-height: 260px;
  overflow: hidden;
}

.trend-chart {
  width: 100% !important;
  height: 100% !important;
  display: block;
}

/* === PREMIUM BUTTONS === */
.btn-premium {
  background: var(--gradient-dark-emerald);
  color: white;
  padding: 0.625rem 1.25rem;
  border-radius: var(--radius-md);
  font-weight: 600;
  font-size: 0.875rem;
  letter-spacing: 0.025em;
  transition: all 0.2s ease;
  box-shadow: var(--shadow-emerald);
  border: none;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
}

.btn-premium:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-glow);
}

.btn-premium-secondary {
  background: white;
  color: var(--emerald-700);
  border: 2px solid var(--emerald-200);
  box-shadow: var(--shadow-sm);
}

.btn-premium-secondary:hover {
  border-color: var(--emerald-500);
  box-shadow: var(--shadow-md);
}

.btn-premium-outline {
  background: transparent;
  color: var(--emerald-700);
  border: 2px solid var(--emerald-200);
  box-shadow: var(--shadow-sm);
}

.btn-premium-outline:hover {
  border-color: var(--emerald-500);
  box-shadow: var(--shadow-md);
}

/* === PREMIUM TABLE === */
.table-premium {
  background: var(--gradient-glass);
  backdrop-filter: blur(20px);
  border-radius: var(--radius-xl);
  border: 1px solid rgba(255,255,255,0.5);
  box-shadow: var(--shadow-md);
  overflow: hidden;
}

.table-premium thead {
  background: var(--gradient-dark-emerald);
}

.table-premium th {
  color: white;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 1rem;
  border-bottom: 2px solid rgba(255,255,255,0.2);
}

.table-premium td {
  padding: 1rem;
  border-bottom: 1px solid var(--neutral-200);
}

.table-premium tr:hover td {
  background: var(--emerald-50);
}

.status-banner {
  border-radius: var(--radius-md);
  border: 1px solid var(--neutral-200);
  padding: 0.6rem 0.9rem;
  margin: 0 1.5rem 1rem;
  font-size: 0.875rem;
  font-weight: 600;
}

.status-loading {
  background: var(--gold-50);
  border-color: var(--gold-200);
  color: var(--gold-800);
}

.status-ok {
  background: var(--emerald-50);
  border-color: var(--emerald-200);
  color: var(--emerald-800);
}

.status-error {
  background: var(--rose-100);
  border-color: var(--rose-200);
  color: var(--rose-700);
}

.empty-state {
  text-align: center;
  color: var(--neutral-500);
  padding: 1rem;
  border: 1px dashed var(--neutral-300);
  border-radius: var(--radius-md);
  background: white;
}

/* Drilldown table sticky header */
.drill-table-wrap {
  overflow-x: auto;
  overflow-y: visible;
}

.drill-table thead th {
  position: sticky;
  top: 0;
  z-index: 2;
  background: #ecfdf5;
}

/* Drilldown timeline calendar */
.timeline-title {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--neutral-800);
  margin-bottom: 0.2rem;
}

.timeline-subtitle {
  font-size: 0.82rem;
  color: var(--neutral-600);
  margin-bottom: 0.6rem;
}

.timeline-weekdays, .timeline-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 0.35rem;
}

.timeline-weekday {
  text-align: center;
  font-size: 0.74rem;
  font-weight: 700;
  color: var(--neutral-600);
}

.timeline-cell {
  min-height: 44px;
  border-radius: 8px;
  border: 1px solid var(--neutral-200);
  background: #f8fafc;
  padding: 0.25rem;
}

.timeline-cell .day-num {
  font-size: 0.74rem;
  font-weight: 700;
  color: var(--neutral-700);
}

.timeline-cell .day-note {
  font-size: 0.65rem;
  color: var(--neutral-600);
}

.timeline-cell.normal { background: #dcfce7; }
.timeline-cell.late { background: #fef3c7; }
.timeline-cell.missing { background: #fee2e2; }
.timeline-cell.leave { background: #dbeafe; }
.timeline-cell.none { background: #f8fafc; }
.timeline-cell.holiday {
  border-color: #fbbf24;
}

.timeline-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  margin-top: 0.7rem;
}

.timeline-legend .lg {
  font-size: 0.72rem;
  font-weight: 600;
  border-radius: 999px;
  padding: 0.15rem 0.55rem;
}

.timeline-legend .normal { background: #dcfce7; color: #166534; }
.timeline-legend .late { background: #fef3c7; color: #92400e; }
.timeline-legend .missing { background: #fee2e2; color: #991b1b; }
.timeline-legend .leave { background: #dbeafe; color: #1d4ed8; }
.timeline-legend .holiday { background: #fffbeb; color: #a16207; }

/* === PREMIUM BADGES === */
.badge-premium {
  padding: 0.25rem 0.75rem;
  border-radius: 9999px;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.025em;
}

.badge-success {
  background: var(--emerald-100);
  color: var(--emerald-700);
}

.badge-warning {
  background: var(--gold-100);
  color: var(--gold-700);
}

.badge-danger {
  background: var(--rose-100);
  color: var(--rose-700);
}

.badge-neutral {
  background: var(--neutral-100);
  color: var(--neutral-700);
}

/* === ANIMATIONS === */
@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes slideInLeft {
  from {
    opacity: 0;
    transform: translateX(-20px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes slideInRight {
  from {
    opacity: 0;
    transform: translateX(20px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

.animate-fadeInUp {
  animation: fadeInUp 0.5s ease-out forwards;
}

.animate-slideInLeft {
  animation: slideInLeft 0.5s ease-out forwards;
}

.animate-slideInRight {
  animation: slideInRight 0.5s ease-out forwards;
}

/* === RESPONSIVE === */
@media (max-width: 1024px) {
  .kpi-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  
  .two-column-layout {
    grid-template-columns: 1fr;
  }
  
  .heatmap-grid {
    gap: 0.25rem;
  }
  
  .heatcell {
    font-size: 0.625rem;
  }

  .trend-chart-wrap {
    height: 220px;
    max-height: 240px;
  }
}

@media (max-width: 640px) {
  header.executive-hero .header-content {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.75rem;
  }
  
  .golden-badge {
    width: 100%;
    justify-content: center;
  }
  
  .kpi-grid {
    grid-template-columns: 1fr;
  }
  
  .dept-grid {
    grid-template-columns: 1fr;
  }

  .summary-value {
    font-size: 1.25rem;
  }

  .kpi-value {
    font-size: 1.8rem;
  }

  .status-banner {
    margin: 0 0 0.75rem;
  }

  .trend-panel {
    min-height: 240px;
    padding: 1.1rem;
  }

  .trend-chart-wrap {
    height: 190px;
    max-height: 190px;
  }
}

/* === PRINT === */
@media print {
  header, .no-print { display: none !important; }
  .executive-summary, .kpi-grid, .two-column-layout, .dept-grid { 
    display: block !important; 
    margin: 0 !important; 
    padding: 0 !important; 
  }
  .kpi-card, .trend-panel, .risk-panel, .full-width-heatmap, .dept-card, .table-premium {
    background: white !important;
    border: 1px solid #e5e7eb;
    box-shadow: none !important;
    break-inside: avoid;
  }
}

/* === SCROLLBAR === */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: var(--neutral-100);
  border-radius: 4px;
}

::-webkit-scrollbar-thumb {
  background: var(--emerald-400);
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--emerald-500);
}
