/* ============================================================
   YASVI.IN — Main Stylesheet
   Font: Plus Jakarta Sans | Palette: Slate + Violet accent
   ============================================================ */

:root {
  --font-sans:  'Plus Jakarta Sans', system-ui, sans-serif;
  --font-mono:  'JetBrains Mono', monospace;

  /* Admin theme */
  --admin-bg:       #0f0f16;
  --admin-surface:  #16161f;
  --admin-border:   #2a2a3a;
  --admin-accent:   #7c3aed;
  --admin-accent2:  #a78bfa;
  --admin-text:     #e2e8f0;
  --admin-muted:    #64748b;

  /* Client theme */
  --client-bg:      #f8fafc;
  --client-surface: #ffffff;
  --client-border:  #e2e8f0;
  --client-accent:  #4f46e5;
  --client-accent2: #818cf8;
  --client-text:    #1e293b;
  --client-muted:   #64748b;

  /* Employee theme */
  --emp-bg:         #f0fdf4;
  --emp-surface:    #ffffff;
  --emp-border:     #d1fae5;
  --emp-accent:     #059669;
  --emp-accent2:    #34d399;
  --emp-text:       #1e293b;
  --emp-muted:      #64748b;

  --radius:         10px;
  --radius-lg:      16px;
  --shadow:         0 1px 3px rgba(0,0,0,.08), 0 4px 16px rgba(0,0,0,.06);
  --shadow-lg:      0 8px 32px rgba(0,0,0,.12);
  --transition:     all .18s cubic-bezier(.4,0,.2,1);
}

/* ---- Reset ---- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 15px; scroll-behavior: smooth; }
body { font-family: var(--font-sans); line-height: 1.6; }
a { text-decoration: none; }
img { max-width: 100%; display: block; }
input, select, textarea, button { font-family: inherit; }
table { border-collapse: collapse; width: 100%; }

/* ============================================================
   THEME WRAPPERS
   ============================================================ */
.theme-admin    { background: var(--admin-bg);    color: var(--admin-text); }
.theme-client   { background: var(--client-bg);   color: var(--client-text); }
.theme-employee { background: var(--emp-bg);       color: var(--emp-text); }

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

/* SIDEBAR */
.sidebar {
  width: 256px; min-height: 100vh; position: fixed; top: 0; left: 0; z-index: 100;
  display: flex; flex-direction: column; transition: var(--transition);
}
.theme-admin    .sidebar { background: var(--admin-surface); border-right: 1px solid var(--admin-border); }
.theme-client   .sidebar { background: var(--client-accent); }
.theme-employee .sidebar { background: var(--emp-accent); }

.sidebar-brand {
  padding: 24px 20px 20px;
  display: flex; align-items: center; gap: 10px;
  font-size: 1.2rem; font-weight: 800; letter-spacing: -.3px;
}
.theme-admin    .sidebar-brand { color: var(--admin-accent2); border-bottom: 1px solid var(--admin-border); }
.theme-client   .sidebar-brand { color: #fff; border-bottom: 1px solid rgba(255,255,255,.15); }
.theme-employee .sidebar-brand { color: #fff; border-bottom: 1px solid rgba(255,255,255,.15); }

.sidebar-brand .logo-dot { width: 32px; height: 32px; border-radius: 8px; display: grid; place-items: center; font-size: 1.1rem; }
.theme-admin    .logo-dot { background: var(--admin-accent); }
.theme-client   .logo-dot { background: rgba(255,255,255,.2); }
.theme-employee .logo-dot { background: rgba(255,255,255,.2); }

.sidebar-nav { flex: 1; padding: 16px 12px; overflow-y: auto; }
.nav-section-label {
  font-size: .68rem; font-weight: 700; letter-spacing: .12em; text-transform: uppercase;
  padding: 16px 8px 6px; opacity: .5;
}
.nav-item { display: flex; align-items: center; gap: 10px; padding: 9px 12px; border-radius: 8px; font-size: .875rem; font-weight: 500; transition: var(--transition); margin-bottom: 2px; }
.theme-admin    .nav-item { color: var(--admin-muted); }
.theme-admin    .nav-item:hover, .theme-admin    .nav-item.active { background: rgba(124,58,237,.15); color: var(--admin-accent2); }
.theme-client   .nav-item { color: rgba(255,255,255,.75); }
.theme-client   .nav-item:hover, .theme-client   .nav-item.active { background: rgba(255,255,255,.15); color: #fff; }
.theme-employee .nav-item { color: rgba(255,255,255,.75); }
.theme-employee .nav-item:hover, .theme-employee .nav-item.active { background: rgba(255,255,255,.15); color: #fff; }
.nav-item i { width: 18px; text-align: center; font-size: .85rem; }

.sidebar-footer { padding: 16px 12px; border-top: 1px solid rgba(255,255,255,.1); }
.theme-admin .sidebar-footer { border-color: var(--admin-border); }

/* MAIN CONTENT */
.main-content { margin-left: 256px; flex: 1; display: flex; flex-direction: column; min-width: 0; }

/* TOP BAR */
.topbar {
  height: 60px; display: flex; align-items: center; justify-content: space-between;
  padding: 0 28px; position: sticky; top: 0; z-index: 50;
}
.theme-admin    .topbar { background: var(--admin-surface); border-bottom: 1px solid var(--admin-border); }
.theme-client   .topbar { background: #fff; border-bottom: 1px solid var(--client-border); }
.theme-employee .topbar { background: #fff; border-bottom: 1px solid var(--emp-border); }

.topbar-title { font-size: 1rem; font-weight: 700; }
.topbar-actions { display: flex; align-items: center; gap: 12px; }

.avatar {
  width: 36px; height: 36px; border-radius: 50%;
  background: linear-gradient(135deg, var(--admin-accent), var(--admin-accent2));
  display: grid; place-items: center; font-size: .75rem; font-weight: 700; color: #fff;
  cursor: pointer; flex-shrink: 0;
}
.theme-client   .avatar { background: linear-gradient(135deg, var(--client-accent), var(--client-accent2)); }
.theme-employee .avatar { background: linear-gradient(135deg, var(--emp-accent), var(--emp-accent2)); }

/* PAGE CONTENT */
.page-content { padding: 28px; flex: 1; }

/* ============================================================
   CARDS
   ============================================================ */
.card {
  border-radius: var(--radius-lg); padding: 24px; box-shadow: var(--shadow);
  transition: var(--transition);
}
.theme-admin    .card { background: var(--admin-surface); border: 1px solid var(--admin-border); }
.theme-client   .card { background: var(--client-surface); border: 1px solid var(--client-border); }
.theme-employee .card { background: var(--emp-surface); border: 1px solid var(--emp-border); }

.card-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 20px; }
.card-title { font-size: 1rem; font-weight: 700; }

/* Stats cards */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 16px; margin-bottom: 24px; }
.stat-card { border-radius: var(--radius-lg); padding: 20px; position: relative; overflow: hidden; }
.stat-card::before { content: ''; position: absolute; top: -20px; right: -20px; width: 80px; height: 80px; border-radius: 50%; opacity: .12; }
.stat-card.violet  { background: linear-gradient(135deg, #7c3aed, #a78bfa); color: #fff; }
.stat-card.blue    { background: linear-gradient(135deg, #2563eb, #60a5fa); color: #fff; }
.stat-card.green   { background: linear-gradient(135deg, #059669, #34d399); color: #fff; }
.stat-card.amber   { background: linear-gradient(135deg, #d97706, #fbbf24); color: #fff; }
.stat-card.rose    { background: linear-gradient(135deg, #e11d48, #fb7185); color: #fff; }
.stat-card.cyan    { background: linear-gradient(135deg, #0891b2, #22d3ee); color: #fff; }
.stat-number { font-size: 2rem; font-weight: 800; line-height: 1; }
.stat-label  { font-size: .78rem; font-weight: 600; opacity: .85; margin-top: 4px; text-transform: uppercase; letter-spacing: .05em; }
.stat-icon   { position: absolute; right: 18px; top: 18px; font-size: 1.8rem; opacity: .2; }

/* ============================================================
   TABLES
   ============================================================ */
.table-wrap { overflow-x: auto; border-radius: var(--radius); }
.data-table { font-size: .85rem; }
.data-table th {
  padding: 10px 14px; font-size: .72rem; font-weight: 700; text-transform: uppercase;
  letter-spacing: .07em; white-space: nowrap;
}
.theme-admin    .data-table th { background: rgba(124,58,237,.08); color: var(--admin-muted); border-bottom: 1px solid var(--admin-border); }
.theme-client   .data-table th { background: #f8faff; color: var(--client-muted); border-bottom: 1px solid var(--client-border); }
.theme-employee .data-table th { background: #f0fdf4; color: var(--emp-muted); border-bottom: 1px solid var(--emp-border); }

.data-table td { padding: 11px 14px; vertical-align: middle; }
.theme-admin    .data-table td { border-bottom: 1px solid var(--admin-border); }
.theme-client   .data-table td { border-bottom: 1px solid var(--client-border); }
.theme-employee .data-table td { border-bottom: 1px solid var(--emp-border); }

.data-table tbody tr:last-child td { border-bottom: none; }
.data-table tbody tr:hover { background: rgba(0,0,0,.02); }
.theme-admin .data-table tbody tr:hover { background: rgba(255,255,255,.03); }

/* ============================================================
   FORMS
   ============================================================ */
.form-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 16px; }
.form-group { display: flex; flex-direction: column; gap: 6px; }
.form-group.full { grid-column: 1 / -1; }
.form-label { font-size: .8rem; font-weight: 600; }
.theme-admin  .form-label { color: var(--admin-muted); }
.theme-client .form-label { color: var(--client-muted); }

.form-control, .form-select {
  padding: 9px 13px; border-radius: var(--radius); font-size: .875rem;
  transition: var(--transition); width: 100%;
}
.theme-admin .form-control, .theme-admin .form-select {
  background: var(--admin-bg); border: 1.5px solid var(--admin-border);
  color: var(--admin-text);
}
.theme-admin .form-control:focus, .theme-admin .form-select:focus {
  border-color: var(--admin-accent); outline: none; box-shadow: 0 0 0 3px rgba(124,58,237,.2);
}
.theme-client .form-control, .theme-client .form-select {
  background: #fff; border: 1.5px solid var(--client-border); color: var(--client-text);
}
.theme-client .form-control:focus, .theme-client .form-select:focus {
  border-color: var(--client-accent); outline: none; box-shadow: 0 0 0 3px rgba(79,70,229,.15);
}
.theme-employee .form-control, .theme-employee .form-select {
  background: #fff; border: 1.5px solid var(--emp-border); color: var(--emp-text);
}
.theme-employee .form-control:focus {
  border-color: var(--emp-accent); outline: none; box-shadow: 0 0 0 3px rgba(5,150,105,.15);
}
.form-hint { font-size: .75rem; color: var(--admin-muted); }

/* ============================================================
   BUTTONS
   ============================================================ */
.btn { display: inline-flex; align-items: center; gap: 6px; padding: 8px 18px; border-radius: 8px; font-size: .85rem; font-weight: 600; border: none; cursor: pointer; transition: var(--transition); white-space: nowrap; }
.btn-sm { padding: 5px 12px; font-size: .78rem; }
.btn-lg { padding: 12px 28px; font-size: .95rem; }
.btn-icon { width: 34px; height: 34px; padding: 0; justify-content: center; border-radius: 8px; }

.btn-primary   { background: var(--admin-accent);  color: #fff; }
.btn-primary:hover { background: #6d28d9; transform: translateY(-1px); box-shadow: 0 4px 12px rgba(124,58,237,.4); }
.theme-client  .btn-primary { background: var(--client-accent); }
.theme-client  .btn-primary:hover { background: #4338ca; box-shadow: 0 4px 12px rgba(79,70,229,.4); }
.theme-employee .btn-primary { background: var(--emp-accent); }
.theme-employee .btn-primary:hover { background: #047857; box-shadow: 0 4px 12px rgba(5,150,105,.4); }

.btn-secondary { background: rgba(100,116,139,.12); color: var(--admin-muted); }
.btn-secondary:hover { background: rgba(100,116,139,.2); }
.theme-client  .btn-secondary { color: var(--client-muted); }

.btn-danger  { background: #ef4444; color: #fff; }
.btn-danger:hover { background: #dc2626; transform: translateY(-1px); box-shadow: 0 4px 12px rgba(239,68,68,.4); }
.btn-success { background: #22c55e; color: #fff; }
.btn-success:hover { background: #16a34a; }
.btn-warning { background: #f59e0b; color: #fff; }
.btn-outline { background: transparent; border: 1.5px solid currentColor; }
.btn-outline:hover { background: rgba(0,0,0,.05); }

/* ============================================================
   BADGES
   ============================================================ */
.badge { display: inline-flex; align-items: center; padding: 3px 9px; border-radius: 20px; font-size: .72rem; font-weight: 700; }
.badge-success { background: #dcfce7; color: #15803d; }
.badge-danger  { background: #fee2e2; color: #b91c1c; }
.badge-warning { background: #fef3c7; color: #b45309; }
.badge-info    { background: #dbeafe; color: #1d4ed8; }
.badge-muted   { background: rgba(100,116,139,.12); color: #64748b; }
.badge-violet  { background: #ede9fe; color: #6d28d9; }
.theme-admin .badge-success { background: rgba(34,197,94,.15); color: #86efac; }
.theme-admin .badge-danger  { background: rgba(239,68,68,.15);  color: #fca5a5; }
.theme-admin .badge-warning { background: rgba(245,158,11,.15); color: #fcd34d; }
.theme-admin .badge-info    { background: rgba(59,130,246,.15); color: #93c5fd; }

/* ============================================================
   MODALS
   ============================================================ */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,.5); z-index: 200;
  display: none; align-items: center; justify-content: center; padding: 20px;
  backdrop-filter: blur(4px);
}
.modal-overlay.show { display: flex; }
.modal {
  width: 100%; max-width: 600px; max-height: 90vh; overflow-y: auto;
  border-radius: var(--radius-lg); padding: 28px; position: relative;
  animation: modalIn .2s ease;
}
.modal-lg { max-width: 860px; }
.theme-admin .modal { background: var(--admin-surface); border: 1px solid var(--admin-border); }
.theme-client .modal { background: #fff; }
.theme-employee .modal { background: #fff; }
@keyframes modalIn { from { opacity: 0; transform: scale(.95) translateY(-10px); } to { opacity: 1; transform: none; } }
.modal-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 20px; }
.modal-title { font-size: 1.05rem; font-weight: 700; }
.modal-close { background: none; border: none; font-size: 1.4rem; cursor: pointer; opacity: .5; transition: var(--transition); line-height: 1; padding: 4px; }
.modal-close:hover { opacity: 1; }
.modal-footer { display: flex; justify-content: flex-end; gap: 10px; margin-top: 24px; padding-top: 16px; border-top: 1px solid rgba(0,0,0,.06); }
.theme-admin .modal-footer { border-color: var(--admin-border); }

/* ============================================================
   FLASH MESSAGES
   ============================================================ */
.flash {
  display: flex; align-items: center; gap: 10px; padding: 12px 18px;
  border-radius: var(--radius); font-size: .875rem; font-weight: 500; margin-bottom: 20px;
}
.flash-success { background: #dcfce7; color: #15803d; border: 1px solid #bbf7d0; }
.flash-error   { background: #fee2e2; color: #b91c1c; border: 1px solid #fecaca; }
.flash-warning { background: #fef3c7; color: #b45309; border: 1px solid #fde68a; }
.flash-info    { background: #dbeafe; color: #1d4ed8; border: 1px solid #bfdbfe; }
.flash-icon { font-size: 1rem; }

/* ============================================================
   LOGIN PAGE
   ============================================================ */
.login-page {
  min-height: 100vh; display: grid; place-items: center;
  background: linear-gradient(135deg, #0f0f16 0%, #1a1030 50%, #0f1a30 100%);
}
.login-box {
  background: #16161f; border: 1px solid #2a2a3a; border-radius: 20px;
  padding: 44px 40px; width: 100%; max-width: 420px; box-shadow: 0 24px 60px rgba(0,0,0,.5);
}
.login-logo { text-align: center; margin-bottom: 32px; }
.login-logo .brand { font-size: 1.8rem; font-weight: 800; color: #a78bfa; letter-spacing: -.5px; }
.login-logo .tagline { font-size: .8rem; color: #64748b; margin-top: 4px; }
.login-box .form-label { color: #94a3b8; }
.login-box .form-control { background: #0f0f16; border-color: #2a2a3a; color: #e2e8f0; padding: 12px 14px; }
.login-box .form-control:focus { border-color: #7c3aed; box-shadow: 0 0 0 3px rgba(124,58,237,.2); }
.login-btn { width: 100%; padding: 13px; font-size: .95rem; background: linear-gradient(135deg, #7c3aed, #6d28d9); color: #fff; border: none; border-radius: 10px; font-weight: 700; cursor: pointer; transition: var(--transition); margin-top: 8px; }
.login-btn:hover { transform: translateY(-1px); box-shadow: 0 8px 20px rgba(124,58,237,.4); }

/* ============================================================
   ATTENDANCE CALENDAR
   ============================================================ */
.att-calendar { display: grid; grid-template-columns: repeat(7,1fr); gap: 3px; }
.att-day-header { text-align: center; font-size: .7rem; font-weight: 700; opacity: .5; padding: 6px 0; text-transform: uppercase; }
.att-day {
  aspect-ratio: 1; border-radius: 8px; display: flex; flex-direction: column; align-items: center;
  justify-content: center; font-size: .75rem; font-weight: 600; cursor: pointer; transition: var(--transition);
  position: relative;
}
.att-day:hover { transform: scale(1.05); z-index: 1; }
.att-day.empty { cursor: default; }
.att-day.today { outline: 2px solid; outline-offset: 2px; }
.theme-admin .att-day.today { outline-color: var(--admin-accent); }
.theme-client .att-day.today { outline-color: var(--client-accent); }
.att-day .day-num { font-size: .7rem; font-weight: 700; }
.att-day .day-cat { font-size: .55rem; margin-top: 1px; opacity: .85; text-align: center; line-height: 1.1; }
.att-day.type-present { background: rgba(34,197,94,.15); color: #22c55e; }
.att-day.type-leave   { background: rgba(239,68,68,.15); color: #ef4444; }
.att-day.type-half_day{ background: rgba(245,158,11,.15); color: #f59e0b; }
.att-day.unmarked     { background: rgba(100,116,139,.06); }
.theme-admin .att-day.unmarked { background: rgba(255,255,255,.03); }

/* ============================================================
   DSC STATUS INDICATORS
   ============================================================ */
.dsc-expiry-bar { height: 4px; border-radius: 2px; background: #e2e8f0; margin-top: 6px; overflow: hidden; }
.dsc-expiry-fill { height: 100%; border-radius: 2px; transition: width .3s ease; }
.dsc-valid    .dsc-expiry-fill { background: #22c55e; }
.dsc-expiring .dsc-expiry-fill { background: #f59e0b; }
.dsc-expired  .dsc-expiry-fill { background: #ef4444; }

/* ============================================================
   SEARCH BAR
   ============================================================ */
.search-bar { position: relative; }
.search-bar input { padding-left: 36px; }
.search-bar .search-icon { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); opacity: .4; }

/* ============================================================
   TABS
   ============================================================ */
.tabs { display: flex; gap: 4px; border-bottom: 2px solid rgba(0,0,0,.06); margin-bottom: 20px; }
.theme-admin .tabs { border-color: var(--admin-border); }
.tab-btn { padding: 10px 18px; font-size: .85rem; font-weight: 600; background: none; border: none; cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -2px; transition: var(--transition); }
.theme-admin  .tab-btn { color: var(--admin-muted); }
.theme-client .tab-btn { color: var(--client-muted); }
.tab-btn.active { color: inherit; }
.theme-admin  .tab-btn.active { color: var(--admin-accent2); border-color: var(--admin-accent); }
.theme-client .tab-btn.active { color: var(--client-accent); border-color: var(--client-accent); }
.theme-employee .tab-btn.active { color: var(--emp-accent); border-color: var(--emp-accent); }

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 768px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); }
  .main-content { margin-left: 0; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .form-grid { grid-template-columns: 1fr; }
  .page-content { padding: 16px; }
}

/* ============================================================
   UTILITIES
   ============================================================ */
.d-flex { display: flex; }
.align-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-8  { gap: 8px; }
.gap-12 { gap: 12px; }
.gap-16 { gap: 16px; }
.mb-8   { margin-bottom: 8px; }
.mb-16  { margin-bottom: 16px; }
.mb-24  { margin-bottom: 24px; }
.mt-16  { margin-top: 16px; }
.text-muted { opacity: .55; font-size: .85rem; }
.text-sm    { font-size: .8rem; }
.fw-700     { font-weight: 700; }
.text-right { text-align: right; }
.w-full     { width: 100%; }
.truncate   { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.actions-col { display: flex; gap: 6px; }

/* Dropdown */
.dropdown { position: relative; display: inline-block; }
.dropdown-menu {
  position: absolute; right: 0; top: calc(100% + 6px); min-width: 180px;
  border-radius: var(--radius); box-shadow: var(--shadow-lg); z-index: 300;
  display: none; overflow: hidden;
}
.dropdown-menu.show { display: block; }
.theme-admin  .dropdown-menu { background: var(--admin-surface); border: 1px solid var(--admin-border); }
.theme-client .dropdown-menu { background: #fff; border: 1px solid var(--client-border); }
.dropdown-item { display: block; padding: 9px 16px; font-size: .85rem; font-weight: 500; transition: var(--transition); }
.theme-admin  .dropdown-item { color: var(--admin-text); }
.theme-admin  .dropdown-item:hover { background: rgba(124,58,237,.12); }
.theme-client .dropdown-item { color: var(--client-text); }
.theme-client .dropdown-item:hover { background: #f8faff; }
.dropdown-item.danger { color: #ef4444 !important; }

/* Loading spinner */
.spinner { width: 20px; height: 20px; border: 2px solid rgba(255,255,255,.2); border-top-color: #fff; border-radius: 50%; animation: spin .6s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* Empty state */
.empty-state { text-align: center; padding: 60px 20px; opacity: .5; }
.empty-state i { font-size: 3rem; margin-bottom: 12px; display: block; }
.empty-state p { font-size: .9rem; }

/* Toggle switch */
.toggle { position: relative; display: inline-block; width: 40px; height: 22px; }
.toggle input { opacity: 0; width: 0; height: 0; }
.toggle-slider { position: absolute; inset: 0; background: #cbd5e1; border-radius: 11px; cursor: pointer; transition: var(--transition); }
.toggle-slider::before { content: ''; position: absolute; width: 16px; height: 16px; left: 3px; top: 3px; background: #fff; border-radius: 50%; transition: var(--transition); }
.toggle input:checked + .toggle-slider { background: #22c55e; }
.toggle input:checked + .toggle-slider::before { transform: translateX(18px); }
