/* ============================================
   PRESENSI APP - BLUE DARK THEME (UTU STYLE)
   ============================================ */

/* CSS Variables */
:root {
  /* Primary Colors - Biru Dongker UTU */
  --primary: #1e3a5f;
  --primary-dark: #152a45;
  --primary-light: #2a4a73;
  --primary-lighter: #3d5a85;
  
  /* Accent Colors */
  --accent: #3498db;
  --accent-light: #5dade2;
  --success: #27ae60;
  --success-light: #2ecc71;
  --warning: #f39c12;
  --danger: #e74c3c;
  
  /* Neutral Colors */
  --white: #ffffff;
  --gray-50: #f8fafc;
  --gray-100: #f1f5f9;
  --gray-200: #e2e8f0;
  --gray-300: #cbd5e1;
  --gray-400: #94a3b8;
  --gray-500: #64748b;
  --gray-600: #475569;
  --gray-700: #334155;
  --gray-800: #1e293b;
  --gray-900: #0f172a;
  
  /* Sidebar */
  --sidebar-width: 280px;
  --sidebar-collapsed: 80px;
  
  /* Border Radius */
  --radius: 10px;
  --radius-lg: 16px;
  --radius-xl: 20px;
  
  /* Shadows */
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
  --shadow: 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);
  
  /* Transitions */
  --transition: all 0.3s ease;
  --transition-fast: all 0.15s ease;
}

/* Reset & Base */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: 'Poppins', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--gray-100);
  color: var(--gray-800);
  line-height: 1.6;
  min-height: 100vh;
}

/* ============================================
   SIDEBAR
   ============================================ */
.sidebar {
  position: fixed;
  top: 0;
  left: 0;
  width: var(--sidebar-width);
  height: 100vh;
  background: linear-gradient(180deg, var(--primary) 0%, var(--primary-dark) 100%);
  z-index: 1000;
  transition: var(--transition);
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
}

.sidebar.collapsed {
  width: var(--sidebar-collapsed);
}

/* Sidebar Header */
.sidebar-header {
  padding: 1.5rem;
  display: flex;
  align-items: center;
  gap: 1rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.sidebar-logo {
  width: 48px;
  height: 48px;
  background: var(--white);
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.sidebar-logo i {
  font-size: 1.5rem;
  color: var(--primary);
}

.sidebar-brand {
  color: var(--white);
  font-weight: 700;
  font-size: 1.25rem;
  white-space: nowrap;
  opacity: 1;
  transition: var(--transition);
}

.sidebar.collapsed .sidebar-brand {
  opacity: 0;
  width: 0;
}

/* Toggle Button */
.sidebar-toggle {
  position: absolute;
  top: 1.5rem;
  right: -16px;
  width: 32px;
  height: 32px;
  background: var(--white);
  border: none;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow-lg);
  transition: var(--transition);
  z-index: 1001;
}

.sidebar-toggle:hover {
  transform: scale(1.1);
}

.sidebar-toggle i {
  color: var(--primary);
  font-size: 0.875rem;
  transition: var(--transition);
}

.sidebar.collapsed .sidebar-toggle i {
  transform: rotate(180deg);
}

/* User Info */
.sidebar-user {
  padding: 1.5rem;
  display: flex;
  align-items: center;
  gap: 1rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.user-avatar {
  width: 50px;
  height: 50px;
  background: rgba(255, 255, 255, 0.15);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.user-avatar i {
  font-size: 1.5rem;
  color: var(--white);
}

.user-info {
  white-space: nowrap;
  opacity: 1;
  transition: var(--transition);
  overflow: hidden;
}

.sidebar.collapsed .user-info {
  opacity: 0;
  width: 0;
}

.user-name {
  color: var(--white);
  font-weight: 600;
  font-size: 0.95rem;
  display: block;
}

.user-role {
  color: rgba(255, 255, 255, 0.7);
  font-size: 0.8rem;
}

/* Sidebar Navigation */
.sidebar-nav {
  flex: 1;
  padding: 1rem 0;
  overflow-y: auto;
}

.nav-menu {
  list-style: none;
}

.nav-item {
  margin: 0.25rem 0;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1rem 1.5rem;
  color: rgba(255, 255, 255, 0.8);
  text-decoration: none;
  transition: var(--transition);
  position: relative;
  white-space: nowrap;
}

.nav-link:hover,
.nav-link.active {
  color: var(--white);
  background: rgba(255, 255, 255, 0.1);
}

.nav-link.active::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 4px;
  background: var(--accent);
  border-radius: 0 4px 4px 0;
}

.nav-icon {
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.nav-icon i {
  font-size: 1.125rem;
}

.nav-text {
  font-weight: 500;
  font-size: 0.95rem;
  opacity: 1;
  transition: var(--transition);
}

.sidebar.collapsed .nav-text {
  opacity: 0;
  width: 0;
}

/* Sidebar Footer */
.sidebar-footer {
  padding: 1rem 1.5rem;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.nav-link.logout {
  color: rgba(255, 255, 255, 0.6);
}

.nav-link.logout:hover {
  color: var(--danger);
  background: rgba(231, 76, 60, 0.1);
}

/* ============================================
   MAIN CONTENT
   ============================================ */
.main-content {
  margin-left: var(--sidebar-width);
  min-height: 100vh;
  transition: var(--transition);
  padding: 2rem;
}

.sidebar.collapsed ~ .main-content {
  margin-left: var(--sidebar-collapsed);
}

/* Mobile Header */
.mobile-header {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 70px;
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
  z-index: 999;
  align-items: center;
  justify-content: space-between;
  padding: 0 1rem;
}

.mobile-logo {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  color: var(--white);
}

.mobile-logo-icon {
  width: 40px;
  height: 40px;
  background: var(--white);
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
}

.mobile-logo-icon i {
  color: var(--primary);
  font-size: 1.25rem;
}

.mobile-logo-text {
  font-weight: 700;
  font-size: 1.1rem;
}

.mobile-toggle {
  width: 44px;
  height: 44px;
  background: rgba(255, 255, 255, 0.1);
  border: none;
  border-radius: var(--radius);
  color: var(--white);
  font-size: 1.25rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Page Header */
.page-header {
  margin-bottom: 2rem;
}

.page-title {
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--gray-800);
  margin-bottom: 0.5rem;
}

.page-subtitle {
  color: var(--gray-500);
  font-size: 0.95rem;
}

/* ============================================
   CARDS
   ============================================ */
.card {
  background: var(--white);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  overflow: hidden;
  margin-bottom: 1.5rem;
}

.card-header {
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--gray-100);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.card-title {
  font-size: 1.125rem;
  font-weight: 600;
  color: var(--gray-800);
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.card-title i {
  color: var(--primary);
}

.card-body {
  padding: 1.5rem;
}

/* ============================================
   STATS CARDS
   ============================================ */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 1.5rem;
  margin-bottom: 2rem;
}

.stat-card {
  background: var(--white);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  box-shadow: var(--shadow);
  display: flex;
  align-items: center;
  gap: 1rem;
  transition: var(--transition);
}

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

.stat-icon {
  width: 60px;
  height: 60px;
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.stat-icon.primary {
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
  color: var(--white);
}

.stat-icon.success {
  background: linear-gradient(135deg, var(--success) 0%, var(--success-light) 100%);
  color: var(--white);
}

.stat-icon.warning {
  background: linear-gradient(135deg, var(--warning) 0%, #f5b041 100%);
  color: var(--white);
}

.stat-icon.danger {
  background: linear-gradient(135deg, var(--danger) 0%, #ec7063 100%);
  color: var(--white);
}

.stat-icon i {
  font-size: 1.5rem;
}

.stat-content {
  flex: 1;
}

.stat-label {
  font-size: 0.875rem;
  color: var(--gray-500);
  margin-bottom: 0.25rem;
}

.stat-value {
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--gray-800);
}

.stat-desc {
  font-size: 0.8rem;
  color: var(--gray-400);
  margin-top: 0.25rem;
}

/* ============================================
   BUTTONS
   ============================================ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.75rem 1.5rem;
  font-size: 0.95rem;
  font-weight: 600;
  border: none;
  border-radius: var(--radius);
  cursor: pointer;
  transition: var(--transition);
  font-family: inherit;
  text-decoration: none;
}

.btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.btn-primary {
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
  color: var(--white);
}

.btn-primary:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
}

.btn-success {
  background: linear-gradient(135deg, var(--success) 0%, var(--success-light) 100%);
  color: var(--white);
}

.btn-success:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 10px 20px rgba(39, 174, 96, 0.3);
}

.btn-outline {
  background: transparent;
  border: 2px solid var(--gray-300);
  color: var(--gray-600);
}

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

.btn-lg {
  padding: 1rem 2rem;
  font-size: 1.1rem;
}

.btn-block {
  width: 100%;
}

/* ============================================
   PRESENSI BUTTONS
   ============================================ */
.presensi-actions {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1.5rem;
}

.presensi-btn {
  padding: 2rem;
  border-radius: var(--radius-lg);
  text-align: center;
  transition: var(--transition);
  position: relative;
  overflow: hidden;
}

.presensi-btn::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(135deg, rgba(255,255,255,0.1) 0%, transparent 100%);
  opacity: 0;
  transition: var(--transition);
}

.presensi-btn:hover::before {
  opacity: 1;
}

.presensi-btn.morning {
  background: linear-gradient(135deg, #f39c12 0%, #f5b041 100%);
  color: var(--white);
}

.presensi-btn.evening {
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
  color: var(--white);
}

.presensi-btn:disabled {
  background: var(--gray-300) !important;
  cursor: not-allowed;
  transform: none !important;
}

.presensi-btn:disabled::before {
  display: none;
}

.presensi-btn-icon {
  width: 80px;
  height: 80px;
  background: rgba(255, 255, 255, 0.2);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 1rem;
}

.presensi-btn-icon i {
  font-size: 2rem;
}

.presensi-btn-title {
  font-size: 1.25rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
}

.presensi-btn-time {
  font-size: 2rem;
  font-weight: 800;
  margin-bottom: 0.5rem;
}

.presensi-btn-status {
  font-size: 0.875rem;
  opacity: 0.9;
  padding: 0.5rem 1rem;
  background: rgba(255, 255, 255, 0.2);
  border-radius: 20px;
  display: inline-block;
}

/* ============================================
   TABLES
   ============================================ */
.table-container {
  overflow-x: auto;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
}

.data-table th,
.data-table td {
  padding: 1rem;
  text-align: left;
}

.data-table thead th {
  background: var(--gray-50);
  font-weight: 600;
  color: var(--gray-700);
  font-size: 0.875rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border-bottom: 2px solid var(--gray-200);
}

.data-table tbody tr {
  border-bottom: 1px solid var(--gray-100);
  transition: var(--transition-fast);
}

.data-table tbody tr:hover {
  background: var(--gray-50);
}

.data-table tbody td {
  color: var(--gray-600);
  font-size: 0.95rem;
}

/* Status Badges */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 1rem;
  border-radius: 20px;
  font-size: 0.8rem;
  font-weight: 600;
}

.badge-success {
  background: rgba(39, 174, 96, 0.1);
  color: var(--success);
}

.badge-warning {
  background: rgba(243, 156, 18, 0.1);
  color: var(--warning);
}

.badge-danger {
  background: rgba(231, 76, 60, 0.1);
  color: var(--danger);
}

.badge-info {
  background: rgba(52, 152, 219, 0.1);
  color: var(--accent);
}

/* ============================================
   FORMS
   ============================================ */
.form-group {
  margin-bottom: 1.25rem;
}

.form-label {
  display: block;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--gray-700);
  margin-bottom: 0.5rem;
}

.form-control {
  width: 100%;
  padding: 0.875rem 1rem;
  border: 2px solid var(--gray-200);
  border-radius: var(--radius);
  font-size: 0.95rem;
  font-family: inherit;
  transition: var(--transition);
  background: var(--white);
}

.form-control:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 4px rgba(30, 58, 95, 0.1);
}

.form-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
}

/* ============================================
   FILTER SECTION
   ============================================ */
.filter-section {
  background: var(--gray-50);
  padding: 1.25rem;
  border-radius: var(--radius);
  margin-bottom: 1.5rem;
}

.filter-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 1rem;
  align-items: end;
}

/* ============================================
   STREAK PAGE
   ============================================ */
.streak-container {
  text-align: center;
  padding: 3rem 2rem;
}

.streak-flame {
  width: 150px;
  height: 150px;
  background: linear-gradient(135deg, #ff6b35 0%, #f39c12 50%, #e74c3c 100%);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 2rem;
  box-shadow: 0 20px 40px rgba(243, 156, 18, 0.3);
  animation: pulse 2s infinite;
}

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

.streak-flame i {
  font-size: 4rem;
  color: var(--white);
}

.streak-count {
  font-size: 4rem;
  font-weight: 800;
  color: var(--primary);
  margin-bottom: 0.5rem;
}

.streak-label {
  font-size: 1.25rem;
  color: var(--gray-500);
  margin-bottom: 2rem;
}

.streak-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.5rem;
  max-width: 600px;
  margin: 0 auto;
}

.streak-stat {
  background: var(--gray-50);
  padding: 1.5rem;
  border-radius: var(--radius-lg);
}

.streak-stat-value {
  font-size: 2rem;
  font-weight: 700;
  color: var(--primary);
}

.streak-stat-label {
  font-size: 0.875rem;
  color: var(--gray-500);
  margin-top: 0.25rem;
}

/* Calendar Grid */
.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 0.5rem;
  margin-top: 2rem;
}

.calendar-header {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--gray-500);
  padding: 0.75rem;
  text-align: center;
}

.calendar-day {
  aspect-ratio: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius);
  font-size: 0.9rem;
  font-weight: 500;
  background: var(--gray-100);
  color: var(--gray-400);
}

.calendar-day.present {
  background: var(--success);
  color: var(--white);
}

.calendar-day.today {
  border: 2px solid var(--primary);
}

/* ============================================
   EMPTY STATE
   ============================================ */
.empty-state {
  text-align: center;
  padding: 3rem 2rem;
}

.empty-icon {
  width: 100px;
  height: 100px;
  background: var(--gray-100);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 1.5rem;
}

.empty-icon i {
  font-size: 2.5rem;
  color: var(--gray-400);
}

.empty-title {
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--gray-700);
  margin-bottom: 0.5rem;
}

.empty-desc {
  color: var(--gray-500);
}

/* ============================================
   RESPONSIVE
   ============================================ */
@media (max-width: 1024px) {
  .sidebar {
    transform: translateX(-100%);
  }
  
  .sidebar.open {
    transform: translateX(0);
  }
  
  .main-content {
    margin-left: 0;
    padding-top: 90px;
  }
  
  .sidebar.collapsed ~ .main-content {
    margin-left: 0;
  }
  
  .mobile-header {
    display: flex;
  }
  
  .sidebar-toggle {
    display: none;
  }
  
  .overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 999;
  }
  
  .overlay.active {
    display: block;
  }
  
  .presensi-actions {
    grid-template-columns: 1fr;
  }
  
  .streak-stats {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 640px) {
  .main-content {
    padding: 90px 1rem 1rem;
  }
  
  .page-title {
    font-size: 1.5rem;
  }
  
  .stats-grid {
    grid-template-columns: 1fr;
  }
  
  .stat-card {
    padding: 1rem;
  }
  
  .stat-icon {
    width: 50px;
    height: 50px;
  }
  
  .stat-value {
    font-size: 1.5rem;
  }
  
  .presensi-btn {
    padding: 1.5rem 1rem;
  }
  
  .presensi-btn-icon {
    width: 60px;
    height: 60px;
  }
  
  .presensi-btn-time {
    font-size: 1.5rem;
  }
  
  .filter-grid {
    grid-template-columns: 1fr;
  }
  
  .data-table th,
  .data-table td {
    padding: 0.75rem 0.5rem;
    font-size: 0.875rem;
  }
  
  .calendar-grid {
    gap: 0.25rem;
  }
  
  .calendar-day {
    font-size: 0.8rem;
  }
}

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

.fade-in {
  animation: fadeIn 0.3s ease;
}

/* Scrollbar Styling */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: var(--gray-100);
}

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

::-webkit-scrollbar-thumb:hover {
  background: var(--gray-400);
}
