/* Reset & Base Styles */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: 'Prompt', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

:root {
  /* Light Theme Variables */
  --bg-primary: #f3f4f6;
  --bg-secondary: #ffffff;
  --bg-sidebar: linear-gradient(135deg, #1e293b 0%, #0f172a 100%);
  --text-primary: #1f2937;
  --text-secondary: #4b5563;
  --text-light: #9ca3af;
  --border-color: rgba(229, 231, 235, 0.5);
  
  --primary: #3b82f6;
  --primary-hover: #2563eb;
  --success: #10b981;
  --success-light: rgba(16, 185, 129, 0.15);
  --warning: #f59e0b;
  --warning-light: rgba(245, 158, 11, 0.15);
  --danger: #ef4444;
  --danger-light: rgba(239, 68, 68, 0.15);
  --info: #06b6d4;
  --info-light: rgba(6, 182, 212, 0.15);
  
  --card-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.05), 0 4px 6px -4px rgba(0, 0, 0, 0.05);
  --sidebar-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.1);
  --glass-bg: rgba(255, 255, 255, 0.7);
  --glass-border: rgba(255, 255, 255, 0.6);
  --glass-blur: 12px;
}

body.dark-theme {
  /* Dark Theme Variables */
  --bg-primary: #0b0f19;
  --bg-secondary: #111827;
  --bg-sidebar: linear-gradient(135deg, #090d16 0%, #020617 100%);
  --text-primary: #f3f4f6;
  --text-secondary: #9ca3af;
  --text-light: #6b7280;
  --border-color: rgba(75, 85, 99, 0.4);
  
  --primary: #3b82f6;
  --primary-hover: #60a5fa;
  --success: #34d399;
  --success-light: rgba(52, 211, 153, 0.15);
  --warning: #fbbf24;
  --warning-light: rgba(251, 191, 36, 0.15);
  --danger: #f87171;
  --danger-light: rgba(248, 113, 113, 0.15);
  --info: #22d3ee;
  --info-light: rgba(34, 211, 238, 0.15);
  
  --card-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.3), 0 8px 10px -6px rgba(0, 0, 0, 0.3);
  --glass-bg: rgba(17, 24, 39, 0.75);
  --glass-border: rgba(55, 65, 81, 0.5);
  --glass-blur: 15px;
}

body {
  background-color: var(--bg-primary);
  color: var(--text-primary);
  min-height: 100vh;
  display: flex;
  overflow-x: hidden;
  transition: background-color 0.3s ease, color 0.3s ease;
}

/* Glassmorphism Styles */
.glass {
  background: var(--glass-bg);
  backdrop-filter: blur(var(--glass-blur));
  -webkit-backdrop-filter: blur(var(--glass-blur));
  border: 1px solid var(--glass-border);
  box-shadow: var(--card-shadow);
}

/* Layout Wrapper */
.app-container {
  width: 100%;
  min-height: 100vh;
  display: flex;
}

.workspace-wrapper {
  display: flex;
  width: 100%;
  min-height: 100vh;
}

/* Login Screen Styles */
.login-wrapper {
  display: flex;
  justify-content: center;
  align-items: center;
  width: 100%;
  min-height: 100vh;
  background: radial-gradient(circle at 10% 20%, rgba(59, 130, 246, 0.1) 0%, transparent 40%),
              radial-gradient(circle at 90% 80%, rgba(16, 185, 129, 0.08) 0%, transparent 40%);
  animation: fadeIn 0.8s ease-out;
}

.login-card {
  width: 420px;
  border-radius: 16px;
  padding: 40px 32px;
  border: 1px solid var(--glass-border);
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
  transition: transform 0.3s ease;
}

.login-card:hover {
  transform: translateY(-5px);
}

.login-header {
  text-align: center;
  margin-bottom: 32px;
}

.logo-icon {
  width: 64px;
  height: 64px;
  border-radius: 16px;
  background: linear-gradient(135deg, var(--primary) 0%, #1d4ed8 100%);
  color: white;
  display: flex;
  justify-content: center;
  align-items: center;
  font-size: 28px;
  margin: 0 auto 16px;
  box-shadow: 0 8px 16px rgba(59, 130, 246, 0.3);
}

.login-header h1 {
  font-size: 22px;
  font-weight: 600;
  margin-bottom: 8px;
}

.login-header p {
  font-size: 14px;
  color: var(--text-secondary);
}

.login-footer {
  text-align: center;
  margin-top: 24px;
  font-size: 12px;
  color: var(--text-light);
}

/* Sidebar Styles */
.sidebar {
  width: 280px;
  min-height: 100vh;
  background: var(--bg-sidebar);
  color: #f3f4f6;
  display: flex;
  flex-direction: column;
  border-right: 1px solid var(--border-color);
  padding: 24px 16px;
  z-index: 10;
  box-shadow: var(--sidebar-shadow);
  transition: all 0.3s ease;
}

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

.sidebar-logo {
  font-size: 32px;
  color: var(--primary);
  filter: drop-shadow(0 2px 8px rgba(59, 130, 246, 0.4));
}

.sidebar-header h3 {
  font-size: 16px;
  font-weight: 600;
  color: #ffffff;
}

.user-role-badge {
  display: inline-block;
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  background-color: var(--primary);
  color: white;
  padding: 2px 8px;
  border-radius: 9999px;
  margin-top: 2px;
}

.user-profile-section {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 12px;
  margin-bottom: 24px;
  border: 1px solid rgba(255, 255, 255, 0.03);
}

.profile-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--primary);
  display: flex;
  justify-content: center;
  align-items: center;
  font-size: 18px;
  color: white;
}

.profile-info h4 {
  font-size: 14px;
  font-weight: 500;
  color: #ffffff;
}

.profile-info small {
  font-size: 11px;
  color: rgba(255, 255, 255, 0.5);
}

.sidebar-menu {
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex: 1;
}

.menu-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border-radius: 10px;
  color: rgba(255, 255, 255, 0.7);
  text-decoration: none;
  font-size: 14px;
  font-weight: 400;
  transition: all 0.2s ease;
}

.menu-item i {
  font-size: 16px;
  width: 20px;
  text-align: center;
}

.menu-item:hover {
  background: rgba(255, 255, 255, 0.08);
  color: #ffffff;
  transform: translateX(4px);
}

.menu-item.active {
  background: var(--primary);
  color: #ffffff;
  font-weight: 500;
  box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
}

.sidebar-footer {
  margin-top: auto;
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding-top: 24px;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.btn-theme-toggle {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: rgba(255, 255, 255, 0.7);
  padding: 10px;
  border-radius: 8px;
  cursor: pointer;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  transition: all 0.2s ease;
}

.btn-theme-toggle:hover {
  background: rgba(255, 255, 255, 0.1);
  color: #ffffff;
}

/* Main Content Styles */
.main-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  height: 100vh;
  overflow-y: auto;
}

.content-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 24px 32px;
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border-color);
  transition: background-color 0.3s ease, border-color 0.3s ease;
}

.header-title h2 {
  font-size: 20px;
  font-weight: 600;
  margin-bottom: 4px;
}

.header-title p {
  font-size: 13px;
  color: var(--text-secondary);
}

.live-clock {
  font-size: 13px;
  background: var(--border-color);
  padding: 6px 14px;
  border-radius: 20px;
  color: var(--text-secondary);
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 8px;
}

.content-body {
  padding: 32px;
  flex: 1;
}

.content-section {
  animation: fadeIn 0.4s ease-out;
}

/* Filters & Actions Panels */
.filter-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  padding: 20px;
  border-radius: 12px;
  align-items: flex-end;
}

.filter-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex: 1;
  min-width: 180px;
}

.filter-group label {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-secondary);
}

.filter-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}

/* General UI Components */
.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 16px;
}

.form-group label {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
}

.form-row {
  display: flex;
  gap: 16px;
  margin-bottom: 16px;
}

.form-row .col {
  flex: 1;
  margin-bottom: 0;
}

input[type="text"],
input[type="password"],
input[type="date"],
select,
textarea {
  width: 100%;
  padding: 10px 14px;
  border-radius: 8px;
  border: 1px solid var(--border-color);
  background-color: var(--bg-secondary);
  color: var(--text-primary);
  font-size: 14px;
  transition: border-color 0.2s, box-shadow 0.2s;
}

input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}

/* Button Styles */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 18px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  border: none;
  transition: all 0.2s;
}

.btn-block {
  display: flex;
  width: 100%;
}

.btn-primary {
  background: linear-gradient(135deg, var(--primary) 0%, #1d4ed8 100%);
  color: white;
  box-shadow: 0 4px 6px rgba(59, 130, 246, 0.15);
}

.btn-primary:hover {
  background: var(--primary-hover);
  box-shadow: 0 4px 12px rgba(59, 130, 246, 0.25);
  transform: translateY(-1px);
}

.btn-success {
  background: linear-gradient(135deg, var(--success) 0%, #047857 100%);
  color: white;
  box-shadow: 0 4px 6px rgba(16, 185, 129, 0.15);
}

.btn-success:hover {
  background-color: #059669;
  box-shadow: 0 4px 12px rgba(16, 185, 129, 0.25);
  transform: translateY(-1px);
}

.btn-danger {
  background: linear-gradient(135deg, var(--danger) 0%, #b91c1c 100%);
  color: white;
  box-shadow: 0 4px 6px rgba(239, 68, 68, 0.15);
}

.btn-danger:hover {
  background-color: #dc2626;
  box-shadow: 0 4px 12px rgba(239, 68, 68, 0.25);
  transform: translateY(-1px);
}

.btn-outline {
  background: transparent;
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
}

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

/* Stats Roster Grid */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 20px;
}

.stat-card {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 24px;
  border-radius: 12px;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.stat-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--card-shadow), 0 8px 24px rgba(0, 0, 0, 0.04);
}

.stat-icon {
  width: 48px;
  height: 48px;
  border-radius: 10px;
  display: flex;
  justify-content: center;
  align-items: center;
  font-size: 20px;
}

.stat-data {
  display: flex;
  flex-direction: column;
}

.stat-value {
  font-size: 22px;
  font-weight: 700;
}

.stat-label {
  font-size: 11px;
  color: var(--text-secondary);
  font-weight: 400;
  margin-top: 2px;
}

.border-left-blue { border-left: 4px solid var(--primary); }
.border-left-green { border-left: 4px solid var(--success); }
.border-left-orange { border-left: 4px solid var(--warning); }
.border-left-red { border-left: 4px solid var(--danger); }

.bg-light-blue { background-color: rgba(59, 130, 246, 0.15); }
.bg-light-green { background-color: var(--success-light); }
.bg-light-orange { background-color: var(--warning-light); }
.bg-light-red { background-color: var(--danger-light); }

.text-blue { color: var(--primary); }
.text-green { color: var(--success); }
.text-orange { color: var(--warning); }
.text-red { color: var(--danger); }

/* Dashboard Content Grid */
.dashboard-grid {
  display: grid;
  grid-template-columns: 2fr 3fr;
  gap: 24px;
  margin-top: 24px;
}

@media (max-width: 1024px) {
  .dashboard-grid {
    grid-template-columns: 1fr;
  }
}

/* Cards & Tables */
.card {
  border-radius: 14px;
  display: flex;
  flex-direction: column;
}

.card-header {
  padding: 18px 24px;
  border-bottom: 1px solid var(--border-color);
  font-size: 15px;
  font-weight: 600;
}

.flex-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.card-body {
  padding: 24px;
  flex: 1;
}

.chart-container-wrapper {
  position: relative;
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 280px;
  max-height: 380px;
}

.table-responsive {
  width: 100%;
  overflow-x: auto;
}

.table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
}

.table th, .table td {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border-color);
  font-size: 13px;
  vertical-align: middle;
}

.table th {
  font-weight: 600;
  color: var(--text-secondary);
  background-color: rgba(0, 0, 0, 0.02);
}

body.dark-theme .table th {
  background-color: rgba(255, 255, 255, 0.02);
}

.table tbody tr {
  transition: background-color 0.15s;
}

.table tbody tr:hover {
  background-color: rgba(0, 0, 0, 0.01);
}

body.dark-theme .table tbody tr:hover {
  background-color: rgba(255, 255, 255, 0.015);
}

/* Status Badges */
.badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 500;
}

.badge-success { background: var(--success-light); color: var(--success); }
.badge-warning { background: var(--warning-light); color: var(--warning); }
.badge-danger { background: var(--danger-light); color: var(--danger); }
.badge-info { background: var(--info-light); color: var(--info); }

/* Custom Check Roster Toggles */
.status-btn-group {
  display: flex;
  background: var(--bg-primary);
  padding: 4px;
  border-radius: 30px;
  border: 1px solid var(--border-color);
  max-width: 250px;
  margin: 0 auto;
}

.status-btn {
  flex: 1;
  border: none;
  background: none;
  font-size: 12px;
  font-weight: 500;
  padding: 6px 12px;
  border-radius: 25px;
  cursor: pointer;
  color: var(--text-secondary);
  transition: all 0.2s;
}

.status-btn.active.present {
  background-color: var(--success);
  color: white;
  box-shadow: 0 2px 6px rgba(16, 185, 129, 0.3);
}

.status-btn.active.late {
  background-color: var(--warning);
  color: white;
  box-shadow: 0 2px 6px rgba(245, 158, 11, 0.3);
}

.status-btn.active.absent {
  background-color: var(--danger);
  color: white;
  box-shadow: 0 2px 6px rgba(239, 68, 68, 0.3);
}

/* Modal Overlay & Container */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(0, 0, 0, 0.5);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 1000;
  animation: fadeIn 0.3s ease-out;
}

.modal-container {
  width: 550px;
  border-radius: 16px;
  animation: slideUp 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  overflow: hidden;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
}

.modal-header {
  padding: 20px 24px;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.btn-close-modal {
  background: none;
  border: none;
  font-size: 20px;
  color: var(--text-secondary);
  cursor: pointer;
  transition: color 0.15s;
}

.btn-close-modal:hover {
  color: var(--text-primary);
}

.modal-body {
  padding: 24px;
  overflow-y: auto;
}

.modal-footer {
  padding: 16px 24px;
  border-top: 1px solid var(--border-color);
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  background-color: rgba(0, 0, 0, 0.01);
}

body.dark-theme .modal-footer {
  background-color: rgba(255, 255, 255, 0.01);
}

/* Action Bars */
.action-bar {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: center;
}

.search-box {
  display: flex;
  align-items: center;
  padding: 0 16px;
  border-radius: 10px;
  flex: 1;
  max-width: 400px;
}

.search-box i {
  color: var(--text-light);
  margin-right: 12px;
}

.search-box input {
  border: none;
  background: none;
  padding: 10px 0;
  width: 100%;
}

.search-box input:focus {
  outline: none;
  box-shadow: none;
}

/* Toast System */
.toast-container {
  position: fixed;
  top: 24px;
  right: 24px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.toast {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 24px;
  border-radius: 10px;
  box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -4px rgba(0, 0, 0, 0.1);
  color: white;
  animation: slideInRight 0.3s cubic-bezier(0.16, 1, 0.3, 1), fadeOut 0.3s ease-in 3.7s forwards;
  min-width: 300px;
  max-width: 450px;
}

.toast-success { background: linear-gradient(135deg, #10b981 0%, #059669 100%); }
.toast-error { background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%); }
.toast-info { background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%); }

/* Helper classes */
.mb-4 { margin-bottom: 24px; }
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-muted { color: var(--text-secondary); }
.hidden { display: none !important; }

/* Animations */
@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes slideUp {
  from { transform: translateY(30px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

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

@keyframes fadeOut {
  from { opacity: 1; }
  to { opacity: 0; }
}
