/* CloudFen HR Portal — Main Stylesheet */
@import url('https://fonts.googleapis.com/css2?family=DM+Sans:wght@300;400;500;600;700&family=Playfair+Display:wght@700&display=swap');

:root {
  --navy:      #0c2340;
  --navy-mid:  #1a3a5c;
  --navy-lt:   #244878;
  --sky:       #2b8fd4;
  --sky-lt:    #5ab0e8;
  --cloud:     #e8f4fd;
  --mint:      #1ab89a;
  --amber:     #f59e0b;
  --rose:      #ef4444;
  --gray-50:   #f8fafc;
  --gray-100:  #f1f5f9;
  --gray-200:  #e2e8f0;
  --gray-400:  #94a3b8;
  --gray-600:  #475569;
  --gray-800:  #1e293b;
  --white:     #ffffff;
  --shadow-sm: 0 1px 3px rgba(0,0,0,.08);
  --shadow:    0 4px 16px rgba(0,0,0,.10);
  --shadow-lg: 0 10px 40px rgba(0,0,0,.14);
  --radius:    10px;
  --radius-lg: 16px;
  --font:      'DM Sans', sans-serif;
  --font-display: 'Playfair Display', serif;
  --sidebar-w: 248px;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { font-size: 15px; scroll-behavior: smooth; }

body {
  font-family: var(--font);
  background: var(--gray-50);
  color: var(--gray-800);
  line-height: 1.6;
  min-height: 100vh;
}

/* ── AUTH PAGES ─────────────────────────────────────── */
.auth-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 1fr 1fr;
}

.auth-panel {
  background: linear-gradient(160deg, var(--navy) 0%, var(--navy-lt) 60%, var(--sky) 100%);
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 60px;
  position: relative;
  overflow: hidden;
}
.auth-panel::before {
  content: '';
  position: absolute;
  inset: 0;
  background: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23ffffff' fill-opacity='0.04'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
}
.auth-panel-logo { font-size: 2rem; font-weight: 700; color: #fff; margin-bottom: 24px; position: relative; }
.auth-panel-logo span { opacity: .7; }
.auth-panel h2 { font-family: var(--font-display); font-size: 2.4rem; color: #fff; line-height: 1.2; position: relative; margin-bottom: 16px; }
.auth-panel p { color: rgba(255,255,255,.7); font-size: 1.05rem; position: relative; max-width: 360px; }

.auth-form-wrap {
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 60px 70px;
  background: var(--white);
}
.auth-form-wrap h1 { font-size: 1.75rem; font-weight: 700; color: var(--navy); margin-bottom: 6px; }
.auth-form-wrap .sub { color: var(--gray-400); margin-bottom: 32px; font-size: .95rem; }

.form-group { margin-bottom: 18px; }
.form-group label { display: block; font-weight: 600; font-size: .85rem; color: var(--gray-600); margin-bottom: 6px; text-transform: uppercase; letter-spacing: .04em; }
.form-control {
  width: 100%;
  padding: 11px 14px;
  border: 2px solid var(--gray-200);
  border-radius: var(--radius);
  font-size: .97rem;
  font-family: var(--font);
  color: var(--gray-800);
  transition: border-color .2s, box-shadow .2s;
  background: var(--white);
}
.form-control:focus { outline: none; border-color: var(--sky); box-shadow: 0 0 0 4px rgba(43,143,212,.12); }
.form-control.error { border-color: var(--rose); }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 24px;
  border: none;
  border-radius: var(--radius);
  font-family: var(--font);
  font-size: .97rem;
  font-weight: 600;
  cursor: pointer;
  transition: transform .15s, box-shadow .15s, background .2s;
  text-decoration: none;
}
.btn:active { transform: scale(.98); }
.btn-primary { background: var(--sky); color: #fff; box-shadow: 0 4px 14px rgba(43,143,212,.35); }
.btn-primary:hover { background: #1f7bbf; box-shadow: 0 6px 20px rgba(43,143,212,.45); }
.btn-navy { background: var(--navy); color: #fff; }
.btn-navy:hover { background: var(--navy-mid); }
.btn-success { background: var(--mint); color: #fff; }
.btn-success:hover { filter: brightness(1.08); }
.btn-danger { background: var(--rose); color: #fff; }
.btn-danger:hover { filter: brightness(1.08); }
.btn-outline { background: transparent; border: 2px solid var(--gray-200); color: var(--gray-600); }
.btn-outline:hover { border-color: var(--sky); color: var(--sky); }
.btn-sm { padding: 7px 14px; font-size: .85rem; }
.btn-block { width: 100%; }
.btn-icon { width: 36px; height: 36px; padding: 0; border-radius: 8px; }

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

.sidebar {
  width: var(--sidebar-w);
  background: var(--navy);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  z-index: 100;
  transition: transform .3s;
}
.sidebar-logo {
  padding: 28px 24px 20px;
  border-bottom: 1px solid rgba(255,255,255,.08);
}
.sidebar-logo .brand { font-size: 1.2rem; font-weight: 700; color: #fff; }
.sidebar-logo .brand span { color: var(--sky-lt); }
.sidebar-logo .tagline { font-size: .75rem; color: rgba(255,255,255,.4); margin-top: 2px; }

.sidebar-nav { flex: 1; padding: 16px 0; overflow-y: auto; }
.nav-section { padding: 12px 16px 4px; font-size: .7rem; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; color: rgba(255,255,255,.3); }
.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 20px;
  color: rgba(255,255,255,.65);
  text-decoration: none;
  font-weight: 500;
  font-size: .92rem;
  transition: background .15s, color .15s;
  border-radius: 0;
  position: relative;
}
.nav-item:hover { background: rgba(255,255,255,.07); color: #fff; }
.nav-item.active { background: rgba(43,143,212,.25); color: #fff; }
.nav-item.active::before { content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; background: var(--sky); border-radius: 0 2px 2px 0; }
.nav-item .nav-icon { font-size: 1.1rem; width: 20px; text-align: center; flex-shrink: 0; }
.nav-badge { margin-left: auto; background: var(--rose); color: #fff; font-size: .7rem; font-weight: 700; padding: 2px 7px; border-radius: 20px; }

.sidebar-footer {
  padding: 16px;
  border-top: 1px solid rgba(255,255,255,.08);
}
.sidebar-user { display: flex; align-items: center; gap: 10px; }
.sidebar-avatar { width: 36px; height: 36px; border-radius: 50%; background: var(--sky); display: flex; align-items: center; justify-content: center; font-weight: 700; color: #fff; font-size: .85rem; flex-shrink: 0; }
.sidebar-user-info .name { font-size: .88rem; font-weight: 600; color: #fff; }
.sidebar-user-info .role-label { font-size: .75rem; color: rgba(255,255,255,.4); }

/* ── TOPBAR ─────────────────────────────────────────── */
.main-content { margin-left: var(--sidebar-w); flex: 1; display: flex; flex-direction: column; }
.topbar {
  background: var(--white);
  border-bottom: 1px solid var(--gray-200);
  padding: 0 32px;
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 50;
}
.topbar-title { font-size: 1.1rem; font-weight: 700; color: var(--navy); }
.topbar-right { display: flex; align-items: center; gap: 12px; }

.notif-bell { position: relative; }
.notif-bell .count {
  position: absolute;
  top: -4px; right: -4px;
  background: var(--rose);
  color: #fff;
  font-size: .65rem;
  font-weight: 700;
  width: 17px; height: 17px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
}

/* ── PAGE BODY ──────────────────────────────────────── */
.page-body { padding: 32px; flex: 1; }
.page-header { margin-bottom: 28px; }
.page-header h1 { font-size: 1.6rem; font-weight: 700; color: var(--navy); }
.page-header p { color: var(--gray-400); margin-top: 4px; }

/* ── CARDS ──────────────────────────────────────────── */
.card {
  background: var(--white);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--gray-200);
}
.card-header {
  padding: 20px 24px 16px;
  border-bottom: 1px solid var(--gray-100);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.card-header h3 { font-size: 1.02rem; font-weight: 700; color: var(--navy); }
.card-body { padding: 24px; }

/* ── STAT CARDS ─────────────────────────────────────── */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px,1fr)); gap: 20px; margin-bottom: 28px; }
.stat-card {
  background: var(--white);
  border-radius: var(--radius-lg);
  padding: 22px 24px;
  border: 1px solid var(--gray-200);
  box-shadow: var(--shadow-sm);
  display: flex;
  align-items: center;
  gap: 16px;
}
.stat-icon { width: 48px; height: 48px; border-radius: 12px; display: flex; align-items: center; justify-content: center; font-size: 1.4rem; flex-shrink: 0; }
.stat-icon.blue   { background: var(--cloud); }
.stat-icon.mint   { background: rgba(26,184,154,.1); }
.stat-icon.amber  { background: rgba(245,158,11,.1); }
.stat-icon.rose   { background: rgba(239,68,68,.1); }
.stat-value { font-size: 1.9rem; font-weight: 700; color: var(--navy); line-height: 1; }
.stat-label { font-size: .82rem; color: var(--gray-400); margin-top: 2px; font-weight: 500; }

/* ── PROGRESS BAR ───────────────────────────────────── */
.progress-wrap { margin: 16px 0; }
.progress-label { display: flex; justify-content: space-between; font-size: .85rem; font-weight: 600; color: var(--gray-600); margin-bottom: 6px; }
.progress-bar { height: 10px; background: var(--gray-100); border-radius: 99px; overflow: hidden; }
.progress-bar-fill { height: 100%; background: linear-gradient(90deg, var(--sky), var(--mint)); border-radius: 99px; transition: width .6s ease; }

/* ── DOC STATUS BADGES ──────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  border-radius: 99px;
  font-size: .78rem;
  font-weight: 600;
}
.badge-approved  { background: rgba(26,184,154,.12); color: #0d9c80; }
.badge-pending   { background: rgba(245,158,11,.12); color: #c07a00; }
.badge-rejected  { background: rgba(239,68,68,.12); color: #c82020; }
.badge-missing   { background: var(--gray-100); color: var(--gray-400); }
.badge-info      { background: rgba(43,143,212,.12); color: var(--sky); }
.badge-draft     { background: var(--gray-100); color: var(--gray-600); }

/* ── UPLOAD ZONE ────────────────────────────────────── */
.upload-zone {
  border: 2px dashed var(--gray-200);
  border-radius: var(--radius-lg);
  padding: 40px 24px;
  text-align: center;
  cursor: pointer;
  transition: border-color .2s, background .2s;
}
.upload-zone:hover, .upload-zone.drag-over {
  border-color: var(--sky);
  background: var(--cloud);
}
.upload-zone .upload-icon { font-size: 2.5rem; margin-bottom: 12px; }
.upload-zone h4 { font-size: 1rem; font-weight: 600; color: var(--navy); margin-bottom: 4px; }
.upload-zone p { font-size: .85rem; color: var(--gray-400); }
.upload-zone input[type=file] { display: none; }

/* ── DOC ITEM ───────────────────────────────────────── */
.doc-item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 0;
  border-bottom: 1px solid var(--gray-100);
}
.doc-item:last-child { border-bottom: none; }
.doc-item-icon { width: 40px; height: 40px; border-radius: 10px; background: var(--cloud); display: flex; align-items: center; justify-content: center; font-size: 1.2rem; flex-shrink: 0; }
.doc-item-info { flex: 1; min-width: 0; }
.doc-item-name { font-weight: 600; font-size: .92rem; color: var(--navy); }
.doc-item-meta { font-size: .78rem; color: var(--gray-400); margin-top: 2px; }
.doc-item-actions { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }

/* ── TIMESHEET GRID ─────────────────────────────────── */
.ts-grid { display: grid; grid-template-columns: repeat(7,1fr); gap: 10px; margin: 20px 0; }
.ts-day { display: flex; flex-direction: column; gap: 6px; }
.ts-day-label { font-size: .75rem; font-weight: 700; text-align: center; color: var(--gray-600); text-transform: uppercase; letter-spacing: .05em; }
.ts-day input {
  width: 100%;
  text-align: center;
  padding: 10px 6px;
  border: 2px solid var(--gray-200);
  border-radius: var(--radius);
  font-size: 1rem;
  font-weight: 600;
  color: var(--navy);
  font-family: var(--font);
  transition: border-color .2s;
}
.ts-day input:focus { outline: none; border-color: var(--sky); }
.ts-day input.error { border-color: var(--rose); }
.ts-total { text-align: center; margin-top: 12px; }
.ts-total-num { font-size: 2rem; font-weight: 700; color: var(--navy); }
.ts-total-label { font-size: .85rem; color: var(--gray-400); }
.ts-overtime { color: var(--amber); }

/* ── TABLE ──────────────────────────────────────────── */
.table-wrap { overflow-x: auto; border-radius: var(--radius); }
table { width: 100%; border-collapse: collapse; }
thead tr { background: var(--gray-50); }
th { padding: 12px 16px; text-align: left; font-size: .78rem; font-weight: 700; color: var(--gray-600); text-transform: uppercase; letter-spacing: .06em; border-bottom: 1px solid var(--gray-200); white-space: nowrap; }
td { padding: 13px 16px; border-bottom: 1px solid var(--gray-100); font-size: .9rem; color: var(--gray-800); }
tr:last-child td { border-bottom: none; }
tbody tr:hover { background: var(--gray-50); }

/* ── ALERTS & MODALS ────────────────────────────────── */
.alert { padding: 13px 16px; border-radius: var(--radius); font-size: .9rem; margin-bottom: 16px; display: flex; align-items: flex-start; gap: 10px; }
.alert-success { background: rgba(26,184,154,.1); color: #0a7a65; border: 1px solid rgba(26,184,154,.2); }
.alert-error   { background: rgba(239,68,68,.08); color: #b91c1c; border: 1px solid rgba(239,68,68,.15); }
.alert-warn    { background: rgba(245,158,11,.1); color: #92400e; border: 1px solid rgba(245,158,11,.2); }
.alert-info    { background: var(--cloud); color: var(--navy); border: 1px solid rgba(43,143,212,.2); }

.modal-overlay { position: fixed; inset: 0; background: rgba(0,0,0,.45); z-index: 200; display: flex; align-items: center; justify-content: center; padding: 20px; }
.modal-overlay.hidden { display: none; }
.modal { background: var(--white); border-radius: var(--radius-lg); box-shadow: var(--shadow-lg); width: 100%; max-width: 520px; max-height: 90vh; overflow-y: auto; }
.modal-header { padding: 22px 24px 16px; border-bottom: 1px solid var(--gray-100); display: flex; align-items: center; justify-content: space-between; }
.modal-header h3 { font-size: 1.1rem; font-weight: 700; color: var(--navy); }
.modal-body { padding: 24px; }
.modal-footer { padding: 16px 24px; border-top: 1px solid var(--gray-100); display: flex; gap: 10px; justify-content: flex-end; }

/* ── RESPONSIVE ─────────────────────────────────────── */
@media (max-width: 1024px) {
  .auth-panel { display: none; }
  .auth-shell { grid-template-columns: 1fr; }
  .auth-form-wrap { padding: 40px 32px; }
  :root { --sidebar-w: 0px; }
  .sidebar { transform: translateX(-248px); width: 248px; }
  .sidebar.open { transform: translateX(0); }
  .main-content { margin-left: 0; }
}

@media (max-width: 600px) {
  .ts-grid { grid-template-columns: repeat(4,1fr); }
  .stats-grid { grid-template-columns: 1fr 1fr; }
  .page-body { padding: 16px; }
}

/* ── UTILITY ────────────────────────────────────────── */
.hidden { display: none !important; }
.flex { display: flex; }
.flex-between { display: flex; align-items: center; justify-content: space-between; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }
.mt-4 { margin-top: 16px; }
.mt-6 { margin-top: 24px; }
.mb-4 { margin-bottom: 16px; }
.text-sm { font-size: .85rem; }
.text-muted { color: var(--gray-400); }
.text-right { text-align: right; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 20px; }
@media(max-width:700px) { .grid-2,.grid-3 { grid-template-columns: 1fr; } }

/* ── SESSION TIMEOUT BANNER ─────────────────────────── */
#session-warn {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: var(--navy);
  color: #fff;
  padding: 14px 20px;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  z-index: 300;
  font-size: .9rem;
  display: flex;
  align-items: center;
  gap: 12px;
}
