/* =============================================
   RESET & BASE
   ============================================= */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --blue-deep:    #1a2a6c;
  --blue-mid:     #2563eb;
  --blue-light:   #3b82f6;
  --sidebar-bg:   #1e2d5a;
  --sidebar-text: #c8d6f8;
  --sidebar-hover:#2a3f7e;
  --sidebar-active:#3b5bdb;
  --white:        #ffffff;
  --gray-50:      #f8fafc;
  --gray-100:     #f1f5f9;
  --gray-200:     #e2e8f0;
  --gray-400:     #94a3b8;
  --gray-600:     #475569;
  --gray-700:     #334155;
  --gray-900:     #0f172a;
  --danger:       #ef4444;
  --danger-light: #fee2e2;
  --success:      #10b981;
  --sidebar-width: 220px;
  --radius:       10px;
  --shadow-sm:    0 1px 3px rgba(0,0,0,.12);
  --shadow-md:    0 4px 16px rgba(0,0,0,.14);
}

body { font-family: 'Segoe UI', system-ui, -apple-system, sans-serif; color: var(--gray-900); }

/* =============================================
   LOGIN PAGE
   ============================================= */
.login-page {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #1a2a6c 0%, #2563eb 55%, #1a4eb8 100%);
  position: relative;
}

.login-container { width: 100%; display: flex; justify-content: center; padding: 20px; }

.login-card {
  background: rgba(255,255,255,0.08);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255,255,255,0.15);
  border-radius: 20px;
  padding: 48px 40px 40px;
  width: 100%;
  max-width: 380px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}

.logo-icon {
  width: 72px;
  height: 72px;
  background: rgba(255,255,255,0.18);
  border: 2px solid rgba(255,255,255,0.25);
  border-radius: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 32px;
  font-weight: 700;
  color: #fff;
  margin-bottom: 10px;
}

.app-name {
  font-size: 42px;
  font-weight: 700;
  color: #fff;
  letter-spacing: -1px;
}

.app-subtitle {
  font-size: 14px;
  color: rgba(255,255,255,0.75);
  margin-bottom: 6px;
}

.login-divider {
  width: 48px;
  height: 2px;
  background: rgba(255,255,255,0.3);
  border-radius: 2px;
  margin: 10px 0 18px;
}

#loginForm { width: 100%; display: flex; flex-direction: column; gap: 12px; }

.input-group input {
  width: 100%;
  padding: 12px 16px;
  background: rgba(255,255,255,0.12);
  border: 1px solid rgba(255,255,255,0.2);
  border-radius: 8px;
  color: #fff;
  font-size: 14px;
  outline: none;
  transition: border-color .2s, background .2s;
}
.input-group input::placeholder { color: rgba(255,255,255,0.5); }
.input-group input:focus { background: rgba(255,255,255,0.18); border-color: rgba(255,255,255,0.45); }

.login-error {
  background: rgba(239,68,68,.25);
  border: 1px solid rgba(239,68,68,.4);
  color: #fecaca;
  border-radius: 8px;
  padding: 10px 14px;
  font-size: 13px;
  text-align: center;
}

.btn-admin-access {
  margin-top: 4px;
  width: 100%;
  padding: 13px;
  background: rgba(255,255,255,0.18);
  border: 1.5px solid rgba(255,255,255,0.35);
  border-radius: 10px;
  color: #fff;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: background .2s, border-color .2s, transform .1s;
}
.btn-admin-access:hover { background: rgba(255,255,255,0.26); border-color: rgba(255,255,255,0.55); }
.btn-admin-access:active { transform: scale(.98); }
.btn-admin-access:disabled { opacity: .6; cursor: not-allowed; }

.login-footer {
  position: absolute;
  bottom: 24px;
  color: rgba(255,255,255,0.4);
  font-size: 12px;
}

/* =============================================
   ADMIN LAYOUT
   ============================================= */
.admin-page {
  display: flex;
  min-height: 100vh;
  background: var(--gray-100);
}

/* Sidebar */
.sidebar {
  width: var(--sidebar-width);
  background: var(--sidebar-bg);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  z-index: 100;
  box-shadow: 2px 0 12px rgba(0,0,0,.2);
}

.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 24px 20px 20px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
}

.sidebar-logo-icon {
  width: 36px;
  height: 36px;
  background: var(--blue-mid);
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  font-weight: 700;
  color: #fff;
  flex-shrink: 0;
}

.sidebar-logo-text {
  font-size: 20px;
  font-weight: 700;
  color: #fff;
  letter-spacing: -.4px;
}

.sidebar-nav {
  padding: 16px 10px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 1;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 14px;
  border-radius: 8px;
  border: none;
  background: transparent;
  color: var(--sidebar-text);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  text-align: left;
  transition: background .15s, color .15s;
  width: 100%;
}
.nav-item:hover { background: var(--sidebar-hover); color: #fff; }
.nav-item.active { background: var(--sidebar-active); color: #fff; }

/* Main Content */
.main-content {
  margin-left: var(--sidebar-width);
  flex: 1;
  min-height: 100vh;
  padding: 0;
}

/* Panel */
.panel { display: none; padding: 32px 36px; }
.panel.active { display: block; }

.panel-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 28px;
  gap: 16px;
  flex-wrap: wrap;
}

.panel-title { font-size: 24px; font-weight: 700; color: var(--gray-900); }
.panel-subtitle { font-size: 14px; color: var(--gray-400); margin-top: 2px; }

.panel-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }

/* =============================================
   BUTTONS
   ============================================= */
.btn-primary {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 9px 18px;
  background: var(--blue-mid);
  color: #fff;
  border: none;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: background .15s, transform .1s;
}
.btn-primary:hover { background: var(--blue-deep); }
.btn-primary:active { transform: scale(.98); }

.btn-secondary {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 9px 16px;
  background: var(--white);
  color: var(--gray-700);
  border: 1.5px solid var(--gray-200);
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: background .15s, border-color .15s;
}
.btn-secondary:hover { background: var(--gray-50); border-color: var(--gray-400); }

.btn-logout {
  padding: 8px 16px;
  background: transparent;
  color: var(--gray-400);
  border: 1.5px solid var(--gray-200);
  border-radius: 8px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: color .15s, border-color .15s, background .15s;
}
.btn-logout:hover { background: var(--danger-light); color: var(--danger); border-color: var(--danger); }

.btn-icon {
  width: 32px;
  height: 32px;
  border: none;
  border-radius: 7px;
  background: transparent;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background .15s;
}
.btn-icon:hover { background: var(--gray-100); }
.btn-icon.danger:hover { background: var(--danger-light); color: var(--danger); }
.btn-icon svg { pointer-events: none; }

/* =============================================
   EMPLOYEE LIST
   ============================================= */
.employee-list { display: flex; flex-direction: column; gap: 10px; }

.employee-card {
  background: var(--white);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  padding: 16px 20px;
  display: flex;
  align-items: center;
  gap: 16px;
  box-shadow: var(--shadow-sm);
  transition: box-shadow .15s;
}
.employee-card:hover { box-shadow: var(--shadow-md); }

.employee-avatar {
  width: 44px;
  height: 44px;
  background: var(--blue-mid);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  font-weight: 700;
  color: #fff;
  flex-shrink: 0;
}

.employee-info { flex: 1; min-width: 0; }
.employee-name { font-size: 15px; font-weight: 600; color: var(--gray-900); }
.employee-address { font-size: 12px; color: var(--gray-400); margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.employee-card-actions { display: flex; gap: 4px; }

.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--gray-400);
}
.empty-state svg { opacity: .35; margin-bottom: 12px; }
.empty-state p { font-size: 15px; }

/* =============================================
   CALENDAR / DAILY VIEW
   ============================================= */
.calendar-controls {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 24px;
  flex-wrap: wrap;
}

.view-toggle {
  display: flex;
  background: var(--gray-100);
  border-radius: 8px;
  padding: 3px;
  gap: 2px;
}

.view-btn {
  padding: 7px 18px;
  border: none;
  border-radius: 6px;
  background: transparent;
  color: var(--gray-600);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: background .15s, color .15s;
}
.view-btn.active { background: var(--white); color: var(--gray-900); box-shadow: var(--shadow-sm); font-weight: 600; }

.date-picker {
  padding: 8px 12px;
  border: 1.5px solid var(--gray-200);
  border-radius: 8px;
  font-size: 14px;
  color: var(--gray-700);
  background: var(--white);
  outline: none;
  cursor: pointer;
  transition: border-color .15s;
}
.date-picker:focus { border-color: var(--blue-mid); }

.calendar-view {}

.attendance-table {
  width: 100%;
  border-collapse: collapse;
  background: var(--white);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}

.attendance-table thead tr { background: var(--gray-50); border-bottom: 2px solid var(--gray-200); }
.attendance-table th {
  padding: 12px 16px;
  text-align: left;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .5px;
  color: var(--gray-600);
}
.attendance-table td {
  padding: 14px 16px;
  font-size: 14px;
  color: var(--gray-700);
  border-bottom: 1px solid var(--gray-100);
  vertical-align: middle;
}
.attendance-table tbody tr:last-child td { border-bottom: none; }
.attendance-table tbody tr:hover { background: var(--gray-50); }

.attendance-table .emp-name { font-weight: 600; color: var(--gray-900); }
.attendance-table .time-val { font-family: 'Courier New', monospace; font-size: 13px; }
.attendance-table .hours-badge {
  display: inline-flex;
  align-items: center;
  background: #eff6ff;
  color: var(--blue-mid);
  border-radius: 20px;
  padding: 3px 10px;
  font-size: 12px;
  font-weight: 600;
}
.attendance-table .hours-badge.off {
  background: var(--gray-100);
  color: var(--gray-400);
}
.attendance-table .muted { color: var(--gray-400); }

.view-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--gray-700);
  margin-bottom: 12px;
}

/* =============================================
   HOLIDAY LIST
   ============================================= */
.holiday-list { display: flex; flex-direction: column; gap: 10px; }

.holiday-card {
  background: var(--white);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  padding: 14px 20px;
  display: flex;
  align-items: center;
  gap: 16px;
  box-shadow: var(--shadow-sm);
}

.holiday-icon {
  width: 40px;
  height: 40px;
  background: #fef3c7;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  flex-shrink: 0;
}

.holiday-info { flex: 1; }
.holiday-label { font-size: 15px; font-weight: 600; color: var(--gray-900); }
.holiday-date { font-size: 12px; color: var(--gray-400); margin-top: 2px; }

/* =============================================
   MODAL
   ============================================= */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.45);
  backdrop-filter: blur(2px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 200;
  padding: 20px;
}

.modal {
  background: var(--white);
  border-radius: 14px;
  padding: 28px;
  width: 100%;
  max-width: 420px;
  box-shadow: 0 20px 60px rgba(0,0,0,.2);
  animation: modalIn .2s ease;
}

@keyframes modalIn {
  from { opacity: 0; transform: scale(.95) translateY(10px); }
  to   { opacity: 1; transform: scale(1)  translateY(0);     }
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}
.modal-header h3 { font-size: 18px; font-weight: 700; color: var(--gray-900); }

.modal-close {
  width: 30px; height: 30px;
  border: none; background: var(--gray-100);
  border-radius: 6px; font-size: 20px; line-height: 1;
  cursor: pointer; color: var(--gray-600);
  display: flex; align-items: center; justify-content: center;
  transition: background .15s;
}
.modal-close:hover { background: var(--gray-200); }

.form-group { margin-bottom: 16px; }
.form-group label { display: block; font-size: 13px; font-weight: 600; color: var(--gray-700); margin-bottom: 6px; }
.form-group input {
  width: 100%;
  padding: 10px 14px;
  border: 1.5px solid var(--gray-200);
  border-radius: 8px;
  font-size: 14px;
  color: var(--gray-900);
  outline: none;
  transition: border-color .15s;
}
.form-group input:focus { border-color: var(--blue-mid); }

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 6px;
}

/* =============================================
   TOAST
   ============================================= */
.toast {
  position: fixed;
  bottom: 28px;
  right: 28px;
  background: var(--gray-900);
  color: #fff;
  padding: 12px 20px;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 500;
  box-shadow: var(--shadow-md);
  z-index: 999;
  animation: toastIn .25s ease;
}
.toast.success { background: var(--success); }
.toast.error   { background: var(--danger); }
@keyframes toastIn {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0);     }
}

/* =============================================
   UTILITY
   ============================================= */
.hidden { display: none !important; }

/* Loading spinner */
.spinner {
  width: 32px; height: 32px;
  border: 3px solid var(--gray-200);
  border-top-color: var(--blue-mid);
  border-radius: 50%;
  animation: spin .7s linear infinite;
  margin: 40px auto;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* =============================================
   PRINT HEADER (hidden on screen, shown on print)
   ============================================= */
.print-header { display: none; }

/* =============================================
   PRINT STYLESHEET
   ============================================= */
@media print {
  @page { margin: 8mm; }

  /* Hide everything except the daily panel content */
  .sidebar,
  .panel-header,
  .calendar-controls,
  .modal-overlay,
  .toast,
  .no-print {
    display: none !important;
  }

  body, .admin-page { background: #fff; }

  .main-content {
    margin-left: 0;
    padding: 0;
  }

  /* Only the active panel prints */
  .panel { display: none !important; padding: 0; }
  .panel.active { display: block !important; padding: 8px 12px; }

  /* Print header */
  .print-header {
    display: block !important;
    margin-bottom: 8px;
    padding-bottom: 8px;
    border-bottom: 1px solid #1e2d5a;
  }

  .print-date-stamp {
    font-size: 8px;
    color: #666;
    margin-bottom: 3px;
  }

  .print-company-name {
    font-size: 16px;
    font-weight: 700;
    color: #1e2d5a;
    letter-spacing: -0.5px;
    line-height: 1.1;
  }

  .print-view-label {
    font-size: 10px;
    font-weight: 600;
    color: #333;
    margin-top: 2px;
  }

  .print-period-label {
    font-size: 10px;
    color: #555;
    margin-top: 1px;
  }

  /* Clean table */
  .attendance-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 6px;
    font-size: 9px;
    box-shadow: none;
  }

  .attendance-table thead tr {
    background: #f0f4ff !important;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }

  .attendance-table th {
    padding: 3px 8px;
    text-align: left;
    font-size: 8px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    color: #333;
    border-bottom: 1px solid #1e2d5a;
  }

  .attendance-table td {
    padding: 2px 8px;
    border-bottom: 1px solid #e0e0e0;
    color: #111;
    vertical-align: middle;
  }

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

  /* Simplify badges for print */
  .hours-badge {
    background: none !important;
    color: #111 !important;
    padding: 0 !important;
    font-weight: 600;
    font-size: 11px;
  }

  .hours-badge.off { color: #999 !important; }
  .time-val.muted  { color: #999; }
}
