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

:root {
  --font-family: 'Cairo', sans-serif;
  --bg-primary: #0f172a;
  --bg-secondary: #1e293b;
  --bg-card: rgba(30, 41, 59, 0.7);
  --border-color: rgba(255, 255, 255, 0.08);
  --text-primary: #f8fafc;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  
  --primary: #3b82f6;
  --primary-hover: #2563eb;
  --primary-gradient: linear-gradient(135deg, #3b82f6 0%, #8b5cf6 100%);
  --success: #10b981;
  --success-gradient: linear-gradient(135deg, #10b981 0%, #059669 100%);
  --danger: #ef4444;
  --danger-gradient: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
  --warning: #f59e0b;
  --warning-gradient: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
  --info: #06b6d4;
  
  --shadow-sm: 0 1px 2px 0 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.3), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
  --shadow-glow: 0 0 15px rgba(59, 130, 246, 0.4);
  
  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: var(--font-family);
  background-color: var(--bg-primary);
  color: var(--text-primary);
  direction: rtl;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
  position: relative;
}

/* Background blob decorations for premium look */
body::before, body::after {
  content: '';
  position: absolute;
  width: 300px;
  height: 300px;
  border-radius: 50%;
  filter: blur(120px);
  z-index: -1;
  opacity: 0.3;
  pointer-events: none;
}

body::before {
  top: 10%;
  right: 10%;
  background: var(--primary);
}

body::after {
  bottom: 10%;
  left: 5%;
  background: #8b5cf6;
}

/* Common Layout */
.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 20px;
  width: 100%;
}

header {
  background: rgba(15, 23, 42, 0.8);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border-color);
  padding: 15px 0;
  position: sticky;
  top: 0;
  z-index: 100;
}

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

.logo-section {
  display: flex;
  align-items: center;
  gap: 12px;
}

.logo-icon {
  background: var(--primary-gradient);
  width: 40px;
  height: 40px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 20px;
  box-shadow: var(--shadow-glow);
}

.logo-text {
  font-size: 20px;
  font-weight: 700;
  letter-spacing: 0.5px;
}

.user-info-bar {
  display: flex;
  align-items: center;
  gap: 15px;
}

/* Typography */
h1, h2, h3, h4 {
  font-weight: 700;
  line-height: 1.3;
}

/* Cards & Containers */
.glass-card {
  background: var(--bg-card);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 30px;
  box-shadow: var(--shadow-lg);
  margin-bottom: 25px;
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.glass-card:hover {
  transform: translateY(-2px);
}

/* Buttons */
.btn {
  font-family: var(--font-family);
  font-size: 15px;
  font-weight: 600;
  padding: 10px 20px;
  border-radius: var(--radius-md);
  border: none;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  text-decoration: none;
}

.btn-primary {
  background: var(--primary-gradient);
  color: white;
  box-shadow: 0 4px 15px rgba(59, 130, 246, 0.3);
}

.btn-primary:hover {
  box-shadow: 0 6px 20px rgba(59, 130, 246, 0.45);
  transform: translateY(-1px);
}

.btn-success {
  background: var(--success-gradient);
  color: white;
  box-shadow: 0 4px 15px rgba(16, 185, 129, 0.3);
}

.btn-success:hover {
  box-shadow: 0 6px 20px rgba(16, 185, 129, 0.45);
  transform: translateY(-1px);
}

.btn-danger {
  background: var(--danger-gradient);
  color: white;
  box-shadow: 0 4px 15px rgba(239, 68, 68, 0.3);
}

.btn-danger:hover {
  box-shadow: 0 6px 20px rgba(239, 68, 68, 0.45);
  transform: translateY(-1px);
}

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

.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.05);
}

.btn-icon {
  width: 38px;
  height: 38px;
  padding: 0;
  border-radius: 50%;
}

/* Forms */
.form-group {
  margin-bottom: 20px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

label {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-secondary);
}

.form-control {
  font-family: var(--font-family);
  background: rgba(15, 23, 42, 0.6);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 12px 16px;
  color: var(--text-primary);
  font-size: 15px;
  transition: all 0.2s ease;
  outline: none;
}

.form-control:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.25);
  background: rgba(15, 23, 42, 0.9);
}

/* Login/Authorize Page Centered Box */
.auth-wrapper {
  display: flex;
  align-items: center;
  justify-content: center;
  flex: 1;
  padding: 20px;
}

.auth-card {
  width: 100%;
  max-width: 440px;
  padding: 40px;
}

.auth-header {
  text-align: center;
  margin-bottom: 30px;
}

.auth-header h1 {
  font-size: 26px;
  margin-top: 15px;
  margin-bottom: 8px;
}

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

/* Dashboard Layout */
.dashboard-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 25px;
}

@media (min-width: 768px) {
  .dashboard-grid {
    grid-template-columns: 1fr 2fr;
  }
  
  .dashboard-grid.admin {
    grid-template-columns: 1fr;
  }
}

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

.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 20px;
  display: flex;
  align-items: center;
  gap: 15px;
}

.stat-icon {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
}

.stat-icon.primary { background: rgba(59, 130, 246, 0.15); color: var(--primary); }
.stat-icon.success { background: rgba(16, 185, 129, 0.15); color: var(--success); }
.stat-icon.danger { background: rgba(239, 68, 68, 0.15); color: var(--danger); }
.stat-icon.warning { background: rgba(245, 158, 11, 0.15); color: var(--warning); }

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

.stat-label {
  font-size: 13px;
  color: var(--text-secondary);
}

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

/* Attendance Buttons Area */
.attendance-panel {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 40px 20px;
  position: relative;
}

.clock-display {
  font-size: 42px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  margin-bottom: 5px;
  background: linear-gradient(to bottom, #ffffff, #94a3b8);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.date-display {
  color: var(--text-secondary);
  font-size: 15px;
  margin-bottom: 30px;
}

.action-buttons {
  display: flex;
  gap: 20px;
  width: 100%;
  max-width: 320px;
}

.action-buttons .btn {
  flex: 1;
  height: 54px;
  font-size: 16px;
}

/* Tables */
.table-container {
  overflow-x: auto;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  background: rgba(15, 23, 42, 0.3);
}

table {
  width: 100%;
  border-collapse: collapse;
  text-align: right;
  font-size: 14px;
}

th {
  background: var(--bg-secondary);
  color: var(--text-primary);
  font-weight: 600;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border-color);
}

td {
  padding: 14px 18px;
  border-bottom: 1px solid var(--border-color);
  color: var(--text-secondary);
}

tr:last-child td {
  border-bottom: none;
}

tr:hover td {
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.02);
}

/* Badges */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
}

.badge-success { background: rgba(16, 185, 129, 0.15); color: #34d399; }
.badge-danger { background: rgba(239, 68, 68, 0.15); color: #f87171; }
.badge-warning { background: rgba(245, 158, 11, 0.15); color: #fbbf24; }
.badge-info { background: rgba(6, 182, 212, 0.15); color: #22d3ee; }

/* Notifications / Alerts Panel */
.notifications-list {
  display: flex;
  flex-direction: column;
  gap: 15px;
  max-height: 400px;
  overflow-y: auto;
  padding-left: 5px;
}

.notification-item {
  padding: 15px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  gap: 8px;
  background: rgba(30, 41, 59, 0.4);
  position: relative;
  transition: all 0.2s ease;
}

.notification-item.unread {
  border-right: 4px solid var(--primary);
  background: rgba(59, 130, 246, 0.06);
}

.notification-item.reward {
  border-right: 4px solid var(--success);
  background: rgba(16, 185, 129, 0.04);
}

.notification-item.warning {
  border-right: 4px solid var(--danger);
  background: rgba(239, 68, 68, 0.04);
}

.notification-item .meta {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  color: var(--text-muted);
}

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

.notification-title {
  font-weight: 600;
  font-size: 14px;
}

.notification-body {
  font-size: 13.5px;
  color: var(--text-primary);
  line-height: 1.5;
}

/* Modals */
.modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(15, 23, 42, 0.85);
  backdrop-filter: blur(8px);
  z-index: 1000;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.modal.active {
  display: flex;
}

.modal-content {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  max-width: 500px;
  width: 100%;
  box-shadow: var(--shadow-lg);
  overflow: hidden;
}

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

.modal-body {
  padding: 25px;
}

.modal-footer {
  padding: 15px 25px;
  border-top: 1px solid var(--border-color);
  display: flex;
  justify-content: flex-end;
  gap: 15px;
  background: rgba(15, 23, 42, 0.2);
}

.close-btn {
  background: none;
  border: none;
  color: var(--text-secondary);
  font-size: 24px;
  cursor: pointer;
}

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

/* Tab systems */
.tab-container {
  display: flex;
  gap: 10px;
  border-bottom: 1px solid var(--border-color);
  margin-bottom: 25px;
}

.tab-btn {
  font-family: var(--font-family);
  background: none;
  border: none;
  color: var(--text-secondary);
  font-size: 15px;
  font-weight: 600;
  padding: 12px 18px;
  cursor: pointer;
  position: relative;
  transition: all 0.2s ease;
}

.tab-btn::after {
  content: '';
  position: absolute;
  bottom: -1px;
  left: 0;
  width: 100%;
  height: 3px;
  background: var(--primary);
  border-radius: 3px 3px 0 0;
  transform: scaleX(0);
  transition: transform 0.25s ease;
}

.tab-btn.active {
  color: var(--text-primary);
}

.tab-btn.active::after {
  transform: scaleX(1);
}

.tab-pane {
  display: none;
}

.tab-pane.active {
  display: block;
}

/* Alert notifications popup client-side */
.toast {
  position: fixed;
  bottom: 20px;
  left: 20px;
  padding: 15px 25px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  color: white;
  z-index: 10000;
  display: flex;
  align-items: center;
  gap: 12px;
  transform: translateY(100px);
  opacity: 0;
  transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.toast.active {
  transform: translateY(0);
  opacity: 1;
}

.toast.success { border-right: 4px solid var(--success); }
.toast.danger { border-right: 4px solid var(--danger); }
.toast.warning { border-right: 4px solid var(--warning); }

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

::-webkit-scrollbar-track {
  background: var(--bg-primary);
}

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

::-webkit-scrollbar-thumb:hover {
  background: var(--text-muted);
}

/* --- LIGHT THEME OVERRIDES --- */
[data-theme="light"] {
  --bg-primary: #f8fafc;
  --bg-secondary: #ffffff;
  --bg-card: rgba(255, 255, 255, 0.8);
  --border-color: rgba(15, 23, 42, 0.08);
  --text-primary: #0f172a;
  --text-secondary: #475569;
  --text-muted: #94a3b8;
}

[data-theme="light"]::before, [data-theme="light"]::after {
  opacity: 0.15;
}

[data-theme="light"] header {
  background: rgba(255, 255, 255, 0.85);
}

[data-theme="light"] .form-control {
  background: rgba(241, 245, 249, 0.8);
  color: var(--text-primary);
  border-color: rgba(15, 23, 42, 0.12);
}

[data-theme="light"] .form-control:focus {
  background: #ffffff;
  border-color: var(--primary);
}

[data-theme="light"] th {
  background: #f1f5f9;
  color: var(--text-primary);
}

[data-theme="light"] tr:hover td {
  background: rgba(15, 23, 42, 0.02);
}

[data-theme="light"] .clock-display {
  background: linear-gradient(to bottom, #0f172a, #334155);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

[data-theme="light"] .toast {
  background: #ffffff;
  color: #0f172a;
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.1);
}

[data-theme="light"] .table-container {
  background: rgba(255, 255, 255, 0.6);
}

/* Theme Toggle Button Style */
.theme-toggle-btn {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  border-radius: var(--radius-sm);
  padding: 6px 12px;
  font-size: 13px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: all 0.2s ease;
  font-family: var(--font-family);
  font-weight: 600;
}

.theme-toggle-btn:hover {
  background: rgba(120, 120, 120, 0.15);
}

