/* ==========================================================================
   ATTENDOPRO - SMART ATTENDANCE & PAYROLL MANAGEMENT SYSTEM
   Modern, Responsive, Glassmorphism & High-Performance Design System
   ========================================================================== */

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

:root {
  /* Color Palette - Dark Luxe Theme (Default) */
  --bg-primary: #0b0f19;
  --bg-secondary: #111827;
  --bg-card: rgba(17, 24, 39, 0.75);
  --bg-card-hover: rgba(30, 41, 59, 0.85);
  --bg-input: rgba(15, 23, 42, 0.8);
  --bg-glass: rgba(255, 255, 255, 0.03);
  
  --border-subtle: rgba(255, 255, 255, 0.08);
  --border-active: rgba(99, 102, 241, 0.4);
  --border-glass: rgba(255, 255, 255, 0.12);

  --text-primary: #f8fafc;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  --text-inverse: #0f172a;

  /* Brand Accents */
  --primary: #6366f1;
  --primary-hover: #4f46e5;
  --primary-glow: rgba(99, 102, 241, 0.25);
  
  --success: #10b981;
  --success-bg: rgba(16, 185, 129, 0.12);
  --success-glow: rgba(16, 185, 129, 0.3);

  --warning: #f59e0b;
  --warning-bg: rgba(245, 158, 11, 0.12);
  --warning-glow: rgba(245, 158, 11, 0.3);

  --danger: #ef4444;
  --danger-bg: rgba(239, 68, 68, 0.12);
  --danger-glow: rgba(239, 68, 68, 0.3);

  --info: #0ea5e9;
  --info-bg: rgba(14, 165, 233, 0.12);

  --purple: #a855f7;
  --purple-bg: rgba(168, 85, 247, 0.12);

  /* Gradients */
  --grad-primary: linear-gradient(135deg, #6366f1 0%, #a855f7 100%);
  --grad-success: linear-gradient(135deg, #10b981 0%, #059669 100%);
  --grad-danger: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
  --grad-warning: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
  --grad-surface: linear-gradient(180deg, rgba(30, 41, 59, 0.5) 0%, rgba(15, 23, 42, 0.7) 100%);

  /* Layout Dimensions */
  --sidebar-width: 270px;
  --header-height: 72px;
  --mobile-nav-height: 64px;
  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --radius-full: 9999px;

  /* Shadows */
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.25);
  --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.35);
  --shadow-lg: 0 16px 40px rgba(0, 0, 0, 0.45);
  --shadow-glow: 0 0 30px var(--primary-glow);

  /* Transitions */
  --trans-fast: 0.15s ease;
  --trans-normal: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  --trans-slow: 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Light Theme overrides */
[data-theme="light"] {
  --bg-primary: #f1f5f9;
  --bg-secondary: #ffffff;
  --bg-card: rgba(255, 255, 255, 0.85);
  --bg-card-hover: #ffffff;
  --bg-input: #ffffff;
  --bg-glass: rgba(0, 0, 0, 0.02);
  
  --border-subtle: rgba(0, 0, 0, 0.08);
  --border-active: rgba(99, 102, 241, 0.5);
  --border-glass: rgba(0, 0, 0, 0.1);

  --text-primary: #0f172a;
  --text-secondary: #475569;
  --text-muted: #94a3b8;
  --text-inverse: #f8fafc;

  --grad-surface: linear-gradient(180deg, #ffffff 0%, #f8fafc 100%);
  --shadow-md: 0 8px 24px rgba(100, 116, 139, 0.12);
  --shadow-lg: 0 16px 40px rgba(100, 116, 139, 0.18);
}

/* Reset & Base */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

html, body {
  width: 100%;
  min-height: 100vh;
  font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, sans-serif;
  background-color: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.5;
  overflow-x: hidden;
  font-size: 14.5px;
}

/* Custom Scrollbars */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
::-webkit-scrollbar-track {
  background: var(--bg-primary);
}
::-webkit-scrollbar-thumb {
  background: var(--border-glass);
  border-radius: var(--radius-full);
}
::-webkit-scrollbar-thumb:hover {
  background: var(--primary);
}

/* Typography Utilities */
h1, h2, h3, h4, h5, h6 {
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.25;
}
.font-mono {
  font-family: 'JetBrains Mono', monospace;
}

/* Background Ambient Glow */
.ambient-glow {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  pointer-events: none;
  z-index: 0;
  overflow: hidden;
}
.glow-orb-1 {
  position: absolute;
  top: -150px;
  right: 10%;
  width: 500px;
  height: 500px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(99, 102, 241, 0.15) 0%, rgba(0,0,0,0) 70%);
  filter: blur(60px);
}
.glow-orb-2 {
  position: absolute;
  bottom: 10%;
  left: -100px;
  width: 450px;
  height: 450px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(168, 85, 247, 0.12) 0%, rgba(0,0,0,0) 70%);
  filter: blur(60px);
}

/* App Container Layout */
#app-root {
  position: relative;
  z-index: 1;
  display: flex;
  min-height: 100vh;
}

/* ==========================================================================
   SIDEBAR NAVIGATION (Admin & Staff)
   ========================================================================== */
.app-sidebar {
  width: var(--sidebar-width);
  background: var(--bg-secondary);
  border-right: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  bottom: 0;
  left: 0;
  z-index: 40;
  transition: transform var(--trans-normal);
}

.sidebar-header {
  height: var(--header-height);
  padding: 0 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border-subtle);
}

.brand-logo {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  color: var(--text-primary);
}

.brand-icon {
  width: 38px;
  height: 38px;
  border-radius: var(--radius-md);
  background: var(--grad-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #ffffff;
  box-shadow: 0 4px 14px var(--primary-glow);
}

.brand-info h2 {
  font-size: 18px;
  letter-spacing: -0.5px;
  background: linear-gradient(90deg, #fff, #cbd5e1);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}
.brand-info span {
  font-size: 11px;
  color: var(--primary);
  font-weight: 600;
  letter-spacing: 0.5px;
  text-transform: uppercase;
}

/* User Mini Profile in Sidebar */
.sidebar-user-card {
  padding: 14px 18px;
  margin: 12px 14px;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  gap: 12px;
}

.user-avatar {
  width: 42px;
  height: 42px;
  border-radius: var(--radius-full);
  background: var(--grad-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 15px;
  color: #fff;
  flex-shrink: 0;
  position: relative;
  border: 2px solid rgba(255, 255, 255, 0.15);
}
.user-avatar.status-online::after {
  content: '';
  position: absolute;
  bottom: 0px;
  right: 0px;
  width: 11px;
  height: 11px;
  border-radius: 50%;
  background: var(--success);
  border: 2px solid var(--bg-secondary);
}

.user-details {
  flex: 1;
  min-width: 0;
}
.user-name {
  font-size: 13.5px;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.user-role-badge {
  display: inline-block;
  font-size: 10.5px;
  font-weight: 600;
  padding: 1px 7px;
  border-radius: 4px;
  margin-top: 2px;
  background: var(--primary-glow);
  color: var(--primary);
  border: 1px solid rgba(99, 102, 241, 0.3);
}
.role-admin { background: rgba(168, 85, 247, 0.15); color: #c084fc; border-color: rgba(168, 85, 247, 0.3); }
.role-hr { background: rgba(14, 165, 233, 0.15); color: #38bdf8; border-color: rgba(14, 165, 233, 0.3); }
.role-manager { background: rgba(245, 158, 11, 0.15); color: #fbbf24; border-color: rgba(245, 158, 11, 0.3); }
.role-staff { background: rgba(16, 185, 129, 0.15); color: #34d399; border-color: rgba(16, 185, 129, 0.3); }

/* Sidebar Navigation Items */
.sidebar-nav {
  flex: 1;
  padding: 8px 12px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.nav-section-label {
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.8px;
  text-transform: uppercase;
  color: var(--text-muted);
  padding: 12px 12px 4px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 13.5px;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--trans-fast);
  position: relative;
  border: 1px solid transparent;
}

.nav-item:hover {
  background: var(--bg-glass);
  color: var(--text-primary);
  border-color: var(--border-subtle);
  transform: translateX(3px);
}

.nav-item.active {
  background: linear-gradient(90deg, rgba(99, 102, 241, 0.18) 0%, rgba(99, 102, 241, 0.05) 100%);
  color: #ffffff;
  border-color: rgba(99, 102, 241, 0.35);
  font-weight: 600;
}
.nav-item.active::before {
  content: '';
  position: absolute;
  left: 0;
  top: 15%;
  bottom: 15%;
  width: 3.5px;
  background: var(--primary);
  border-radius: 0 4px 4px 0;
  box-shadow: 0 0 10px var(--primary);
}

.nav-item svg {
  width: 19px;
  height: 19px;
  flex-shrink: 0;
  opacity: 0.8;
}
.nav-item.active svg {
  opacity: 1;
  color: var(--primary);
}

.nav-badge {
  margin-left: auto;
  font-size: 11px;
  font-weight: 700;
  padding: 1px 7px;
  border-radius: var(--radius-full);
  background: var(--danger);
  color: #fff;
  line-height: 1.4;
}

.sidebar-footer {
  padding: 14px;
  border-top: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* ==========================================================================
   MAIN CONTENT AREA & TOP HEADER
   ========================================================================== */
.main-wrapper {
  margin-left: var(--sidebar-width);
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  position: relative;
  width: calc(100% - var(--sidebar-width));
}

.app-header {
  height: var(--header-height);
  background: rgba(17, 24, 39, 0.8);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 28px;
  position: sticky;
  top: 0;
  z-index: 30;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 16px;
}

.mobile-menu-btn {
  display: none;
  background: transparent;
  border: 1px solid var(--border-subtle);
  color: var(--text-primary);
  width: 38px;
  height: 38px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  align-items: center;
  justify-content: center;
}

.header-page-title {
  font-size: 18px;
  font-weight: 700;
}
.header-page-subtitle {
  font-size: 12px;
  color: var(--text-secondary);
}

.header-right {
  display: flex;
  align-items: center;
  gap: 14px;
}

/* Live Header Clock & Sync Status */
.header-clock-pill {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 14px;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-full);
  font-size: 13px;
  box-shadow: var(--shadow-sm);
}
.live-pulse-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--success);
  box-shadow: 0 0 10px var(--success);
  animation: pulseDot 2s infinite ease-in-out;
}
@keyframes pulseDot {
  0% { transform: scale(0.9); opacity: 0.8; }
  50% { transform: scale(1.3); opacity: 1; box-shadow: 0 0 14px var(--success); }
  100% { transform: scale(0.9); opacity: 0.8; }
}

.header-clock-pill .time {
  font-family: 'JetBrains Mono', monospace;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: 0.5px;
}
.header-clock-pill .date {
  color: var(--text-muted);
  font-size: 11.5px;
  border-left: 1px solid var(--border-subtle);
  padding-left: 8px;
}

/* Header Action Buttons */
.header-btn {
  position: relative;
  width: 40px;
  height: 40px;
  border-radius: var(--radius-sm);
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all var(--trans-fast);
}
.header-btn:hover {
  color: var(--text-primary);
  border-color: var(--border-glass);
  background: var(--bg-card-hover);
}
.header-btn .btn-badge {
  position: absolute;
  top: 5px;
  right: 5px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--danger);
  border: 2px solid var(--bg-secondary);
}

/* Fast Role / User Switcher */
.role-switcher-dropdown {
  position: relative;
}
.switcher-trigger {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  background: var(--grad-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--trans-fast);
}
.switcher-trigger:hover {
  border-color: var(--primary);
  box-shadow: 0 0 12px var(--primary-glow);
}

/* ==========================================================================
   PAGE CONTENT & ROUTE SECTIONS
   ========================================================================== */
.content-body {
  flex: 1;
  padding: 24px 28px 80px;
  max-width: 1600px;
  width: 100%;
  margin: 0 auto;
}

.view-section {
  display: none;
  animation: fadeInView 0.28s ease-out forwards;
}
.view-section.active {
  display: block;
}
@keyframes fadeInView {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ==========================================================================
   COMMON UI COMPONENTS (Cards, Grids, Buttons, Badges, Tables, Inputs)
   ========================================================================== */

/* Glass Cards */
.card {
  background: var(--bg-card);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 20px;
  box-shadow: var(--shadow-sm);
  transition: border-color var(--trans-normal), box-shadow var(--trans-normal);
}
.card:hover {
  border-color: var(--border-glass);
}
.card-glow {
  position: relative;
  overflow: hidden;
}
.card-glow::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: var(--grad-primary);
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border-subtle);
}
.card-title {
  font-size: 16px;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 8px;
}
.card-subtitle {
  font-size: 12px;
  color: var(--text-secondary);
  margin-top: 2px;
}

/* Grid Layouts */
.grid-1 { display: grid; grid-template-columns: 1fr; gap: 20px; }
.grid-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: 20px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 20px; }
.grid-auto { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 20px; }

/* Metric KPI Card */
.stat-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 20px;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  position: relative;
  overflow: hidden;
  transition: transform var(--trans-fast), box-shadow var(--trans-fast);
}
.stat-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
  border-color: var(--border-glass);
}
.stat-info .stat-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.stat-info .stat-value {
  font-size: 26px;
  font-weight: 800;
  margin: 4px 0 2px;
  color: var(--text-primary);
  font-family: 'JetBrains Mono', monospace;
}
.stat-info .stat-trend {
  font-size: 11.5px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 4px;
}
.stat-trend.up { color: var(--success); }
.stat-trend.down { color: var(--danger); }
.stat-trend.neutral { color: var(--text-muted); }

.stat-icon-wrapper {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  flex-shrink: 0;
}
.stat-icon-primary { background: var(--grad-primary); box-shadow: 0 4px 14px var(--primary-glow); }
.stat-icon-success { background: var(--grad-success); box-shadow: 0 4px 14px var(--success-glow); }
.stat-icon-warning { background: var(--grad-warning); box-shadow: 0 4px 14px var(--warning-glow); }
.stat-icon-danger  { background: var(--grad-danger);  box-shadow: 0 4px 14px var(--danger-glow); }

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 9px 18px;
  border-radius: var(--radius-sm);
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--trans-fast);
  border: 1px solid transparent;
  text-decoration: none;
  white-space: nowrap;
}
.btn:active {
  transform: scale(0.97);
}

.btn-primary {
  background: var(--primary);
  color: #ffffff;
  box-shadow: 0 4px 14px var(--primary-glow);
}
.btn-primary:hover {
  background: var(--primary-hover);
  box-shadow: 0 6px 20px var(--primary-glow);
}

.btn-gradient {
  background: var(--grad-primary);
  color: #ffffff;
  box-shadow: 0 4px 14px var(--primary-glow);
}
.btn-gradient:hover {
  filter: brightness(1.1);
  box-shadow: 0 6px 20px var(--primary-glow);
}

.btn-success {
  background: var(--success);
  color: #ffffff;
  box-shadow: 0 4px 14px var(--success-glow);
}
.btn-success:hover {
  background: #059669;
}

.btn-danger {
  background: var(--danger);
  color: #ffffff;
  box-shadow: 0 4px 14px var(--danger-glow);
}
.btn-danger:hover {
  background: #dc2626;
}

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

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

.btn-sm {
  padding: 5px 11px;
  font-size: 12px;
  border-radius: 6px;
}
.btn-lg {
  padding: 13px 26px;
  font-size: 15px;
  border-radius: var(--radius-md);
  font-weight: 700;
}

/* Status Badges */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 10px;
  border-radius: var(--radius-full);
  font-size: 11.5px;
  font-weight: 600;
  text-transform: capitalize;
}
.badge-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
}
.badge-present { background: var(--success-bg); color: #34d399; border: 1px solid rgba(16, 185, 129, 0.3); }
.badge-present .badge-dot { background: var(--success); }

.badge-late { background: var(--warning-bg); color: #fbbf24; border: 1px solid rgba(245, 158, 11, 0.3); }
.badge-late .badge-dot { background: var(--warning); }

.badge-absent { background: var(--danger-bg); color: #f87171; border: 1px solid rgba(239, 68, 68, 0.3); }
.badge-absent .badge-dot { background: var(--danger); }

.badge-halfday { background: rgba(217, 119, 6, 0.15); color: #f59e0b; border: 1px solid rgba(217, 119, 6, 0.3); }
.badge-halfday .badge-dot { background: #f59e0b; }

.badge-leave { background: var(--info-bg); color: #38bdf8; border: 1px solid rgba(14, 165, 233, 0.3); }
.badge-leave .badge-dot { background: var(--info); }

.badge-overtime { background: var(--purple-bg); color: #c084fc; border: 1px solid rgba(168, 85, 247, 0.3); }
.badge-overtime .badge-dot { background: var(--purple); }

.badge-pending { background: rgba(245, 158, 11, 0.15); color: #fbbf24; }
.badge-approved { background: rgba(16, 185, 129, 0.15); color: #34d399; }
.badge-rejected { background: rgba(239, 68, 68, 0.15); color: #f87171; }

/* Data Tables */
.table-responsive {
  width: 100%;
  overflow-x: auto;
  border-radius: var(--radius-sm);
}
.custom-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 13.5px;
}
.custom-table th {
  background: rgba(15, 23, 42, 0.6);
  padding: 12px 16px;
  font-weight: 700;
  font-size: 12px;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.6px;
  border-bottom: 1px solid var(--border-subtle);
  white-space: nowrap;
}
.custom-table td {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border-subtle);
  color: var(--text-primary);
  vertical-align: middle;
}
.custom-table tbody tr {
  transition: background var(--trans-fast);
}
.custom-table tbody tr:hover {
  background: var(--bg-card-hover);
}

/* Forms & Inputs */
.form-group {
  margin-bottom: 16px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.form-label {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-secondary);
}
.form-control {
  width: 100%;
  padding: 10px 14px;
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-size: 13.5px;
  font-family: inherit;
  transition: all var(--trans-fast);
}
.form-control:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-glow);
}
.form-control::placeholder {
  color: var(--text-muted);
}
select.form-control {
  appearance: auto;
  cursor: pointer;
}
textarea.form-control {
  min-height: 80px;
  resize: vertical;
}

/* Filters & Toolbar */
.toolbar-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 18px;
}
.search-box {
  position: relative;
  min-width: 260px;
}
.search-box input {
  padding-left: 38px;
}
.search-box svg {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  width: 16px;
  height: 16px;
}

/* ==========================================================================
   STAFF PUNCH CLOCK HERO (My Attendance Clock)
   ========================================================================== */
.punch-hero-card {
  background: var(--grad-surface);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-lg);
  padding: 32px;
  position: relative;
  overflow: hidden;
  box-shadow: var(--shadow-lg);
}
.punch-hero-card::before {
  content: '';
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: radial-gradient(circle, rgba(99, 102, 241, 0.08) 0%, transparent 60%);
  pointer-events: none;
}

.punch-hero-layout {
  display: grid;
  grid-template-columns: 1.2fr 1fr;
  gap: 32px;
  align-items: center;
}

.punch-timer-display {
  text-align: center;
  padding: 24px;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  position: relative;
}

.clock-digital-counter {
  font-family: 'JetBrains Mono', monospace;
  font-size: 48px;
  font-weight: 800;
  letter-spacing: 2px;
  color: #ffffff;
  margin: 10px 0;
  text-shadow: 0 0 20px rgba(99, 102, 241, 0.4);
}

.clock-status-tag {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 4px 14px;
  border-radius: var(--radius-full);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.5px;
  text-transform: uppercase;
}
.tag-checked-in { background: var(--success-bg); color: #34d399; border: 1px solid rgba(16, 185, 129, 0.4); }
.tag-on-break { background: var(--warning-bg); color: #fbbf24; border: 1px solid rgba(245, 158, 11, 0.4); }
.tag-checked-out { background: rgba(148, 163, 184, 0.15); color: #94a3b8; border: 1px solid rgba(148, 163, 184, 0.3); }

/* Main Punch Action Buttons */
.punch-action-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  margin-top: 20px;
}

.btn-punch-in {
  background: var(--grad-success);
  color: #fff;
  padding: 16px;
  font-size: 16px;
  font-weight: 700;
  border-radius: var(--radius-md);
  border: none;
  cursor: pointer;
  box-shadow: 0 6px 20px var(--success-glow);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  transition: all var(--trans-fast);
}
.btn-punch-in:hover {
  transform: translateY(-2px);
  filter: brightness(1.1);
}

.btn-punch-out {
  background: var(--grad-danger);
  color: #fff;
  padding: 16px;
  font-size: 16px;
  font-weight: 700;
  border-radius: var(--radius-md);
  border: none;
  cursor: pointer;
  box-shadow: 0 6px 20px var(--danger-glow);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  transition: all var(--trans-fast);
}
.btn-punch-out:hover {
  transform: translateY(-2px);
  filter: brightness(1.1);
}

.btn-break {
  background: var(--grad-warning);
  color: #fff;
  padding: 12px;
  font-size: 14px;
  font-weight: 700;
  border-radius: var(--radius-md);
  border: none;
  cursor: pointer;
  grid-column: span 2;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: all var(--trans-fast);
}
.btn-break:hover {
  filter: brightness(1.1);
}

/* Punch Meta Breakdown */
.punch-meta-panel {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.punch-metric-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
}
.punch-metric-row span:first-child {
  color: var(--text-secondary);
  font-size: 13px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.punch-metric-row span:last-child {
  font-weight: 700;
  font-family: 'JetBrains Mono', monospace;
  color: var(--text-primary);
}

/* Progress bar for worked vs target */
.target-progress-bar {
  width: 100%;
  height: 8px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-full);
  overflow: hidden;
  margin-top: 4px;
}
.target-progress-fill {
  height: 100%;
  background: var(--grad-primary);
  border-radius: var(--radius-full);
  transition: width 0.5s ease;
}

/* ==========================================================================
   PAYROLL CALCULATOR & SALARY BREAKDOWN
   ========================================================================== */
.salary-calculator-box {
  background: var(--bg-card);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-md);
  padding: 24px;
}

.payslip-sheet {
  background: #ffffff;
  color: #0f172a;
  border-radius: var(--radius-md);
  padding: 32px;
  box-shadow: var(--shadow-lg);
  font-family: 'Plus Jakarta Sans', sans-serif;
  position: relative;
}
.payslip-sheet * {
  color: #0f172a;
}
.payslip-header {
  border-bottom: 2px solid #e2e8f0;
  padding-bottom: 18px;
  margin-bottom: 20px;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
}
.payslip-title {
  font-size: 20px;
  font-weight: 800;
  color: #1e293b;
}
.payslip-company {
  font-size: 13px;
  color: #64748b;
}
.payslip-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
  margin-bottom: 24px;
}
.payslip-col h4 {
  font-size: 14px;
  font-weight: 700;
  border-bottom: 1px solid #cbd5e1;
  padding-bottom: 6px;
  margin-bottom: 10px;
  color: #334155;
}
.payslip-line {
  display: flex;
  justify-content: space-between;
  padding: 6px 0;
  font-size: 13px;
  border-bottom: 1px dashed #e2e8f0;
}
.payslip-line span:first-child { color: #64748b; }
.payslip-line span:last-child { font-weight: 600; font-family: 'JetBrains Mono', monospace; }

.payslip-total {
  background: #f8fafc;
  border: 1px solid #cbd5e1;
  border-radius: var(--radius-sm);
  padding: 14px 18px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 16px;
  font-weight: 800;
}
.payslip-net-amount {
  font-size: 22px;
  color: #059669 !important;
  font-family: 'JetBrains Mono', monospace;
}

/* ==========================================================================
   MODALS, OVERLAYS & TOASTS
   ========================================================================== */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 20px;
}
.modal-overlay.active {
  display: flex;
  animation: fadeInModal 0.2s ease-out;
}
@keyframes fadeInModal {
  from { opacity: 0; }
  to { opacity: 1; }
}

.modal-content {
  background: var(--bg-secondary);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 600px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
  animation: scaleUpModal 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}
@keyframes scaleUpModal {
  from { transform: scale(0.95) translateY(10px); opacity: 0; }
  to { transform: scale(1) translateY(0); opacity: 1; }
}
.modal-content.modal-lg { max-width: 850px; }
.modal-content.modal-xl { max-width: 1050px; }

.modal-header {
  padding: 18px 24px;
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.modal-body {
  padding: 24px;
}
.modal-footer {
  padding: 16px 24px;
  border-top: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
}

.modal-close-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 20px;
  line-height: 1;
  padding: 4px;
  border-radius: 4px;
}
.modal-close-btn:hover {
  color: var(--text-primary);
}

/* Toast Notifications */
#toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 200;
  display: flex;
  flex-direction: column;
  gap: 10px;
  pointer-events: none;
}
.toast {
  pointer-events: auto;
  min-width: 300px;
  max-width: 420px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-md);
  padding: 14px 18px;
  box-shadow: var(--shadow-lg);
  display: flex;
  align-items: flex-start;
  gap: 12px;
  animation: slideInToast 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  transition: all 0.3s ease;
}
@keyframes slideInToast {
  from { transform: translateX(100%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}
.toast.toast-success { border-left: 4px solid var(--success); }
.toast.toast-error { border-left: 4px solid var(--danger); }
.toast.toast-warning { border-left: 4px solid var(--warning); }
.toast.toast-info { border-left: 4px solid var(--info); }

.toast-icon {
  font-size: 18px;
  flex-shrink: 0;
  margin-top: 1px;
}
.toast-body {
  flex: 1;
}
.toast-title {
  font-size: 13.5px;
  font-weight: 700;
  color: var(--text-primary);
}
.toast-message {
  font-size: 12px;
  color: var(--text-secondary);
  margin-top: 2px;
}

/* ==========================================================================
   PWA INSTALL BANNER & MOBILE CONTROLS
   ========================================================================== */
.pwa-install-banner {
  background: linear-gradient(90deg, #4338ca 0%, #6366f1 100%);
  color: #fff;
  padding: 12px 20px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
  box-shadow: var(--shadow-md);
}
.pwa-banner-text {
  display: flex;
  align-items: center;
  gap: 12px;
}

/* Mobile Bottom Navigation Bar */
.mobile-bottom-nav {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: var(--mobile-nav-height);
  background: rgba(17, 24, 39, 0.95);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-top: 1px solid var(--border-subtle);
  z-index: 50;
  justify-content: space-around;
  align-items: center;
  padding: 0 8px;
}

.mobile-nav-link {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  color: var(--text-muted);
  text-decoration: none;
  font-size: 10.5px;
  font-weight: 600;
  flex: 1;
  padding: 6px 0;
  border-radius: var(--radius-sm);
  transition: color var(--trans-fast);
}
.mobile-nav-link.active {
  color: var(--primary);
}
.mobile-nav-link svg {
  width: 20px;
  height: 20px;
}

/* ==========================================================================
   RESPONSIVE MEDIA QUERIES
   ========================================================================== */
@media (max-width: 1024px) {
  .grid-4 { grid-template-columns: repeat(2, 1fr); }
  .grid-3 { grid-template-columns: repeat(2, 1fr); }
  .punch-hero-layout { grid-template-columns: 1fr; }
}

@media (max-width: 768px) {
  :root {
    --header-height: 60px;
  }
  
  .app-sidebar {
    transform: translateX(-100%);
    width: 280px;
    box-shadow: var(--shadow-lg);
  }
  .app-sidebar.sidebar-open {
    transform: translateX(0);
  }

  .sidebar-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    z-index: 35;
    display: none;
  }
  .sidebar-backdrop.active {
    display: block;
  }

  .main-wrapper {
    margin-left: 0;
    width: 100%;
  }

  .mobile-menu-btn {
    display: flex;
  }

  .mobile-bottom-nav {
    display: flex;
  }

  .content-body {
    padding: 16px 14px 90px;
  }

  .app-header {
    padding: 0 16px;
  }

  .header-clock-pill .date {
    display: none;
  }

  .grid-2 { grid-template-columns: 1fr; }
  .grid-3 { grid-template-columns: 1fr; }
  .grid-4 { grid-template-columns: 1fr; }
  .stat-card { padding: 14px 16px; }
  .stat-info .stat-value { font-size: 22px; }

  .clock-digital-counter {
    font-size: 36px;
  }

  .payslip-grid {
    grid-template-columns: 1fr;
    gap: 14px;
  }
  .payslip-sheet {
    padding: 18px;
  }
}

/* Print Stylesheet for Payslips and Reports */
@media print {
  body {
    background: #ffffff !important;
    color: #000000 !important;
  }
  .app-sidebar, .app-header, .mobile-bottom-nav, .ambient-glow, .btn, .toolbar-bar, .modal-footer, .no-print {
    display: none !important;
  }
  .main-wrapper {
    margin: 0 !important;
    width: 100% !important;
  }
  .content-body {
    padding: 0 !important;
  }
  .payslip-sheet {
    box-shadow: none !important;
    border: none !important;
    padding: 0 !important;
  }
}
