@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&display=swap');
@import url("https://cdn.jsdelivr.net/npm/bootstrap-icons@1.11.3/font/bootstrap-icons.min.css");

:root {
  /* Modern Vibrant Palette */
  --primary: #6366f1;
  /* Indigo 500 */
  --primary-dark: #4f46e5;
  --primary-light: #818cf8;
  --primary-gradient: linear-gradient(135deg, #6366f1 0%, #4f46e5 100%);

  --secondary: #64748b;
  --success: #10b981;
  --success-gradient: linear-gradient(135deg, #34d399 0%, #059669 100%);
  --danger: #ef4444;
  --danger-gradient: linear-gradient(135deg, #f87171 0%, #dc2626 100%);
  --warning: #f59e0b;
  --warning-gradient: linear-gradient(135deg, #fbbf24 0%, #d97706 100%);
  --info: #3b82f6;
  --info-gradient: linear-gradient(135deg, #60a5fa 0%, #2563eb 100%);

  /* Backgrounds */
  --bg-body: #f8fafc;
  /* Slate 50 */
  --bg-sidebar: #ffffff;
  --bg-card: #ffffff;

  /* Text */
  --text-main: #0f172a;
  /* Slate 900 */
  --text-secondary: #475569;
  /* Slate 600 */
  --text-muted: #94a3b8;
  /* Slate 400 */

  /* Borders & Shadows */
  --border-color: #e2e8f0;
  --shadow-sm: 0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1);
  --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
  --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
  --shadow-color: rgba(0, 0, 0, 0.05);

  /* Radius */
  --radius-sm: 0.375rem;
  --radius-md: 0.75rem;
  /* 12px */
  --radius-lg: 1rem;
  /* 16px */
  --radius-xl: 1.5rem;
}

body {
  font-family: 'Inter', sans-serif;
  background-color: var(--bg-body);
  color: var(--text-main);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

/* --- Layout --- */
.app-shell {
  display: flex;
  min-height: 100vh;
}

.app-main {
  flex: 1;
  padding: 2rem;
  overflow-x: hidden;
  max-width: 1600px;
}

/* --- Sidebar --- */
.sidebar {
  width: 280px;
  background-color: var(--bg-sidebar);
  border-right: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  z-index: 50;
  box-shadow: 4px 0 24px rgba(0, 0, 0, 0.02);
}

.sidebar-brand {
  height: 80px;
  display: flex;
  align-items: center;
  padding: 0 1.5rem;
  font-size: 1.25rem;
  font-weight: 800;
  color: var(--primary-dark);
  letter-spacing: -0.025em;
  /* border-bottom: 1px solid var(--border-color); Remove border for cleaner look */
}

.sidebar-content {
  flex: 1;
  padding: 1.5rem 1rem;
  overflow-y: auto;
}

.nav-section {
  margin-bottom: 2rem;
}

.sidebar-section-label {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--text-muted);
  letter-spacing: 0.08em;
  padding: 0 1rem;
  margin-bottom: 0.75rem;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 0.875rem;
  padding: 0.875rem 1rem;
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  font-weight: 500;
  text-decoration: none;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  margin-bottom: 0.25rem;
  position: relative;
  overflow: hidden;
}

.nav-link:hover {
  background-color: #f1f5f9;
  color: var(--primary);
  transform: translateX(4px);
}

.nav-link.active {
  background: var(--primary-gradient);
  color: white;
  box-shadow: 0 4px 12px rgba(99, 102, 241, 0.25);
}

.nav-icon {
  font-size: 1.2rem;
  width: 24px;
  text-align: center;
  display: flex;
  justify-content: center;
}

/* --- Cards --- */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  margin-bottom: 1.5rem;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
  border-color: #cbd5e1;
}

/* Modern Dashboard Stat Card */
.stats-card {
  position: relative;
  overflow: hidden;
  border: none;
}

.stats-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: var(--primary-gradient);
}

.card-header {
  padding: 1.5rem;
  border-bottom: 1px solid var(--border-color);
  background: white;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-top-left-radius: var(--radius-lg);
  border-top-right-radius: var(--radius-lg);
}

.att-cell.status-P {
  color: #198754 !important;
  font-weight: bold;
  background-color: #d1e7dd !important;
}

.att-cell.status-L {
  color: #856404 !important;
  font-weight: bold;
  background-color: #fff3cd !important;
}

.text-xs {
  font-size: 0.75rem;
}

.tracking-wider {
  letter-spacing: 0.05em;
}

/* Flatpickr override for dashboard clean look */
.flatpickr-date {
  background-color: transparent !important;
}

.app-main .flatpickr-date {
  cursor: pointer;
}

.card-title {
  font-size: 1.125rem;
  font-weight: 700;
  color: var(--text-main);
  margin: 0;
}

.card-body {
  padding: 1.5rem;
}

/* --- Typography --- */
h1,
h2,
h3,
h4,
h5,
h6 {
  color: var(--text-main);
  font-weight: 700;
  letter-spacing: -0.025em;
  margin-top: 0;
}

.page-title {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 2.5rem;
}

.page-title-icon {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  background: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  color: var(--primary);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border-color);
}

.page-title-text {
  font-size: 1.75rem;
  font-weight: 800;
  color: var(--text-main);
  line-height: 1.2;
}

.subtle-label {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
}

.display-6 {
  font-weight: 800;
  letter-spacing: -0.03em;
  color: var(--text-main);
}

/* --- Buttons --- */
.btn {
  padding: 0.75rem 1.5rem;
  font-weight: 600;
  border-radius: var(--radius-md);
  transition: all 0.2s ease;
  letter-spacing: 0.01em;
  font-size: 0.95rem;
}

.btn-primary {
  background: var(--primary-gradient);
  border: none;
  box-shadow: 0 4px 6px -1px rgba(79, 70, 229, 0.2);
}

.btn-primary:hover {
  filter: brightness(110%);
  transform: translateY(-1px);
  box-shadow: 0 8px 12px -2px rgba(79, 70, 229, 0.3);
}

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

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

.btn-sm {
  padding: 0.5rem 1rem;
  font-size: 0.85rem;
}

/* --- Tables (Modernized) --- */
.table-responsive {
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  background: white;
  border: 1px solid var(--border-color);
  overflow-x: auto;
  /* For border radius */
}

.table {
  width: 100%;
  margin-bottom: 0;
  border-collapse: separate;
  border-spacing: 0;
}

.table th {
  background: #f8fafc;
  color: var(--text-secondary);
  font-weight: 700;
  text-transform: uppercase;
  font-size: 0.7rem;
  /* Smaller font */
  letter-spacing: 0.05em;
  padding: 0.75rem 0.5rem;
  /* Tighter padding */
  border-bottom: 1px solid var(--border-color);
  white-space: nowrap;
  /* Keep headers single line */
}

.table td {
  padding: 0.6rem 0.5rem;
  /* Compact padding */
  border-bottom: 1px solid var(--border-color);
  color: var(--text-secondary);
  vertical-align: middle;
  font-size: 0.85rem;
  /* Compact text */
  transition: background 0.1s;
}

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

/* Compact tables for small screens */
@media (max-width: 768px) {

  .table th,
  .table td {
    padding: 0.4rem 0.3rem;
    font-size: 0.7rem;
  }

  .table th {
    font-size: 0.6rem;
  }

  /* Hide less important columns on mobile */
  .table .hide-mobile {
    display: none;
  }

  /* Make employee names wrap if needed */
  .table td {
    white-space: normal;
    word-break: break-word;
  }

  /* Smaller action buttons */
  .table .btn-sm {
    padding: 0.2rem 0.4rem;
    font-size: 0.65rem;
  }
}

.table tbody tr:hover td {
  background-color: #f8fafc;
}

/* Compact list table for tighter data */
.list-table th,
.list-table td {
  padding: 0.75rem 1rem;
}

/* --- Badges & Alerts --- */
.badge {
  padding: 0.4em 0.8em;
  font-weight: 600;
  border-radius: 6px;
  font-size: 0.75em;
  letter-spacing: 0.02em;
}

.alert {
  border: none;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
}

.alert-warning {
  background: #fffbeb;
  color: #92400e;
  border-left: 4px solid #f59e0b;
}

.alert-danger {
  background: #fef2f2;
  color: #991b1b;
  border-left: 4px solid #ef4444;
}

.alert-info {
  background: #eff6ff;
  color: #1e40af;
  border-left: 4px solid #3b82f6;
}

/* --- Form --- */
.form-control,
.form-select {
  border: 1px solid #cbd5e1;
  border-radius: var(--radius-md);
  padding: 0.75rem 1rem;
  font-size: 0.95rem;
  color: var(--text-main);
  background: #fff;
  transition: all 0.2s;
  box-shadow: none;
  /* Reset underline style */
}

.form-control:focus,
.form-select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
  background: white;
}

/* --- Auth Page --- */
.login-page {
  background: linear-gradient(135deg, #e0e7ff 0%, #fae8ff 100%);
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
}

.login-card {
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(20px);
  border: 1px solid rgba(255, 255, 255, 0.8);
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.1);
  border-radius: 24px;
  padding: 3rem;
  width: 100%;
  max-width: 420px;
}