/* e-Leave CMS - Main Stylesheet */

:root {
  --navy:      #0d2f44;
  --navy-dark: #081a28;
  --red:       #c0392b;
  --red-light: #e74c3c;
  --green:     #16a34a;
  --gold:      #f5a623;
  --white:     #ffffff;
  --off-white: #f4f7fa;
  --border:    #e2e8f0;
  --mid-gray:  #94a3b8;
  --dark-gray: #334155;
  --danger:    #dc2626;
  --warning:   #d97706;
  --info:      #2563eb;
  --shadow-sm: 0 1px 3px rgba(0,0,0,.08);
  --shadow:    0 4px 16px rgba(0,0,0,.1);
  --radius:    8px;
  --radius-lg: 14px;
  --font-body: 'Inter', system-ui, -apple-system, sans-serif;
  --font-display: 'Georgia', serif;
  --transition: all .2s ease;
}

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

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

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

/* ── Typography ─────────────────────────────────────── */
h1,h2,h3,h4 { color: var(--navy); font-weight: 700; line-height: 1.3; }
a { color: var(--navy); text-decoration: none; }
a:hover { color: var(--red); }

/* ── Layout ─────────────────────────────────────────── */
.container { max-width: 1100px; margin: 0 auto; padding: 0 1.25rem; }
.page-wrap  { min-height: calc(100vh - 60px); padding: 2rem 0 4rem; }

/* ── Buttons ─────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; gap: .45rem;
  padding: .6rem 1.25rem; border-radius: var(--radius);
  font-size: .88rem; font-weight: 600; font-family: var(--font-body);
  border: 1.5px solid transparent; cursor: pointer;
  transition: var(--transition); text-decoration: none;
  white-space: nowrap;
}
.btn-primary { background: var(--navy); color: #fff; border-color: var(--navy); }
.btn-primary:hover { background: var(--navy-dark); color: #fff; }
.btn-danger  { background: var(--danger); color: #fff; border-color: var(--danger); }
.btn-danger:hover { background: #b91c1c; color: #fff; }
.btn-success { background: var(--green); color: #fff; border-color: var(--green); }
.btn-outline { background: transparent; color: var(--dark-gray); border-color: var(--border); }
.btn-outline:hover { border-color: var(--navy); color: var(--navy); }
.btn-red     { background: var(--red); color: #fff; border-color: var(--red); }
.btn-red:hover { background: var(--red-light); color: #fff; }
.btn-sm { padding: .4rem .85rem; font-size: .8rem; }
.btn-xs { padding: .25rem .6rem; font-size: .75rem; }
.btn:disabled { opacity: .6; cursor: not-allowed; }

/* ── Forms ───────────────────────────────────────────── */
.form-group { margin-bottom: 1.25rem; }
.form-group label {
  display: block; font-size: .83rem; font-weight: 600;
  color: var(--dark-gray); margin-bottom: .4rem;
}
.form-control {
  width: 100%; padding: .7rem .9rem;
  border: 1.5px solid var(--border); border-radius: var(--radius);
  font-size: .9rem; font-family: var(--font-body);
  background: var(--white); color: var(--dark-gray);
  transition: border-color .2s;
  outline: none;
}
.form-control:focus { border-color: var(--navy); }
.form-control::placeholder { color: var(--mid-gray); }
.form-hint { font-size: .76rem; color: var(--mid-gray); margin-top: .3rem; display: block; }
textarea.form-control { resize: vertical; min-height: 100px; }
select.form-control { cursor: pointer; }

/* ── Cards ───────────────────────────────────────────── */
.card {
  background: var(--white); border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm); border: 0.5px solid var(--border);
  overflow: hidden;
}
.card-header {
  padding: 1rem 1.25rem; border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
}
.card-header h2 { font-size: 1rem; font-weight: 700; color: var(--navy); }
.card-body { padding: 1.25rem; }

/* ── Badges ──────────────────────────────────────────── */
.badge {
  display: inline-block; padding: .2rem .6rem; border-radius: 99px;
  font-size: .72rem; font-weight: 700; text-transform: uppercase;
  letter-spacing: .04em;
}
.badge-warning  { background: #fef3c7; color: #92400e; }
.badge-success  { background: #d1fae5; color: #065f46; }
.badge-danger   { background: #fee2e2; color: #991b1b; }
.badge-info     { background: #dbeafe; color: #1e40af; }
.badge-gray     { background: #f1f5f9; color: #475569; }
.badge-navy     { background: #e0e7ef; color: var(--navy); }

/* ── Alerts ──────────────────────────────────────────── */
.alert {
  padding: .85rem 1.1rem; border-radius: var(--radius);
  margin-bottom: 1rem; font-size: .88rem; display: flex;
  align-items: flex-start; gap: .6rem;
}
.alert-success { background: #d1fae5; color: #065f46; border: 1px solid #6ee7b7; }
.alert-danger  { background: #fee2e2; color: #991b1b; border: 1px solid #fca5a5; }
.alert-warning { background: #fef3c7; color: #92400e; border: 1px solid #fcd34d; }
.alert-info    { background: #dbeafe; color: #1e40af; border: 1px solid #93c5fd; }

/* ── Tables ──────────────────────────────────────────── */
.table-wrap { overflow-x: auto; }
table.data-table { width: 100%; border-collapse: collapse; font-size: .85rem; }
table.data-table th {
  background: var(--off-white); padding: .65rem .9rem;
  text-align: left; font-size: .75rem; font-weight: 700;
  color: var(--mid-gray); text-transform: uppercase; letter-spacing: .05em;
  border-bottom: 2px solid var(--border);
}
table.data-table td {
  padding: .75rem .9rem; border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
table.data-table tr:hover td { background: #f8fafc; }
table.data-table tr:last-child td { border-bottom: none; }

/* ── Auth pages ──────────────────────────────────────── */
.auth-wrap {
  min-height: 100vh; display: flex; align-items: center;
  justify-content: center; padding: 2rem 1rem;
  background: linear-gradient(135deg, var(--navy-dark) 0%, var(--navy) 100%);
}
.auth-box {
  background: var(--white); border-radius: var(--radius-lg);
  padding: 2.5rem 2rem; width: 100%; max-width: 420px;
  box-shadow: var(--shadow);
}
.auth-logo {
  text-align: center; margin-bottom: 1.75rem;
}
.auth-logo h1 {
  font-size: 1.5rem; color: var(--navy);
}
.auth-logo p { font-size: .82rem; color: var(--mid-gray); margin-top: .25rem; }
.auth-logo .logo-icon {
  width: 60px; height: 60px; background: var(--navy);
  border-radius: 14px; display: flex; align-items: center;
  justify-content: center; margin: 0 auto .75rem;
  font-size: 1.5rem; color: var(--gold);
}
.auth-step {
  font-size: .78rem; color: var(--mid-gray); text-align: center;
  margin-bottom: 1.25rem;
}
.auth-step span {
  background: var(--navy); color: #fff; border-radius: 50%;
  width: 20px; height: 20px; display: inline-flex;
  align-items: center; justify-content: center;
  font-size: .7rem; font-weight: 700; margin-right: .3rem;
}

/* ── Staff info card (shown after ID lookup) ─────────── */
.staff-found {
  background: #f0fdf4; border: 1.5px solid #86efac;
  border-radius: var(--radius); padding: .85rem 1rem;
  margin-bottom: 1.25rem; display: flex; align-items: center; gap: .75rem;
}
.staff-found .avatar {
  width: 42px; height: 42px; border-radius: 50%;
  background: var(--navy); color: var(--gold);
  display: flex; align-items: center; justify-content: center;
  font-size: 1rem; font-weight: 700; flex-shrink: 0;
}
.staff-found .info p { font-weight: 700; color: var(--navy); font-size: .9rem; }
.staff-found .info span { font-size: .78rem; color: #16a34a; }

/* ── Nav ─────────────────────────────────────────────── */
.topnav {
  background: var(--navy); color: #fff;
  position: sticky; top: 0; z-index: 100;
  box-shadow: 0 2px 8px rgba(0,0,0,.15);
}
.topnav-inner {
  display: flex; align-items: center; justify-content: space-between;
  height: 60px; padding: 0 1.25rem;
}
.topnav-brand { font-weight: 700; font-size: 1rem; color: #fff; display: flex; align-items: center; gap: .5rem; }
.topnav-brand span { color: var(--gold); }
.topnav-links { display: flex; align-items: center; gap: .25rem; }
.topnav-links a {
  color: rgba(255,255,255,.7); font-size: .82rem; padding: .4rem .75rem;
  border-radius: var(--radius); transition: var(--transition); font-weight: 500;
}
.topnav-links a:hover, .topnav-links a.active { color: #fff; background: rgba(255,255,255,.1); }
.topnav-links a.btn-red { color: #fff; background: var(--red); }
.topnav-user {
  display: flex; align-items: center; gap: .6rem;
  font-size: .82rem; color: rgba(255,255,255,.8);
}
.topnav-user .avatar {
  width: 32px; height: 32px; border-radius: 50%;
  background: var(--gold); color: var(--navy-dark);
  display: flex; align-items: center; justify-content: center;
  font-size: .75rem; font-weight: 700;
}

/* ── Stat cards ──────────────────────────────────────── */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px,1fr)); gap: 1rem; margin-bottom: 1.5rem; }
.stat-card {
  background: var(--white); border-radius: var(--radius-lg);
  padding: 1.25rem; box-shadow: var(--shadow-sm);
  border: 0.5px solid var(--border);
  display: flex; align-items: center; gap: 1rem;
}
.stat-icon {
  width: 44px; height: 44px; border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.1rem; flex-shrink: 0;
}
.stat-num { font-size: 1.5rem; font-weight: 700; color: var(--navy); line-height: 1; }
.stat-label { font-size: .75rem; color: var(--mid-gray); margin-top: 2px; }

/* ── Leave balance bar ───────────────────────────────── */
.balance-bar { background: var(--border); border-radius: 99px; height: 8px; margin-top: .4rem; overflow: hidden; }
.balance-fill { height: 100%; border-radius: 99px; background: var(--green); transition: width .5s ease; }
.balance-fill.low { background: var(--warning); }
.balance-fill.empty { background: var(--danger); }

/* ── Approval timeline ───────────────────────────────── */
.timeline { list-style: none; position: relative; padding-left: 1.75rem; }
.timeline::before {
  content: ''; position: absolute; left: .55rem; top: 0; bottom: 0;
  width: 2px; background: var(--border);
}
.timeline li { position: relative; padding-bottom: 1.25rem; }
.timeline li::before {
  content: ''; position: absolute; left: -1.2rem; top: .3rem;
  width: 12px; height: 12px; border-radius: 50%;
  background: var(--border); border: 2px solid var(--white);
}
.timeline li.done::before { background: var(--green); }
.timeline li.active::before { background: var(--gold); }
.timeline li.rejected::before { background: var(--danger); }
.timeline-label { font-size: .8rem; font-weight: 700; color: var(--navy); }
.timeline-sub { font-size: .75rem; color: var(--mid-gray); margin-top: .15rem; }
.timeline-comment { font-size: .78rem; color: var(--dark-gray); margin-top: .3rem; font-style: italic; }

/* ── Pagination ──────────────────────────────────────── */
.pagination { display: flex; gap: .35rem; justify-content: center; margin-top: 1.5rem; flex-wrap: wrap; }
.pagination a, .pagination span {
  width: 34px; height: 34px; display: flex; align-items: center; justify-content: center;
  border-radius: var(--radius); font-size: .82rem; border: 1.5px solid var(--border);
  text-decoration: none; color: var(--dark-gray);
}
.pagination a:hover { border-color: var(--navy); color: var(--navy); }
.pagination span.active { background: var(--navy); color: #fff; border-color: var(--navy); }

/* ── Empty state ─────────────────────────────────────── */
.empty-state { text-align: center; padding: 3rem; color: var(--mid-gray); }
.empty-state i { font-size: 2.5rem; opacity: .3; display: block; margin-bottom: .75rem; }

/* ── Mobile ──────────────────────────────────────────── */
@media (max-width: 640px) {
  .auth-box { padding: 1.75rem 1.25rem; }
  .topnav-links a { padding: .35rem .5rem; font-size: .78rem; }
  table.data-table thead { display: none; }
  table.data-table td { display: flex; justify-content: space-between; align-items: center; padding: .5rem .75rem; }
  table.data-table td::before { content: attr(data-label); font-weight: 700; font-size: .75rem; color: var(--mid-gray); }
  table.data-table tr { display: block; border: 1px solid var(--border); border-radius: var(--radius); margin-bottom: .75rem; }
  table.data-table tr:hover td { background: var(--white); }
}
