/* ═══════════════════════ AttendEase CSS ═══════════════════════ */
@import url('https://fonts.googleapis.com/css2?family=DM+Sans:wght@400;500;600;700&family=Outfit:wght@400;500;600;700;800&display=swap');

:root {
  --primary: #0d9488;
  --primary-dark: #0f766e;
  --primary-light: #14b8a6;
  --bg: #f1f5f9;
  --card: #ffffff;
  --border: #e2e8f0;
  --text: #1a2332;
  --text-muted: #64748b;
  --text-light: #94a3b8;
  --green: #10b981;
  --yellow: #f59e0b;
  --red: #ef4444;
  --purple: #8b5cf6;
  --indigo: #6366f1;
  --sidebar-bg: #0f172a;
  --sidebar-hover: #1e293b;
  --radius: 12px;
}

* { margin: 0; padding: 0; box-sizing: border-box; }
body {
  font-family: 'DM Sans', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg); color: var(--text); min-height: 100vh;
}

/* ═══════════ LOGIN PAGE ═══════════ */
.login-page {
  min-height: 100vh; display: flex;
  background: linear-gradient(135deg, #0f172a 0%, #1e293b 40%, #0f172a 100%);
}
.login-left {
  flex: 1; display: flex; flex-direction: column; justify-content: center;
  align-items: center; padding: 40px; position: relative; overflow: hidden;
}
.login-left .glow1 {
  position: absolute; width: 400px; height: 400px; border-radius: 50%;
  background: radial-gradient(circle, rgba(13,148,136,0.15) 0%, transparent 70%);
  top: 20%; left: 10%;
}
.login-left .glow2 {
  position: absolute; width: 300px; height: 300px; border-radius: 50%;
  background: radial-gradient(circle, rgba(99,102,241,0.1) 0%, transparent 70%);
  bottom: 10%; right: 20%;
}
.login-brand { display: flex; align-items: center; gap: 12px; margin-bottom: 24px; position: relative; z-index: 1; }
.login-brand .icon {
  width: 48px; height: 48px; border-radius: 12px;
  background: linear-gradient(135deg, var(--primary-light), var(--primary));
  display: flex; align-items: center; justify-content: center; color: #fff; font-size: 22px;
}
.login-brand span {
  font-size: 28px; font-weight: 800; color: #fff;
  font-family: 'Outfit', sans-serif; letter-spacing: -0.5px;
}
.login-left p { color: #94a3b8; font-size: 15px; line-height: 1.6; max-width: 400px; text-align: center; position: relative; z-index: 1; }
.login-features { display: flex; gap: 20px; margin-top: 32px; flex-wrap: wrap; justify-content: center; position: relative; z-index: 1; }
.login-features span { display: flex; align-items: center; gap: 6px; color: #64748b; font-size: 12px; }
.login-features span i { color: var(--primary); }

.login-right { display: flex; align-items: center; justify-content: center; padding: 40px; }
.login-card {
  background: #fff; border-radius: 20px; padding: 36px; width: 380px;
  max-width: 90vw; box-shadow: 0 25px 60px rgba(0,0,0,0.3);
}
.login-card h2 { font-size: 20px; font-weight: 700; color: var(--text); font-family: 'Outfit', sans-serif; margin-bottom: 4px; }
.login-card .subtitle { font-size: 13px; color: var(--text-light); margin-bottom: 20px; }

.tab-switch {
  display: flex; gap: 4px; margin-bottom: 20px; background: #f1f5f9;
  border-radius: 8px; padding: 3px;
}
.tab-switch button {
  flex: 1; padding: 8px 0; border: none; border-radius: 6px;
  cursor: pointer; font-size: 12px; font-weight: 600; font-family: inherit;
  background: transparent; color: var(--text-light); transition: all 0.15s;
}
.tab-switch button.active {
  background: #fff; color: var(--primary);
  box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}

.error-box {
  padding: 8px 12px; border-radius: 8px; background: #fef2f2;
  color: var(--red); font-size: 12px; margin-bottom: 14px;
  display: flex; align-items: center; gap: 6px;
}

.demo-box {
  margin-top: 18px; padding: 12px 14px; background: #f8fafc;
  border-radius: 8px; border: 1px solid var(--border);
}
.demo-box .title { font-size: 11px; font-weight: 600; color: var(--text-muted); margin-bottom: 6px; }
.demo-box .creds { font-size: 11px; color: var(--text-light); line-height: 1.7; }

.login-link { text-align: center; font-size: 12px; color: var(--text-light); margin-top: 14px; }
.login-link a { color: var(--primary); cursor: pointer; font-weight: 600; text-decoration: none; }

/* ═══════════ FORM ELEMENTS ═══════════ */
.form-field { margin-bottom: 14px; }
.form-field label {
  display: block; font-size: 12px; font-weight: 600;
  color: #4a5568; margin-bottom: 5px; letter-spacing: 0.3px;
}
.form-input, .form-select, .form-textarea {
  width: 100%; padding: 9px 12px; border-radius: 8px;
  border: 1px solid #d1d9e6; font-size: 13px; outline: none;
  background: #f8fafc; font-family: inherit; transition: border-color 0.2s;
}
.form-input:focus, .form-select:focus, .form-textarea:focus { border-color: var(--primary); background: #fff; }
.form-textarea { min-height: 70px; resize: vertical; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 0 14px; }

.btn {
  padding: 10px 22px; border-radius: 8px; border: none; cursor: pointer;
  font-size: 13px; font-weight: 600; font-family: inherit;
  display: inline-flex; align-items: center; gap: 6px; transition: all 0.15s;
}
.btn-primary {
  color: #fff; background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  box-shadow: 0 2px 8px rgba(13,148,136,0.25);
}
.btn-primary:hover { transform: translateY(-1px); box-shadow: 0 4px 12px rgba(13,148,136,0.3); }
.btn-secondary { background: #e2e8f0; color: #475569; }
.btn-danger {
  color: #fff; background: linear-gradient(135deg, var(--red), #dc2626);
  box-shadow: 0 2px 8px rgba(239,68,68,0.25);
}
.btn-sm { padding: 7px 14px; font-size: 12px; }
.btn-block { width: 100%; justify-content: center; }
.btn-icon {
  background: none; border: none; cursor: pointer; padding: 4px;
  display: flex; align-items: center;
}

/* ═══════════ LAYOUT ═══════════ */
.app-layout { display: flex; min-height: 100vh; }

.sidebar {
  width: 230px; min-width: 230px; background: var(--sidebar-bg);
  color: #fff; display: flex; flex-direction: column;
  border-right: 1px solid #334155; transition: all 0.25s;
  position: fixed; left: 0; top: 0; bottom: 0; z-index: 100;
}
.sidebar.collapsed { width: 0; min-width: 0; overflow: hidden; }

.sidebar-brand {
  padding: 22px 20px 18px; border-bottom: 1px solid #334155;
  display: flex; align-items: center; gap: 10px;
}
.sidebar-brand .icon {
  width: 34px; height: 34px; border-radius: 8px;
  background: linear-gradient(135deg, var(--primary-light), var(--primary));
  display: flex; align-items: center; justify-content: center; color: #fff; flex-shrink: 0;
}
.sidebar-brand .text h3 { font-size: 14px; font-weight: 700; font-family: 'Outfit', sans-serif; letter-spacing: -0.3px; }
.sidebar-brand .text small { font-size: 10px; color: #64748b; }

.sidebar-nav { padding: 12px 10px; flex: 1; overflow-y: auto; }
.sidebar-nav button {
  display: flex; align-items: center; gap: 10px; width: 100%;
  padding: 10px 12px; border-radius: 8px; border: none; cursor: pointer;
  margin-bottom: 2px; font-size: 13px; font-weight: 400;
  color: #94a3b8; background: transparent; font-family: inherit;
  transition: all 0.15s;
}
.sidebar-nav button:hover { background: var(--sidebar-hover); color: #cbd5e1; }
.sidebar-nav button.active {
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: #fff; font-weight: 600;
}

.sidebar-footer { padding: 12px 14px; border-top: 1px solid #334155; }
.sidebar-footer .name { font-size: 12px; color: #94a3b8; margin-bottom: 2px; }
.sidebar-footer .info { font-size: 10px; color: #475569; margin-bottom: 10px; }
.btn-logout {
  display: flex; align-items: center; gap: 6px; width: 100%;
  padding: 8px 12px; border-radius: 8px; border: 1px solid #334155;
  cursor: pointer; font-size: 12px; color: var(--red);
  background: rgba(239,68,68,0.08); font-family: inherit;
}

.main-content { flex: 1; margin-left: 230px; padding: 24px 28px; transition: margin-left 0.25s; min-height: 100vh; }
.main-content.expanded { margin-left: 0; }

.topbar {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 24px; flex-wrap: wrap; gap: 10px;
}
.topbar-left { display: flex; align-items: center; gap: 12px; }
.topbar-left h1 { font-size: 22px; font-weight: 700; color: var(--text); font-family: 'Outfit', sans-serif; }
.topbar-right { display: flex; align-items: center; gap: 12px; }
.topbar-right .date { font-size: 12px; color: var(--text-light); }
.avatar {
  width: 36px; height: 36px; border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-size: 13px; font-weight: 700;
}

.menu-btn { background: none; border: none; cursor: pointer; display: flex; color: var(--text-muted); }

/* ═══════════ STAT CARDS ═══════════ */
.stats-grid { display: flex; gap: 14px; flex-wrap: wrap; margin-bottom: 24px; }
.stat-card {
  background: var(--card); border-radius: 14px; padding: 20px 22px;
  border: 1px solid var(--border); position: relative; overflow: hidden;
  flex: 1 1 200px; min-width: 180;
}
.stat-card .glow {
  position: absolute; top: -10px; right: -10px; width: 70px; height: 70px;
  border-radius: 50%; opacity: 0.1;
}
.stat-card .icon-wrap {
  width: 38px; height: 38px; border-radius: 10px;
  display: flex; align-items: center; justify-content: center; margin-bottom: 10px;
}
.stat-card .label { font-size: 12px; color: var(--text-light); font-weight: 500; text-transform: uppercase; letter-spacing: 0.5px; }
.stat-card .value { font-size: 28px; font-weight: 700; color: var(--text); font-family: 'Outfit', sans-serif; }
.stat-card .sub { font-size: 11px; color: var(--text-light); margin-top: 2px; }

/* ═══════════ CARDS ═══════════ */
.card { background: var(--card); border-radius: 14px; border: 1px solid var(--border); overflow: hidden; }
.card-header {
  padding: 16px 20px; border-bottom: 1px solid var(--border);
  display: flex; justify-content: space-between; align-items: center;
}
.card-header h3 { font-size: 14px; font-weight: 700; color: var(--text); }
.card-body { padding: 20px; }

/* ═══════════ TABLE ═══════════ */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
thead tr { background: #f8fafc; }
th {
  padding: 12px 14px; text-align: left; font-size: 11px;
  font-weight: 600; color: var(--text-muted); text-transform: uppercase;
  letter-spacing: 0.5px; border-bottom: 1px solid var(--border);
}
td { padding: 10px 14px; border-bottom: 1px solid #f1f5f9; }
tr:hover td { background: #fafbfc; }
.table-empty { padding: 30px; text-align: center; color: var(--text-light); }

/* ═══════════ BADGE ═══════════ */
.badge {
  display: inline-flex; align-items: center; padding: 2px 10px;
  border-radius: 20px; font-size: 11px; font-weight: 600; letter-spacing: 0.3px;
}
.badge-present { background: #d1fae5; color: #065f46; }
.badge-late { background: #fef3c7; color: #92400e; }
.badge-absent { background: #fee2e2; color: #991b1b; }
.badge-leave, .badge-purple { background: #ede9fe; color: #5b21b6; }
.badge-pending { background: #fef3c7; color: #92400e; }
.badge-approved { background: #d1fae5; color: #065f46; }
.badge-rejected { background: #fee2e2; color: #991b1b; }
.badge-active { background: #d1fae5; color: #065f46; }
.badge-inactive { background: #e2e8f0; color: #475569; }
.badge-half-day { background: #fef3c7; color: #92400e; }
.badge-in-progress { background: #dbeafe; color: #1e40af; }

/* ═══════════ TOOLBAR ═══════════ */
.toolbar { display: flex; gap: 10px; margin-bottom: 18px; flex-wrap: wrap; align-items: center; }
.search-wrap { position: relative; flex: 1 1 200px; }
.search-wrap i { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); color: var(--text-light); font-size: 14px; }
.search-wrap input { padding-left: 32px; }
.filter-pills { display: flex; gap: 8px; flex-wrap: wrap; }
.filter-pill {
  padding: 7px 16px; border-radius: 8px; border: 1px solid var(--border);
  cursor: pointer; font-size: 12px; font-weight: 600; font-family: inherit;
  background: #fff; color: var(--text-muted); transition: all 0.15s;
}
.filter-pill.active { background: var(--primary); color: #fff; border-color: var(--primary); }

/* ═══════════ MODAL ═══════════ */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(15,23,42,0.45);
  backdrop-filter: blur(4px); display: flex; align-items: center;
  justify-content: center; z-index: 1000; padding: 20px;
}
.modal-overlay.hidden { display: none; }
.modal {
  background: #fff; border-radius: 16px; width: 100%; max-width: 520px;
  max-height: 90vh; overflow: auto; box-shadow: 0 25px 60px rgba(0,0,0,0.15);
}
.modal-header {
  padding: 18px 24px; border-bottom: 1px solid var(--border);
  display: flex; justify-content: space-between; align-items: center;
  position: sticky; top: 0; background: #fff; border-radius: 16px 16px 0 0; z-index: 1;
}
.modal-header h3 { font-size: 16px; font-weight: 700; color: var(--text); }
.modal-body { padding: 24px; }
.modal-footer { display: flex; gap: 10px; justify-content: flex-end; margin-top: 18px; }

/* ═══════════ LEAVE CARD ═══════════ */
.leave-card {
  background: var(--card); border-radius: 12px; padding: 16px 20px;
  border: 1px solid var(--border); display: flex;
  justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 12px;
}
.leave-card .info { flex: 1; min-width: 200px; }
.leave-card .name { font-weight: 600; font-size: 14px; }
.leave-card .meta { font-size: 12px; color: var(--text-muted); margin-top: 4px; }
.leave-card .reason { font-size: 12px; color: var(--text-light); margin-top: 4px; }
.leave-card .actions { display: flex; gap: 8px; }

/* ═══════════ CHECK-IN BOX ═══════════ */
.checkin-box {
  background: var(--card); border-radius: 16px; padding: 32px;
  border: 1px solid var(--border); text-align: center; max-width: 480px; margin: 0 auto;
}
.checkin-icon {
  width: 80px; height: 80px; border-radius: 50%; margin: 0 auto 16px;
  display: flex; align-items: center; justify-content: center;
  font-size: 36px; color: #fff;
}
.checkin-icon.pending { background: linear-gradient(135deg, var(--primary), var(--primary-dark)); }
.checkin-icon.active { background: linear-gradient(135deg, var(--green), #059669); }
.checkin-icon.done { background: linear-gradient(135deg, #94a3b8, #64748b); }
.checkin-time {
  font-size: 32px; font-weight: 800; color: var(--text);
  font-family: 'Outfit', sans-serif; margin-bottom: 4px;
}
.checkin-date { font-size: 14px; color: var(--text-muted); margin-bottom: 24px; }
.checkin-status { font-size: 13px; font-weight: 600; margin-bottom: 12px; }

/* ═══════════ PROFILE ═══════════ */
.profile-card { max-width: 560px; margin: 0 auto; }
.profile-header { display: flex; align-items: center; gap: 16px; margin-bottom: 24px; }
.profile-avatar {
  width: 56px; height: 56px; border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-size: 22px; font-weight: 700; font-family: 'Outfit', sans-serif;
}
.profile-info h2 { font-size: 18px; font-weight: 700; }
.profile-info .role { font-size: 12px; color: var(--text-muted); }
.profile-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px 20px; }
.profile-field .label { font-size: 11px; color: var(--text-light); font-weight: 600; text-transform: uppercase; letter-spacing: 0.5px; margin-bottom: 3px; }
.profile-field .value { font-size: 14px; color: var(--text); font-weight: 500; }

/* ═══════════ TODAY BANNER ═══════════ */
.today-banner {
  border-radius: 14px; padding: 22px 26px; color: #fff; margin-bottom: 20px;
}
.today-banner.checked { background: linear-gradient(135deg, var(--primary), var(--primary-dark)); }
.today-banner.not-checked { background: linear-gradient(135deg, #64748b, #475569); }
.today-banner .label { font-size: 13px; opacity: 0.8; margin-bottom: 4px; }
.today-banner .status { font-size: 22px; font-weight: 700; font-family: 'Outfit', sans-serif; }
.today-banner .detail { font-size: 13px; opacity: 0.8; margin-top: 4px; }

/* ═══════════ CHART CONTAINER ═══════════ */
.chart-grid { display: grid; grid-template-columns: 2fr 1fr; gap: 18px; margin-bottom: 18px; }
.chart-card { background: var(--card); border-radius: 14px; padding: 20px; border: 1px solid var(--border); }
.chart-card h3 { margin: 0 0 16px; font-size: 14px; font-weight: 700; }
.chart-full { grid-column: span 2; }

/* ═══════════ REPORT FORM ═══════════ */
.report-form {
  background: var(--card); border-radius: 14px; padding: 20px;
  border: 1px solid var(--border); margin-bottom: 18px;
}
.report-form h3 { margin: 0 0 14px; font-size: 14px; font-weight: 700; }
.report-form .controls { display: flex; gap: 10px; flex-wrap: wrap; align-items: flex-end; }

/* ═══════════ TOAST ═══════════ */
.toast {
  position: fixed; top: 20px; right: 20px; z-index: 2000;
  padding: 12px 20px; border-radius: 10px; color: #fff;
  font-size: 13px; font-weight: 500; display: flex;
  align-items: center; gap: 8px; box-shadow: 0 8px 24px rgba(0,0,0,0.15);
  animation: slideIn 0.3s ease;
}
.toast.success { background: var(--primary); }
.toast.error { background: var(--red); }
.toast.warning { background: var(--yellow); }
.toast.hidden { display: none; }

@keyframes slideIn { from { transform: translateX(100px); opacity: 0; } to { transform: translateX(0); opacity: 1; } }

/* ═══════════ RESPONSIVE ═══════════ */
@media (max-width: 768px) {
  .sidebar { width: 0; min-width: 0; overflow: hidden; }
  .sidebar.open { width: 230px; min-width: 230px; }
  .main-content { margin-left: 0 !important; }
  .login-page { flex-direction: column; }
  .login-left { display: none; }
  .chart-grid { grid-template-columns: 1fr; }
  .chart-full { grid-column: span 1; }
  .stats-grid { gap: 10px; }
  .stat-card { min-width: 140px; padding: 14px; }
  .form-row { grid-template-columns: 1fr; }
  .topbar { padding-right: 0; }
}
