/* ════════════════════════════════════════════════════════════════════════════
   ExpenseClaim — Premium UI v2  (Dark/Light · Glassmorphism · Smooth)
   ════════════════════════════════════════════════════════════════════════════ */

/* ── CSS Variables ─────────────────────────────────────────────────────────── */
:root {
  --bg:        #080814;
  --surface:   #0f0f1e;
  --surface2:  #161628;
  --surface3:  #1d1d35;
  --border:    rgba(255,255,255,.07);
  --border2:   rgba(255,255,255,.12);
  --text:      #eaeaff;
  --text2:     #7878a8;
  --text3:     #5050788;
  --accent:    #6c63ff;
  --accent2:   #9d4edd;
  --success:   #00d68f;
  --warning:   #ffb703;
  --danger:    #ff4d6d;
  --info:      #60a5fa;
  --radius:    14px;
  --radius-lg: 20px;
  --sidebar-w: 248px;
  --shadow-sm: 0 2px 8px rgba(0,0,0,.25);
  --shadow-md: 0 8px 32px rgba(0,0,0,.35);
  --shadow-lg: 0 20px 60px rgba(0,0,0,.5);
}

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

body {
  font-family: 'Sarabun', sans-serif;
  font-size: 14px;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

/* ── Subtle animated background gradient ─────────────────────────────────── */
body::before {
  content: '';
  position: fixed; inset: 0; z-index: -1;
  background:
    radial-gradient(ellipse 60% 40% at 20% 20%, rgba(108,99,255,.07) 0%, transparent 60%),
    radial-gradient(ellipse 50% 50% at 80% 80%, rgba(157,78,221,.05) 0%, transparent 60%);
  pointer-events: none;
}

/* ════════════════════════════════════════════════════════════════════════════
   LAYOUT
   ════════════════════════════════════════════════════════════════════════════ */

.app-container { display: flex; min-height: 100vh; }

/* ── Sidebar ─────────────────────────────────────────────────────────────── */
.sidebar {
  width: var(--sidebar-w);
  background: linear-gradient(180deg, #0e0e20 0%, #0a0a18 100%);
  border-right: 1px solid var(--border);
  display: flex; flex-direction: column;
  position: fixed; top: 0; left: 0; bottom: 0;
  z-index: 100;
  overflow-y: auto;
  overflow-x: hidden;
}
.sidebar::before {
  content: '';
  position: absolute; top: 0; left: 0; right: 0; height: 1px;
  background: linear-gradient(90deg, transparent, var(--accent), transparent);
  opacity: .6;
}

.sidebar-logo {
  display: flex; align-items: center; gap: .8rem;
  padding: 1.4rem 1.1rem;
  border-bottom: 1px solid var(--border);
}
.logo-icon {
  width: 38px; height: 38px;
  border-radius: 11px;
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent2) 100%);
  color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.05rem;
  flex-shrink: 0;
  box-shadow: 0 4px 12px rgba(108,99,255,.4);
}
.logo-text { font-size: .94rem; font-weight: 800; color: var(--text); letter-spacing: -.3px; }
.logo-sub  { font-size: .65rem; color: var(--text2); margin-top: 1px; letter-spacing: .4px; }

.sidebar-section {
  font-size: .6rem; font-weight: 800;
  text-transform: uppercase; letter-spacing: 1.4px;
  color: var(--text2);
  padding: 1rem 1.1rem .3rem;
  opacity: .7;
}

.nav-item {
  display: flex; align-items: center; gap: .65rem;
  padding: .58rem 1.1rem;
  color: var(--text2);
  text-decoration: none;
  font-size: .84rem; font-weight: 500;
  border-radius: 10px;
  margin: 1.5px 8px;
  transition: all .2s ease;
  position: relative;
}
.nav-item:hover {
  background: rgba(255,255,255,.05);
  color: var(--text);
  transform: translateX(2px);
}
.nav-item.active {
  background: linear-gradient(135deg, rgba(108,99,255,.2), rgba(157,78,221,.1));
  color: #b8b0ff;
  font-weight: 700;
  box-shadow: inset 0 0 0 1px rgba(108,99,255,.25);
}
.nav-item.active::before {
  content: '';
  position: absolute; left: -8px; top: 50%; transform: translateY(-50%);
  width: 3px; height: 60%; min-height: 18px;
  background: linear-gradient(180deg, var(--accent), var(--accent2));
  border-radius: 0 3px 3px 0;
}
.nav-item .fa { width: 16px; text-align: center; font-size: .88rem; opacity: .8; }
.nav-item.active .fa { opacity: 1; }

.sidebar-footer {
  margin-top: auto;
  padding: .85rem;
  border-top: 1px solid var(--border);
  background: rgba(0,0,0,.2);
}

/* ── Main area ───────────────────────────────────────────────────────────── */
.main-area {
  margin-left: var(--sidebar-w);
  flex: 1; display: flex; flex-direction: column; min-height: 100vh;
}

/* ── Topbar ──────────────────────────────────────────────────────────────── */
.topbar {
  height: 56px;
  background: rgba(15,15,30,.85);
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 1.5rem;
  position: sticky; top: 0; z-index: 50;
}
.topbar-title { font-size: .95rem; font-weight: 700; color: var(--text); }
.topbar-btn {
  display: inline-flex; align-items: center; gap: .4rem;
  padding: .48rem 1rem;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  color: #fff; border: none; border-radius: 10px;
  font-size: .82rem; font-weight: 700;
  cursor: pointer; text-decoration: none;
  transition: all .2s ease;
  box-shadow: 0 4px 12px rgba(108,99,255,.35);
  letter-spacing: .2px;
}
.topbar-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(108,99,255,.5);
  opacity: .95;
}

.page-content { padding: 1.75rem 1.5rem; flex: 1; }

/* ── Page header ─────────────────────────────────────────────────────────── */
.page-header {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: 1rem; margin-bottom: 1.75rem; flex-wrap: wrap;
}
.page-title {
  font-size: 1.3rem; font-weight: 900; color: var(--text);
  display: flex; align-items: center; gap: .55rem;
  letter-spacing: -.4px;
}
.page-subtitle { font-size: .78rem; color: var(--text2); margin-top: 4px; }

/* ════════════════════════════════════════════════════════════════════════════
   CARDS
   ════════════════════════════════════════════════════════════════════════════ */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.4rem;
  margin-bottom: 1.5rem;
  box-shadow: var(--shadow-sm);
  transition: box-shadow .25s ease;
}
.card:hover { box-shadow: var(--shadow-md); }

.card-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 1.1rem; padding-bottom: .85rem;
  border-bottom: 1px solid var(--border);
}
.card-title {
  font-size: .9rem; font-weight: 700;
  display: flex; align-items: center; gap: .45rem;
}

/* ════════════════════════════════════════════════════════════════════════════
   TABLES
   ════════════════════════════════════════════════════════════════════════════ */
.table-wrap { overflow-x: auto; border-radius: 10px; }
table { width: 100%; border-collapse: collapse; }

thead th {
  background: rgba(255,255,255,.03);
  color: var(--text2);
  font-size: .68rem; font-weight: 800;
  text-transform: uppercase; letter-spacing: .9px;
  padding: .75rem .9rem;
  text-align: left; white-space: nowrap;
  border-bottom: 1px solid var(--border);
}
thead tr:first-child th:first-child { border-radius: 10px 0 0 0; }
thead tr:first-child th:last-child  { border-radius: 0 10px 0 0; }

tbody td {
  padding: .78rem .9rem;
  font-size: .84rem;
  border-bottom: 1px solid rgba(255,255,255,.04);
  vertical-align: middle;
}
tbody tr:last-child td { border-bottom: none; }
tbody tr { transition: background .15s ease; }
tbody tr:hover td { background: rgba(255,255,255,.03); }

.text-right, .text-right * { text-align: right !important; }
.font-mono { font-family: 'Space Mono', monospace; font-size: .82rem; }

/* ════════════════════════════════════════════════════════════════════════════
   BUTTONS
   ════════════════════════════════════════════════════════════════════════════ */
.btn {
  display: inline-flex; align-items: center; gap: .4rem;
  padding: .52rem 1.05rem;
  border: 1px solid var(--border2);
  border-radius: 10px;
  font-size: .84rem; font-weight: 600;
  cursor: pointer; text-decoration: none;
  transition: all .2s ease;
  background: var(--surface2);
  color: var(--text);
  font-family: inherit;
  white-space: nowrap;
  letter-spacing: .1px;
}
.btn:hover { opacity: .88; transform: translateY(-1px); }
.btn:active { transform: translateY(0); }

.btn-primary {
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  color: #fff; border-color: transparent;
  box-shadow: 0 4px 12px rgba(108,99,255,.3);
}
.btn-primary:hover { box-shadow: 0 6px 20px rgba(108,99,255,.5); }
.btn-secondary { background: var(--surface2); color: var(--text); }
.btn-danger    {
  background: rgba(255,77,109,.12);
  color: var(--danger);
  border-color: rgba(255,77,109,.25);
}
.btn-danger:hover { background: rgba(255,77,109,.2); }
.btn-success   {
  background: rgba(0,214,143,.12);
  color: var(--success);
  border-color: rgba(0,214,143,.25);
}
.btn-success:hover { background: rgba(0,214,143,.2); }
.btn-ghost { background: transparent; border-color: transparent; color: var(--text2); }
.btn-ghost:hover { background: var(--surface2); color: var(--text); }
.btn-sm    { padding: .32rem .7rem; font-size: .78rem; border-radius: 8px; }
.btn-icon  {
  padding: .38rem; width: 32px; height: 32px;
  justify-content: center; border-radius: 8px;
  font-size: .82rem;
}

/* ════════════════════════════════════════════════════════════════════════════
   FORMS
   ════════════════════════════════════════════════════════════════════════════ */
.form-group  { margin-bottom: 1.1rem; }
.form-row    { display: grid; grid-template-columns: 1fr 1fr; gap: .85rem; }
.form-group label {
  display: block; font-size: .74rem; font-weight: 700;
  color: var(--text2); margin-bottom: .4rem;
  text-transform: uppercase; letter-spacing: .5px;
}

input[type="text"], input[type="email"], input[type="password"],
input[type="date"], input[type="number"], input[type="tel"],
textarea, select {
  width: 100%;
  background: var(--surface2);
  border: 1.5px solid var(--border);
  border-radius: 10px;
  padding: .58rem .9rem;
  color: var(--text);
  font-size: .88rem; font-family: inherit;
  transition: all .2s ease;
}
input:focus, textarea:focus, select:focus {
  outline: none;
  border-color: var(--accent);
  background: var(--surface3);
  box-shadow: 0 0 0 3px rgba(108,99,255,.15);
}
input:disabled, textarea:disabled, select:disabled { opacity: .45; cursor: not-allowed; }
textarea { resize: vertical; min-height: 80px; }
select   { appearance: none; -webkit-appearance: none; cursor: pointer; }

/* ════════════════════════════════════════════════════════════════════════════
   BADGES
   ════════════════════════════════════════════════════════════════════════════ */
.badge {
  display: inline-flex; align-items: center; gap: .3rem;
  padding: .22rem .75rem;
  border-radius: 999px;
  font-size: .7rem; font-weight: 700; letter-spacing: .4px;
}
.badge-pending    { background: rgba(255,183,3,.12);  color: #ffd60a; border: 1px solid rgba(255,183,3,.2); }
.badge-approved,
.badge-complete   { background: rgba(0,214,143,.12);  color: #2dffc4; border: 1px solid rgba(0,214,143,.2); }
.badge-rejected,
.badge-not_start  { background: rgba(255,77,109,.12); color: #ff8fa3; border: 1px solid rgba(255,77,109,.2); }
.badge-in_progress{ background: rgba(108,99,255,.15); color: #b8b0ff; border: 1px solid rgba(108,99,255,.25); }

/* ════════════════════════════════════════════════════════════════════════════
   ALERTS
   ════════════════════════════════════════════════════════════════════════════ */
.alert {
  display: flex; align-items: center; gap: .65rem;
  padding: .9rem 1.1rem;
  border-radius: 12px;
  font-size: .87rem; font-weight: 500;
  margin-bottom: 1rem;
  border: 1px solid transparent;
}
.alert-success {
  background: rgba(0,214,143,.08);
  color: #2dffc4;
  border-color: rgba(0,214,143,.2);
}
.alert-error {
  background: rgba(255,77,109,.08);
  color: #ff8fa3;
  border-color: rgba(255,77,109,.2);
}
.alert-warning {
  background: rgba(255,183,3,.08);
  color: #ffd60a;
  border-color: rgba(255,183,3,.2);
}

/* ════════════════════════════════════════════════════════════════════════════
   MODALS
   ════════════════════════════════════════════════════════════════════════════ */
@keyframes modalShake {
  0%   { transform: translateX(0) scale(1); }
  15%  { transform: translateX(-7px) scale(1.01); }
  30%  { transform: translateX(7px); }
  45%  { transform: translateX(-5px); }
  60%  { transform: translateX(5px); }
  75%  { transform: translateX(-3px); }
  90%  { transform: translateX(3px); }
  100% { transform: translateX(0) scale(1); }
}
.modal-shake { animation: modalShake .42s cubic-bezier(.36,.07,.19,.97); }

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

.modal-overlay {
  display: none; position: fixed; inset: 0;
  background: rgba(0,0,0,.72);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  z-index: 1000;
  align-items: center; justify-content: center;
  padding: 1rem;
}
.modal-overlay.open { display: flex; }
.modal-overlay.open .modal {
  animation: modalIn .28s cubic-bezier(.34,1.3,.64,1);
}

.modal {
  background: linear-gradient(160deg, #13132b 0%, #0d0d1f 100%);
  border: 1px solid rgba(255,255,255,.1);
  border-radius: 20px;
  width: 600px; max-width: 95vw; max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 30px 80px rgba(0,0,0,.65), 0 0 0 1px rgba(108,99,255,.1);
}
.modal-lg { width: 780px; }

.modal-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 1.2rem 1.6rem;
  border-bottom: 1px solid rgba(255,255,255,.07);
  position: sticky; top: 0;
  background: rgba(13,13,31,.95);
  backdrop-filter: blur(8px);
  z-index: 10;
  border-radius: 20px 20px 0 0;
}
.modal-title {
  font-size: .95rem; font-weight: 800;
  display: flex; align-items: center; gap: .45rem;
  letter-spacing: -.2px;
}
.modal-close {
  background: rgba(255,255,255,.06);
  border: 1px solid rgba(255,255,255,.08);
  color: var(--text2); font-size: .88rem;
  cursor: pointer; padding: .35rem .5rem;
  border-radius: 8px; transition: all .18s;
  display: flex; align-items: center;
}
.modal-close:hover {
  background: rgba(255,77,109,.15);
  color: var(--danger);
  border-color: rgba(255,77,109,.3);
}
.modal-body   { padding: 1.4rem 1.6rem; }
.modal-footer {
  padding: 1.1rem 1.6rem;
  border-top: 1px solid rgba(255,255,255,.07);
  display: flex; gap: .55rem; justify-content: flex-end;
  background: rgba(0,0,0,.1);
  border-radius: 0 0 20px 20px;
}

/* ════════════════════════════════════════════════════════════════════════════
   LOGIN PAGE
   ════════════════════════════════════════════════════════════════════════════ */
.login-wrap {
  min-height: 100vh;
  display: flex; align-items: center; justify-content: center;
  background: var(--bg); padding: 1rem;
  position: relative; overflow: hidden;
}
.login-wrap::before {
  content: '';
  position: absolute; inset: 0;
  background:
    radial-gradient(ellipse 70% 60% at 30% 30%, rgba(108,99,255,.12) 0%, transparent 55%),
    radial-gradient(ellipse 60% 50% at 75% 75%, rgba(157,78,221,.08) 0%, transparent 55%);
}
.login-card {
  background: linear-gradient(160deg, rgba(20,20,45,.9) 0%, rgba(12,12,28,.95) 100%);
  border: 1px solid rgba(255,255,255,.1);
  border-radius: 24px;
  padding: 2.8rem 2.2rem;
  width: 420px; max-width: 100%;
  box-shadow: 0 32px 80px rgba(0,0,0,.6), 0 0 0 1px rgba(108,99,255,.12);
  position: relative; z-index: 1;
  backdrop-filter: blur(20px);
}
.login-logo { text-align: center; margin-bottom: 2rem; }
.login-icon {
  width: 72px; height: 72px; border-radius: 20px;
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent2) 100%);
  color: #fff;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 2rem; margin-bottom: .85rem;
  box-shadow: 0 8px 32px rgba(108,99,255,.5);
}
.login-title { font-size: 1.4rem; font-weight: 900; letter-spacing: -.5px; }
.login-sub   { font-size: .82rem; color: var(--text2); margin-top: .25rem; }

/* ════════════════════════════════════════════════════════════════════════════
   USER MINI (Sidebar footer)
   ════════════════════════════════════════════════════════════════════════════ */
.user-mini { display: flex; align-items: center; gap: .65rem; margin-bottom: .55rem; }
.user-avatar {
  width: 36px; height: 36px; border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: .9rem; font-weight: 800;
  flex-shrink: 0;
  box-shadow: 0 4px 12px rgba(108,99,255,.35);
}
.user-name { font-size: .82rem; font-weight: 700; }
.user-role {
  font-size: .66rem; color: var(--text2);
  text-transform: uppercase; letter-spacing: .5px;
}

/* ════════════════════════════════════════════════════════════════════════════
   STAT CARDS (Dashboard)
   ════════════════════════════════════════════════════════════════════════════ */
.stat-card {
  position: relative; overflow: hidden;
  padding: 1.4rem 1.5rem;
  border-radius: var(--radius-lg);
  background: var(--surface);
  border: 1px solid var(--border);
  transition: all .25s ease;
}
.stat-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 12px 40px rgba(0,0,0,.4);
  border-color: var(--border2);
}
.stat-card::after {
  content: '';
  position: absolute; inset: 0;
  background: linear-gradient(135deg, rgba(255,255,255,.02) 0%, transparent 100%);
  pointer-events: none;
}

/* ════════════════════════════════════════════════════════════════════════════
   UTILITIES
   ════════════════════════════════════════════════════════════════════════════ */
.text-muted { color: var(--text2); }
.mt-1 { margin-top: .5rem; }
.mt-2 { margin-top: 1rem;  }
.mb-1 { margin-bottom: .5rem; }
.mb-2 { margin-bottom: 1rem; }
a { color: var(--accent); text-decoration: none; transition: color .15s; }
a:hover { color: #a29bff; text-decoration: underline; }

/* ════════════════════════════════════════════════════════════════════════════
   SCROLLBAR
   ════════════════════════════════════════════════════════════════════════════ */
::-webkit-scrollbar { width: 4px; height: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: linear-gradient(180deg, var(--accent), var(--accent2));
  border-radius: 99px; opacity: .5;
}

/* ════════════════════════════════════════════════════════════════════════════
   RESPONSIVE — Hamburger + sidebar overlay
   ════════════════════════════════════════════════════════════════════════════ */

.hamburger-btn {
  display: none;
  width: 38px; height: 38px;
  border: 1px solid var(--border2);
  border-radius: 9px;
  background: var(--surface2);
  color: var(--text2);
  cursor: pointer;
  align-items: center; justify-content: center;
  font-size: 1.05rem;
  flex-shrink: 0;
  transition: all .15s;
}
.hamburger-btn:hover { background: var(--surface3); color: var(--text); }

.sidebar-overlay {
  display: none; position: fixed; inset: 0;
  background: rgba(0,0,0,.65);
  backdrop-filter: blur(4px);
  z-index: 99;
}
.sidebar-overlay.open { display: block; }

/* ── Tablet ≤900px ── */
@media (max-width: 900px) {
  .sidebar {
    transform: translateX(-100%);
    transition: transform .28s cubic-bezier(.4,0,.2,1);
    z-index: 200;
  }
  .sidebar.open { transform: translateX(0); }
  .main-area { margin-left: 0 !important; }
  .hamburger-btn { display: inline-flex; }
  .form-row { grid-template-columns: 1fr !important; }
  .modal, .modal-lg { width: 94vw !important; max-width: 94vw !important; }
  .modal-body { padding: 1rem 1.2rem; }
}

/* ── Mobile ≤640px ── */
@media (max-width: 640px) {
  .page-content { padding: 1rem .75rem; }
  .topbar { padding: 0 .75rem; gap: .4rem; height: 52px; }
  .topbar-title { font-size: .88rem; }
  .page-header { flex-direction: column; align-items: flex-start; gap: .55rem; }
  .page-title { font-size: 1.05rem; }
  .card { padding: 1rem .9rem; border-radius: 16px; }
  .card-header { flex-direction: column; align-items: flex-start; gap: .5rem; }
  .table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; border-radius: 8px; }
  /* Modal → bottom sheet */
  .modal-overlay { padding: 0; align-items: flex-end; }
  .modal, .modal-lg {
    width: 100% !important; max-width: 100% !important;
    border-radius: 22px 22px 0 0 !important;
    max-height: 93vh !important;
  }
  .modal-header { border-radius: 22px 22px 0 0 !important; padding: .95rem 1.1rem; }
  .modal-body { padding: .9rem 1.1rem; }
  .modal-footer { padding: .9rem 1.1rem; border-radius: 0 !important; }
  .topbar-btn { padding: .42rem .7rem; font-size: .76rem; }
  .btn-icon { width: 34px; height: 34px; }
  .login-card { padding: 1.75rem 1.15rem; border-radius: 20px; }
  .logo-sub { display: none; }
  .nav-item { padding: .68rem 1.1rem; }
  /* Stats: 2-col */
  [style*="repeat(4,1fr)"] { grid-template-columns: 1fr 1fr !important; }
  /* page-header flex wraps */
  .page-header > div:last-child { width: 100%; }
  .page-header > div:last-child > * { width: 100%; justify-content: center; }
}

/* ── Small ≤380px ── */
@media (max-width: 380px) {
  [style*="repeat(4,1fr)"] { grid-template-columns: 1fr !important; }
  .btn { padding: .4rem .65rem; font-size: .76rem; }
  .page-content { padding: .75rem .55rem; }
  .topbar-btn span { display: none; }
}