/* ==========================================================================
   Balaji Employee Attendance System - Custom Stylesheet (Vanilla CSS)
   ========================================================================== */

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

/* --- Design System / CSS Variables --- */
:root {
  --font-family: 'Outfit', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  
  /* Color Palette */
  --bg-primary: #0a0b10;
  --bg-secondary: #12141d;
  --bg-tertiary: #1b1e2e;
  
  --card-bg: rgba(22, 25, 37, 0.55);
  --card-border: rgba(255, 255, 255, 0.07);
  --card-hover-border: rgba(139, 92, 246, 0.3);
  
  --text-primary: #f3f4f6;
  --text-secondary: #9ca3af;
  --text-muted: #6b7280;
  
  --color-violet: #8b5cf6;
  --color-violet-glow: rgba(139, 92, 246, 0.15);
  --color-cyan: #06b6d4;
  --color-cyan-glow: rgba(6, 182, 212, 0.15);
  
  --color-success: #10b981;
  --color-success-glow: rgba(16, 185, 129, 0.15);
  --color-warning: #f59e0b;
  --color-danger: #ef4444;
  
  /* Layout Sizing */
  --sidebar-width: 260px;
  --header-height: 70px;
  --border-radius-sm: 8px;
  --border-radius-md: 16px;
  --border-radius-lg: 24px;
  
  /* Transitions */
  --transition-fast: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-normal: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-slow: 0.5s cubic-bezier(0.4, 0, 0.2, 1);
  
  /* Shadows */
  --glow-shadow: 0 0 20px rgba(139, 92, 246, 0.2);
  --inset-glow: inset 0 1px 1px rgba(255, 255, 255, 0.05);
}

/* --- Base Resets & Global Styles --- */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

body {
  font-family: var(--font-family);
  background-color: var(--bg-primary);
  background-image: 
    radial-gradient(at 0% 0%, rgba(139, 92, 246, 0.08) 0px, transparent 50%),
    radial-gradient(at 100% 100%, rgba(6, 182, 212, 0.08) 0px, transparent 50%);
  background-attachment: fixed;
  color: var(--text-primary);
  overflow-x: hidden;
  height: 100vh;
  display: flex;
  flex-direction: row;
}

button, input, select {
  font-family: inherit;
  color: inherit;
  outline: none;
}

a {
  text-decoration: none;
  color: inherit;
}

/* --- Scrollbars --- */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
::-webkit-scrollbar-track {
  background: var(--bg-primary);
}
::-webkit-scrollbar-thumb {
  background: var(--bg-tertiary);
  border-radius: var(--border-radius-sm);
}
::-webkit-scrollbar-thumb:hover {
  background: var(--color-violet);
}

/* --- App Layout System --- */

/* Sidebar Navigation */
.sidebar {
  width: var(--sidebar-width);
  background: rgba(18, 20, 29, 0.8);
  border-right: 1px solid var(--card-border);
  backdrop-filter: blur(20px);
  padding: 2rem 1.5rem;
  display: flex;
  flex-direction: column;
  height: 100vh;
  z-index: 100;
  flex-shrink: 0;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 3rem;
}

.brand-icon {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--color-violet), var(--color-cyan));
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--glow-shadow);
  color: white;
}

.brand-name {
  font-weight: 800;
  font-size: 1.25rem;
  letter-spacing: -0.5px;
  background: linear-gradient(to right, #ffffff, #d8b4fe);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.nav-menu {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  flex-grow: 1;
}

.nav-item button {
  width: 100%;
  background: transparent;
  border: none;
  padding: 0.85rem 1rem;
  border-radius: var(--border-radius-md);
  display: flex;
  align-items: center;
  gap: 1rem;
  cursor: pointer;
  text-align: left;
  font-weight: 500;
  font-size: 0.95rem;
  color: var(--text-secondary);
  transition: var(--transition-fast);
  border: 1px solid transparent;
}

.nav-item button svg {
  width: 20px;
  height: 20px;
  stroke: var(--text-secondary);
  transition: var(--transition-fast);
}

.nav-item button:hover {
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.03);
}

.nav-item.active button {
  color: white;
  background: var(--color-violet-glow);
  border-color: rgba(139, 92, 246, 0.2);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.1);
}

.nav-item.active button svg {
  stroke: var(--color-violet);
  filter: drop-shadow(0 0 5px var(--color-violet));
}

.sidebar-footer {
  margin-top: auto;
  font-size: 0.75rem;
  color: var(--text-muted);
  text-align: center;
  border-top: 1px solid var(--card-border);
  padding-top: 1.5rem;
}

/* Mobile Bottom Navigation Bar (Hidden on Desktop) */
.mobile-nav {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 65px;
  background: rgba(18, 20, 29, 0.95);
  backdrop-filter: blur(20px);
  border-top: 1px solid var(--card-border);
  z-index: 1000;
  justify-content: space-around;
  align-items: center;
  padding: 0 1rem;
}

.mobile-nav-item {
  background: transparent;
  border: none;
  color: var(--text-secondary);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  font-size: 0.65rem;
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition-fast);
  width: 60px;
  height: 100%;
}

.mobile-nav-item svg {
  width: 20px;
  height: 20px;
  stroke: var(--text-secondary);
}

.mobile-nav-item.active {
  color: var(--color-violet);
}

.mobile-nav-item.active svg {
  stroke: var(--color-violet);
  filter: drop-shadow(0 0 4px var(--color-violet));
}

/* Main Content Area */
.main-wrapper {
  flex-grow: 1;
  display: flex;
  flex-direction: column;
  height: 100vh;
  overflow: hidden;
  position: relative;
}

/* Header */
.top-header {
  height: var(--header-height);
  padding: 0 2rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--card-border);
  background: rgba(10, 11, 16, 0.3);
  backdrop-filter: blur(10px);
  z-index: 90;
  flex-shrink: 0;
}

.page-title {
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: -0.5px;
}

.system-status {
  display: flex;
  align-items: center;
  gap: 1.5rem;
}

.live-clock {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--color-cyan);
  font-feature-settings: "tnum"; /* Tabular numbers for clock */
}

.status-indicator {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.85rem;
  background: rgba(16, 185, 129, 0.1);
  color: var(--color-success);
  padding: 0.35rem 0.85rem;
  border-radius: 50px;
  border: 1px solid rgba(16, 185, 129, 0.2);
  font-weight: 600;
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--color-success);
  box-shadow: 0 0 8px var(--color-success);
  animation: pulse 1.5s infinite alternate;
}

/* Scrollable Screen Content */
.screen-content {
  flex-grow: 1;
  overflow-y: auto;
  padding: 2rem;
  padding-bottom: 5rem; /* Space for mobile nav */
}

.app-screen {
  display: none;
  animation: fadeIn 0.4s ease;
}

.app-screen.active {
  display: block;
}

/* --- COMMON COMPONENTS --- */

/* Glass Cards */
.card {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: var(--border-radius-md);
  padding: 1.5rem;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  transition: border-color var(--transition-normal);
  position: relative;
  overflow: hidden;
  box-shadow: var(--inset-glow), 0 10px 30px -10px rgba(0,0,0,0.4);
}

.card:hover {
  border-color: var(--card-hover-border);
}

.card-title {
  font-size: 1.1rem;
  font-weight: 600;
  margin-bottom: 1rem;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

/* Inputs & Form Fields */
.form-group {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-bottom: 1.25rem;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

label {
  font-size: 0.85rem;
  color: var(--text-secondary);
  font-weight: 500;
}

input, select {
  background: var(--bg-tertiary);
  border: 1px solid var(--card-border);
  border-radius: var(--border-radius-sm);
  padding: 0.75rem 1rem;
  font-size: 0.95rem;
  color: white;
  transition: var(--transition-fast);
}

input:focus, select:focus {
  border-color: var(--color-violet);
  box-shadow: 0 0 0 2px var(--color-violet-glow);
}

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

.btn-primary {
  background: linear-gradient(135deg, var(--color-violet), #7c3aed);
  color: white;
  box-shadow: var(--glow-shadow);
}
.btn-primary:hover {
  transform: translateY(-2px);
  filter: brightness(1.1);
}
.btn-primary:active {
  transform: translateY(0);
}

.btn-secondary {
  background: var(--bg-tertiary);
  border: 1px solid var(--card-border);
  color: var(--text-primary);
}
.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.05);
  border-color: var(--text-secondary);
}

.btn-danger {
  background: rgba(239, 68, 68, 0.1);
  border: 1px solid rgba(239, 68, 68, 0.2);
  color: var(--color-danger);
}
.btn-danger:hover {
  background: var(--color-danger);
  color: white;
}

.btn-icon {
  padding: 0.6rem;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

/* Badges */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 0.25rem 0.75rem;
  border-radius: 50px;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: capitalize;
}

.badge-present {
  background: rgba(16, 185, 129, 0.15);
  color: var(--color-success);
  border: 1px solid rgba(16, 185, 129, 0.2);
}

.badge-checked-out {
  background: rgba(156, 163, 175, 0.15);
  color: var(--text-secondary);
  border: 1px solid rgba(156, 163, 175, 0.2);
}

/* ==========================================================================
   SCREEN: DASHBOARD
   ========================================================================== */

/* Stat Cards Row */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1.5rem;
  margin-bottom: 2rem;
}

.stat-card {
  display: flex;
  align-items: center;
  gap: 1.25rem;
}

.stat-icon {
  width: 50px;
  height: 50px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.stat-icon-violet {
  background: rgba(139, 92, 246, 0.1);
  color: var(--color-violet);
  border: 1px solid rgba(139, 92, 246, 0.2);
}

.stat-icon-cyan {
  background: rgba(6, 182, 212, 0.1);
  color: var(--color-cyan);
  border: 1px solid rgba(6, 182, 212, 0.2);
}

.stat-icon-success {
  background: rgba(16, 185, 129, 0.1);
  color: var(--color-success);
  border: 1px solid rgba(16, 185, 129, 0.2);
}

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

.stat-value {
  font-size: 1.75rem;
  font-weight: 700;
  line-height: 1.2;
}

.stat-label {
  font-size: 0.8rem;
  color: var(--text-secondary);
  font-weight: 500;
}

/* Main Dashboard Panels */
.dashboard-layout {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 1.5rem;
  align-items: start;
}

.settings-layout {
  display: grid;
  grid-template-columns: 1.2fr 0.8fr;
  gap: 1.5rem;
  align-items: start;
}

.settings-full-width {
  grid-column: 1 / -1;
}

.salary-summary-chart {
  height: 250px;
  width: 100%;
  display: flex;
  align-items: flex-end;
  justify-content: space-around;
  padding-top: 1.5rem;
}

.chart-bar-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  height: 100%;
  justify-content: flex-end;
  flex-grow: 1;
}

.chart-bar {
  width: 32px;
  background: linear-gradient(to top, var(--color-violet), var(--color-cyan));
  border-radius: 6px 6px 0 0;
  min-height: 5px;
  transition: height var(--transition-slow) ease;
  position: relative;
  cursor: pointer;
}

.chart-bar:hover {
  filter: brightness(1.2);
}

.chart-bar-tooltip {
  position: absolute;
  top: -30px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--bg-secondary);
  border: 1px solid var(--card-border);
  padding: 3px 6px;
  border-radius: 4px;
  font-size: 0.7rem;
  white-space: nowrap;
  opacity: 0;
  transition: opacity var(--transition-fast);
  pointer-events: none;
}

.chart-bar:hover .chart-bar-tooltip {
  opacity: 1;
}

.chart-label {
  margin-top: 0.5rem;
  font-size: 0.75rem;
  color: var(--text-secondary);
  max-width: 60px;
  text-align: center;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.recent-activity-list {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.activity-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}

.activity-item:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

.activity-details {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.activity-name {
  font-size: 0.9rem;
  font-weight: 600;
}

.activity-time {
  font-size: 0.75rem;
  color: var(--text-secondary);
}

.activity-badge {
  font-size: 0.7rem;
  padding: 2px 6px;
  border-radius: 4px;
  font-weight: bold;
}

.activity-in {
  background: rgba(16, 185, 129, 0.1);
  color: var(--color-success);
}

.activity-out {
  background: rgba(6, 182, 212, 0.1);
  color: var(--color-cyan);
}

/* ==========================================================================
   SCREEN: ATTENDANCE SCANNER
   ========================================================================== */
.attendance-layout {
  display: grid;
  grid-template-columns: 1.2fr 0.8fr;
  gap: 2rem;
  align-items: start;
}

.camera-card {
  display: flex;
  flex-direction: column;
  align-items: center;
}

/* Camera Frame Container */
.camera-container {
  width: 100%;
  aspect-ratio: 4/3;
  max-width: 640px;
  background: #000;
  border-radius: var(--border-radius-md);
  position: relative;
  overflow: hidden;
  border: 1px solid var(--card-border);
  box-shadow: inset 0 0 20px rgba(0, 0, 0, 0.8);
}

#camera-stream {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* Dynamic scanner overlay */
.scanner-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.scanner-frame {
  width: 60%;
  aspect-ratio: 1/1;
  max-width: 280px;
  border: 2px dashed rgba(6, 182, 212, 0.4);
  border-radius: 50%;
  box-shadow: 0 0 0 9999px rgba(0, 0, 0, 0.4);
  position: relative;
  animation: radar-glow 2s infinite alternate;
}

/* Scanning glowing line moving down/up */
.scanner-line {
  position: absolute;
  width: 100%;
  height: 3px;
  background: linear-gradient(to right, transparent, var(--color-cyan), transparent);
  top: 0;
  left: 0;
  animation: scan-line 3s linear infinite;
  box-shadow: 0 0 8px var(--color-cyan);
}

/* Camera Loading Overlay */
.camera-loading {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: var(--bg-secondary);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1.5rem;
  z-index: 5;
  transition: opacity var(--transition-normal);
}

.loader-spinner {
  width: 48px;
  height: 48px;
  border: 4px solid var(--card-border);
  border-top-color: var(--color-violet);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

.loading-text {
  font-size: 0.95rem;
  color: var(--text-secondary);
  font-weight: 500;
}

/* Matches Overlay Success */
.scan-match-success {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(16, 185, 129, 0.85);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  opacity: 0;
  pointer-events: none;
  z-index: 10;
  transition: opacity var(--transition-fast);
}

.scan-match-success.show {
  opacity: 1;
}

.success-check-circle {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  background: white;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--color-success);
  box-shadow: 0 10px 20px rgba(0, 0, 0, 0.1);
  transform: scale(0.6);
  transition: transform var(--transition-normal) cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.scan-match-success.show .success-check-circle {
  transform: scale(1);
}

/* Control Trigger Buttons */
.camera-controls {
  width: 100%;
  margin-top: 1.5rem;
  display: flex;
  gap: 1rem;
  justify-content: center;
}

.camera-guide-text {
  text-align: center;
  color: var(--text-secondary);
  font-size: 0.85rem;
  margin-top: 1rem;
}

/* Result Dashboard */
.scan-result-card {
  display: flex;
  flex-direction: column;
  height: 100%;
}

.result-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 4rem 2rem;
  color: var(--text-muted);
  flex-grow: 1;
}

.result-placeholder svg {
  width: 48px;
  height: 48px;
  margin-bottom: 1rem;
  stroke: var(--text-muted);
}

.employee-card-details {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.employee-photo-container {
  display: flex;
  justify-content: center;
}

.employee-avatar-preview {
  width: 120px;
  height: 120px;
  border-radius: var(--border-radius-md);
  border: 2px solid var(--color-violet);
  object-fit: cover;
  box-shadow: 0 5px 15px rgba(139, 92, 246, 0.3);
}

.detail-table {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  border-top: 1px solid var(--card-border);
  border-bottom: 1px solid var(--card-border);
  padding: 1rem 0;
}

.detail-row {
  display: flex;
  justify-content: space-between;
  font-size: 0.95rem;
}

.detail-label {
  color: var(--text-secondary);
}

.detail-val {
  font-weight: 600;
}

.wage-breakdown {
  background: var(--bg-tertiary);
  padding: 1rem;
  border-radius: var(--border-radius-sm);
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  border-left: 3px solid var(--color-cyan);
}

.wage-breakdown-row {
  display: flex;
  justify-content: space-between;
  font-size: 0.85rem;
}

.location-marker {
  font-size: 0.8rem;
  color: var(--color-cyan);
  display: flex;
  align-items: center;
  gap: 0.25rem;
  margin-top: 0.25rem;
}

/* ==========================================================================
   SCREEN: REGISTRATION & DIRECTORIES
   ========================================================================== */
.register-layout {
  display: grid;
  grid-template-columns: 1fr 1.2fr;
  gap: 2rem;
  align-items: start;
}

/* Reg Camera View */
.reg-camera-container {
  position: relative;
  width: 100%;
  aspect-ratio: 4/3;
  background: #000;
  border-radius: var(--border-radius-sm);
  overflow: hidden;
  margin-bottom: 1rem;
}

#reg-video {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

#reg-canvas {
  display: none;
}

.reg-snap-preview {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: none;
}

.reg-camera-controls {
  display: flex;
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.employee-directory {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 1.5rem;
  margin-top: 2rem;
}

.employee-directory-card {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.directory-avatar {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--card-border);
}

.directory-info {
  display: flex;
  flex-direction: column;
  flex-grow: 1;
  min-width: 0; /* truncate text inside flex box */
}

.directory-name {
  font-weight: 600;
  font-size: 1rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.directory-contact {
  font-size: 0.75rem;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.directory-wage {
  font-size: 0.8rem;
  color: var(--color-cyan);
  font-weight: 500;
  margin-top: 2px;
}

/* ==========================================================================
   SCREEN: TABLES & LOGS VIEW (REPORTS)
   ========================================================================== */
.reports-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  margin-bottom: 1.5rem;
  align-items: flex-end;
  background: var(--bg-secondary);
  padding: 1rem;
  border-radius: var(--border-radius-sm);
  border: 1px solid var(--card-border);
}

.toolbar-group {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.table-container {
  width: 100%;
  overflow-x: auto;
  border-radius: var(--border-radius-sm);
  border: 1px solid var(--card-border);
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 0.9rem;
}

.data-table th, .data-table td {
  padding: 1rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}

.data-table th {
  background: var(--bg-tertiary);
  color: var(--text-secondary);
  font-weight: 600;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.data-table tbody tr {
  transition: var(--transition-fast);
}

.data-table tbody tr:hover {
  background: rgba(255, 255, 255, 0.02);
}

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

.table-action-btn {
  background: transparent;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  padding: 0.25rem;
  border-radius: 4px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition-fast);
}

.table-action-btn:hover {
  color: var(--color-danger);
  background: rgba(239, 68, 68, 0.1);
}

.table-map-link {
  color: var(--color-cyan);
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  font-weight: 500;
}

.table-map-link:hover {
  text-decoration: underline;
}

/* ==========================================================================
   ANIMATIONS & EFFECTS
   ========================================================================== */

@keyframes pulse {
  0% { opacity: 0.5; }
  100% { opacity: 1; }
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

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

@keyframes radar-glow {
  0% { border-color: rgba(6, 182, 212, 0.2); box-shadow: 0 0 10px rgba(6, 182, 212, 0.1); }
  100% { border-color: rgba(6, 182, 212, 0.7); box-shadow: 0 0 25px rgba(6, 182, 212, 0.3); }
}

@keyframes scan-line {
  0% { top: 0%; }
  50% { top: 100%; }
  100% { top: 0%; }
}

/* ==========================================================================
   RESPONSIVE DESIGN (MEDIA QUERIES)
   ========================================================================== */

/* --- Tablet Devices --- */
@media (max-width: 1024px) {
  :root {
    --sidebar-width: 220px;
  }
  
  .dashboard-layout {
    grid-template-columns: 1fr;
  }
  
  .attendance-layout {
    grid-template-columns: 1fr;
  }
  
  .register-layout {
    grid-template-columns: 1fr;
  }

  .settings-layout {
    grid-template-columns: 1fr;
  }

  .settings-full-width {
    grid-column: auto;
  }
}

/* --- Mobile Devices --- */
@media (max-width: 768px) {
  body {
    flex-direction: column;
  }
  
  /* Hide sidebar on mobile */
  .sidebar {
    display: none;
  }
  
  /* Show bottom navigation bar on mobile */
  .mobile-nav {
    display: flex;
  }
  
  /* Header styling on mobile */
  .top-header {
    height: auto;
    min-height: 70px;
    padding: 0.75rem 1rem;
    flex-direction: row;
    justify-content: space-between;
    align-items: center;
    gap: 0.5rem;
  }
  
  .page-title {
    font-size: 1.1rem;
    font-weight: 800;
    max-width: 45%;
    line-height: 1.2;
  }
  
  .system-status {
    flex-direction: column;
    align-items: flex-end;
    gap: 4px;
  }
  
  .live-clock {
    font-size: 0.9rem;
  }
  
  .status-indicator {
    padding: 0.2rem 0.5rem;
    font-size: 0.65rem;
  }
  
  /* Content container spacing */
  .screen-content {
    padding: 1rem;
    padding-bottom: 80px; /* Buffer for bottom nav */
  }
  
  .stats-grid {
    grid-template-columns: 1fr 1fr;
    gap: 0.75rem;
    margin-bottom: 1rem;
  }
  
  .stat-card {
    padding: 1rem;
    gap: 0.75rem;
  }
  
  .stat-value {
    font-size: 1.35rem;
  }
  
  .stat-icon {
    width: 40px;
    height: 40px;
  }
  
  .form-row {
    grid-template-columns: 1fr;
    gap: 0;
  }
  
  .reports-toolbar {
    flex-direction: column;
    align-items: stretch;
  }
  
  .toolbar-group {
    width: 100%;
  }

  /* Table-to-Card Responsive Design for Mobile */
  .table-container {
    border: none;
    overflow-x: visible;
  }

  .data-table, 
  .data-table thead, 
  .data-table tbody, 
  .data-table th, 
  .data-table td, 
  .data-table tr {
    display: block;
  }

  .data-table thead {
    position: absolute;
    top: -9999px;
    left: -9999px;
  }

  .data-table tbody tr {
    background: rgba(22, 25, 37, 0.45);
    border: 1px solid var(--card-border);
    border-radius: var(--border-radius-md);
    margin-bottom: 1.25rem;
    padding: 0.75rem 1rem;
    box-shadow: 0 4px 15px rgba(0,0,0,0.15);
    transition: border-color var(--transition-fast);
  }

  .data-table tbody tr:hover {
    border-color: var(--color-violet-glow);
    background: rgba(22, 25, 37, 0.6);
  }

  .data-table td {
    border: none;
    border-bottom: 1px solid rgba(255, 255, 255, 0.04);
    position: relative;
    padding: 0.75rem 0.5rem 0.75rem 45%;
    text-align: right;
    font-size: 0.85rem;
    min-height: 2.5rem;
    display: flex;
    justify-content: flex-end;
    align-items: center;
  }

  .data-table td:last-child {
    border-bottom: none;
  }

  .data-table td::before {
    content: attr(data-label);
    position: absolute;
    left: 0.5rem;
    width: 40%;
    text-align: left;
    font-weight: 600;
    color: var(--text-secondary);
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
  }

  /* Large Touch Inputs & Tap Targets for Mobile */
  input, select {
    padding: 0.85rem 1.1rem;
    font-size: 0.95rem;
  }

  .btn {
    padding: 0.85rem 1.5rem;
    font-size: 0.95rem;
  }

  /* Slick Bottom Navigation Glow & Scale */
  .mobile-nav {
    border-top: 1px solid rgba(139, 92, 246, 0.15);
    box-shadow: 0 -5px 25px rgba(0, 0, 0, 0.9), 0 0 15px rgba(139, 92, 246, 0.08);
  }

  .mobile-nav-item svg {
    transition: transform var(--transition-fast);
  }

  .mobile-nav-item.active svg {
    transform: translateY(-2px) scale(1.15);
  }
  
  .scanner-frame {
    width: 75%;
    max-width: 240px;
  }
  
  .camera-controls {
    flex-direction: column;
    width: 100%;
    gap: 0.75rem;
  }
  
  .camera-controls button {
    width: 100%;
  }
}

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

/* Present Today Stat Card Interaction */
#card-present-today:hover {
  transform: translateY(-4px);
  border-color: var(--color-cyan) !important;
  box-shadow: 0 8px 25px rgba(6, 182, 212, 0.15);
}

/* Presence Modal Overlay */
.modal-overlay {
  position: fixed !important;
  top: 0 !important;
  left: 0 !important;
  width: 100vw !important;
  height: 100vh !important;
  background: rgba(10, 11, 16, 0.85) !important;
  backdrop-filter: blur(8px) !important;
  -webkit-backdrop-filter: blur(8px) !important;
  z-index: 2000 !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--transition-normal);
  padding: 1.5rem;
}

.modal-overlay.show {
  opacity: 1;
  pointer-events: auto;
}

.modal-content {
  width: 100%;
  max-width: 800px;
  max-height: 85vh;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  background: rgba(22, 25, 37, 0.9) !important;
  border: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5), var(--inset-glow);
  transform: scale(0.9);
  transition: transform var(--transition-normal) cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.modal-overlay.show .modal-content {
  transform: scale(1);
}

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

.modal-close {
  background: transparent;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  padding: 0.5rem;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition-fast);
}

.modal-close:hover {
  background: rgba(255, 255, 255, 0.05);
  color: white;
}

.presence-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 1.25rem;
  overflow-y: auto;
  padding-right: 0.5rem;
  max-height: 60vh;
}

.presence-emp-card {
  background: var(--bg-secondary);
  border: 1px solid var(--card-border);
  border-radius: var(--border-radius-md);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  box-shadow: 0 4px 15px rgba(0,0,0,0.1);
  transition: border-color var(--transition-fast);
}

.presence-emp-card:hover {
  border-color: var(--color-cyan);
}

.presence-photo-wrapper {
  position: relative;
  width: 100%;
  aspect-ratio: 4/3;
  background: black;
}

.presence-photo {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.presence-time-tag {
  position: absolute;
  bottom: 0.5rem;
  right: 0.5rem;
  background: rgba(10, 11, 16, 0.75);
  backdrop-filter: blur(4px);
  color: var(--color-cyan);
  font-size: 0.7rem;
  font-weight: 600;
  padding: 0.2rem 0.5rem;
  border-radius: 4px;
  border: 1px solid rgba(6, 182, 212, 0.2);
}

.presence-details {
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.presence-name {
  font-weight: 700;
  font-size: 0.95rem;
  color: white;
}

.presence-loc {
  font-size: 0.75rem;
  color: var(--text-secondary);
  display: flex;
  align-items: flex-start;
  gap: 4px;
  line-height: 1.3;
}

/* Secure Login Portal Styles */
.login-portal {
  position: fixed !important;
  top: 0 !important;
  left: 0 !important;
  width: 100vw !important;
  height: 100vh !important;
  background: radial-gradient(circle at center, #111422 0%, #07080c 100%) !important;
  z-index: 5000 !important;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  transition: opacity 0.3s ease, visibility 0.3s ease;
}

.login-box {
  width: 100%;
  max-width: 400px;
  background: rgba(22, 25, 37, 0.75) !important;
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(255, 255, 255, 0.08);
  padding: 2.5rem 2rem !important;
  display: flex;
  flex-direction: column;
  align-items: center;
  border-radius: var(--border-radius-md);
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5), var(--inset-glow);
}

.login-logo-container {
  position: relative;
  width: 72px;
  height: 72px;
  border-radius: 50%;
  background: rgba(139, 92, 246, 0.1);
  border: 1px solid rgba(139, 92, 246, 0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 1.25rem;
}

.login-logo-glow {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  box-shadow: 0 0 20px rgba(139, 92, 246, 0.35);
  animation: pulse 2s infinite alternate;
}

.login-title {
  font-size: 1.4rem;
  font-weight: 800;
  color: white;
  text-align: center;
  margin-bottom: 0.25rem;
  line-height: 1.2;
}

.login-subtitle {
  font-size: 0.75rem;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 1.5px;
  margin-bottom: 2rem;
  font-weight: 600;
}

.login-error-msg {
  width: 100%;
  background: rgba(239, 68, 68, 0.1);
  border: 1px solid rgba(239, 68, 68, 0.2);
  color: var(--color-danger);
  padding: 0.75rem 1rem;
  border-radius: var(--border-radius-sm);
  font-size: 0.85rem;
  font-weight: 500;
  margin-bottom: 1.5rem;
  display: none;
  text-align: center;
}

.login-form {
  width: 100%;
}

.input-icon-wrapper {
  position: relative;
  width: 100%;
}

.input-icon {
  position: absolute;
  left: 1rem;
  top: 50%;
  transform: translateY(-50%);
  width: 16px;
  height: 16px;
  color: var(--text-muted);
}

.input-icon-wrapper input {
  padding-left: 2.75rem !important;
  width: 100%;
}

.login-btn {
  margin-top: 1.5rem;
  width: 100%;
}


