/* ============================================================
   Vinsfertility HR Panel — Custom Theme
   Built on Bootstrap 5.3 with refined brand identity
   ============================================================ */

:root {
  /* Brand palette - teal-green */
  --brand-50:  #ecfdf5;
  --brand-100: #d1fae5;
  --brand-200: #a7f3d0;
  --brand-300: #6ee7b7;
  --brand-400: #34d399;
  --brand-500: #0e9384;
  --brand-600: #0a7c6e;
  --brand-700: #065a50;
  --brand-800: #044038;
  --brand-900: #022c26;

  --accent-500: #e85d26;
  --accent-600: #c14817;

  /* Bootstrap overrides */
  --bs-primary: var(--brand-700);
  --bs-primary-rgb: 6, 90, 80;
  --bs-link-color: var(--brand-700);
  --bs-link-hover-color: var(--brand-800);
  --bs-border-color: #e8ecef;
  --bs-border-radius: 0.625rem;
  --bs-border-radius-sm: 0.4rem;
  --bs-border-radius-lg: 0.875rem;
  --bs-border-radius-xl: 1rem;
  --bs-body-bg: #f5f7fa;
  --bs-body-color: #1e293b;
  --bs-body-font-family: 'Plus Jakarta Sans', system-ui, -apple-system, sans-serif;
  --bs-body-font-size: 0.9375rem;
  --bs-body-line-height: 1.55;

  /* Custom shadows */
  --shadow-xs: 0 1px 2px rgba(15, 23, 42, 0.04);
  --shadow-sm: 0 1px 3px rgba(15, 23, 42, 0.06), 0 1px 2px rgba(15, 23, 42, 0.04);
  --shadow-md: 0 4px 12px rgba(15, 23, 42, 0.06), 0 2px 4px rgba(15, 23, 42, 0.04);
  --shadow-lg: 0 12px 32px rgba(15, 23, 42, 0.08), 0 4px 8px rgba(15, 23, 42, 0.04);
  --shadow-brand: 0 8px 24px rgba(6, 90, 80, 0.18);

  --sidebar-width: 260px;
  --topbar-height: 64px;
}

/* ===== Typography ===== */

body {
  font-family: var(--bs-body-font-family);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  background: var(--bs-body-bg);
  color: var(--bs-body-color);
  letter-spacing: -0.005em;
}

h1, h2, h3, h4, h5, h6, .display-font {
  font-family: 'Bricolage Grotesque', 'Plus Jakarta Sans', system-ui, sans-serif;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: #0f172a;
}

.text-muted-2 { color: #64748b !important; }
.text-strong { color: #0f172a; font-weight: 600; }
.text-uppercase-tiny {
  text-transform: uppercase;
  font-size: 0.6875rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  color: #94a3b8;
}

.fw-display { font-family: 'Bricolage Grotesque', sans-serif; font-weight: 700; letter-spacing: -0.02em; }

/* ===== Bootstrap Component Refinements ===== */

.btn { font-weight: 600; letter-spacing: -0.005em; transition: all .15s ease; border-radius: 0.5rem; }
.btn-primary {
  background: var(--brand-700);
  border-color: var(--brand-700);
  box-shadow: var(--shadow-xs);
}
.btn-primary:hover, .btn-primary:focus {
  background: var(--brand-800);
  border-color: var(--brand-800);
  box-shadow: var(--shadow-brand);
}
.btn-outline-primary { color: var(--brand-700); border-color: var(--brand-200); }
.btn-outline-primary:hover { background: var(--brand-700); border-color: var(--brand-700); }

.btn-accent {
  background: var(--accent-500); border-color: var(--accent-500); color: white;
}
.btn-accent:hover { background: var(--accent-600); border-color: var(--accent-600); color: white; }

.btn-soft {
  background: #f1f5f9; color: #475569; border: 1px solid transparent;
}
.btn-soft:hover { background: #e2e8f0; color: #1e293b; }

.btn-sm { padding: 0.4rem 0.85rem; font-size: 0.8125rem; }
.btn-lg { padding: 0.75rem 1.5rem; font-size: 1rem; }

/* Cards */
.card {
  border: 1px solid #e8ecef;
  border-radius: 0.875rem;
  box-shadow: var(--shadow-xs);
  background: white;
}
.card-header {
  background: white;
  border-bottom: 1px solid #f1f5f9;
  padding: 1rem 1.25rem;
  font-weight: 600;
}
.card-body { padding: 1.25rem; }
.card.card-flat { box-shadow: none; }

/* Form inputs */
.form-control, .form-select {
  border: 1px solid #d1d9e0;
  border-radius: 0.5rem;
  padding: 0.55rem 0.875rem;
  font-size: 0.9rem;
  transition: border-color .15s ease, box-shadow .15s ease;
}
.form-control:focus, .form-select:focus {
  border-color: var(--brand-500);
  box-shadow: 0 0 0 3px rgba(14, 147, 132, 0.12);
}
.form-label { font-size: 0.75rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em; color: #475569; margin-bottom: 0.4rem; }
.form-text { font-size: 0.75rem; color: #94a3b8; }

/* Tables */
.table { font-size: 0.875rem; margin-bottom: 0; }
.table > thead > tr > th {
  background: #f8fafc;
  border-bottom: 1px solid #e8ecef;
  padding: 0.75rem 1rem;
  font-size: 0.6875rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #64748b;
}
.table > tbody > tr > td {
  padding: 0.85rem 1rem;
  border-color: #f1f5f9;
  vertical-align: middle;
}
.table > tbody > tr:hover { background: #fafbfc; }
.table > tbody > tr:last-child > td { border-bottom: 0; }

/* Badges */
.badge { font-weight: 600; padding: 0.3em 0.65em; font-size: 0.7rem; letter-spacing: 0.01em; border-radius: 0.375rem; }
.badge.text-bg-success-soft { background: #d1fae5 !important; color: #047857 !important; }
.badge.text-bg-primary-soft { background: var(--brand-50) !important; color: var(--brand-700) !important; }
.badge.text-bg-warning-soft { background: #fef3c7 !important; color: #b45309 !important; }
.badge.text-bg-danger-soft { background: #fee2e2 !important; color: #b91c1c !important; }
.badge.text-bg-info-soft { background: #dbeafe !important; color: #1e40af !important; }
.badge.text-bg-secondary-soft { background: #f1f5f9 !important; color: #475569 !important; }

/* Alerts */
.alert { border-radius: 0.625rem; padding: 0.85rem 1rem; font-size: 0.875rem; border: 1px solid; }
.alert-success { background: #d1fae5; border-color: #a7f3d0; color: #065f46; }
.alert-danger { background: #fee2e2; border-color: #fecaca; color: #991b1b; }
.alert-warning { background: #fef3c7; border-color: #fde68a; color: #92400e; }
.alert-info { background: #dbeafe; border-color: #bfdbfe; color: #1e40af; }

/* Modal */
.modal-content { border: none; border-radius: 1rem; box-shadow: var(--shadow-lg); }
.modal-header { border-bottom: 1px solid #f1f5f9; padding: 1.25rem; }
.modal-body { padding: 1.25rem; }
.modal-footer { border-top: 1px solid #f1f5f9; padding: 1rem 1.25rem; }

/* Custom Alpine-controlled modal overlay (do NOT use Bootstrap's .modal class with x-show — it conflicts) */
.app-modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 1055;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(15, 23, 42, 0.5);
  padding: 1rem;
  overflow-y: auto;
}
.app-modal-overlay .modal-dialog {
  margin: 0;
  max-width: 500px;
  background: #f5f7fa!important;
  pointer-events: auto;
}
.app-modal-overlay .modal-dialog.modal-sm { max-width: 320px; }
.app-modal-overlay .modal-dialog.modal-lg { max-width: 800px; }
.app-modal-overlay .modal-dialog.modal-xl { max-width: 1140px; }

/* Dropdowns */
.dropdown-menu { border: 1px solid #e8ecef; border-radius: 0.625rem; box-shadow: var(--shadow-md); padding: 0.4rem; font-size: 0.875rem; }
.dropdown-item { border-radius: 0.4rem; padding: 0.5rem 0.75rem; }
.dropdown-item:hover { background: var(--brand-50); color: var(--brand-700); }

/* ============================================================
   App Shell — Sidebar + Topbar + Content
   ============================================================ */

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

/* Sidebar */
.app-sidebar {
  width: var(--sidebar-width);
  flex-shrink: 0;
  background: white;
  border-right: 1px solid #e8ecef;
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  z-index: 1040;
  transition: transform 0.25s ease;
}

.app-sidebar-brand {
  padding: 1.1rem 1.25rem;
  border-bottom: 1px solid #f1f5f9;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  text-decoration: none;
}
.app-sidebar-brand .brand-icon {
  width: 38px; height: 38px;
  border-radius: 0.625rem;
  background: linear-gradient(135deg, var(--brand-700), var(--brand-900));
  display: flex; align-items: center; justify-content: center;
  color: white; font-size: 1.1rem;
  box-shadow: 0 4px 12px rgba(6, 90, 80, 0.25);
}
.app-sidebar-brand .brand-text { line-height: 1; }
.app-sidebar-brand .brand-name { font-family: 'Bricolage Grotesque', sans-serif; font-weight: 800; color: #0f172a; font-size: 1.0625rem; letter-spacing: -0.02em; }
.app-sidebar-brand .brand-sub { font-size: 0.65rem; color: #94a3b8; text-transform: uppercase; letter-spacing: 0.1em; margin-top: 3px; font-weight: 600; }

.app-sidebar-nav {
  flex: 1; overflow-y: auto;
  padding: 0.75rem 0.65rem;
}
.app-sidebar-nav::-webkit-scrollbar { width: 4px; }
.app-sidebar-nav::-webkit-scrollbar-thumb { background: #e2e8f0; border-radius: 2px; }

.app-nav-section {
  padding: 0.85rem 0.85rem 0.4rem;
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: #94a3b8;
}

.app-nav-link {
  display: flex; align-items: center;
  gap: 0.7rem;
  padding: 0.5rem 0.75rem;
  border-radius: 0.5rem;
  font-size: 0.875rem;
  font-weight: 500;
  color: #475569;
  text-decoration: none;
  margin-bottom: 1px;
  transition: all 0.12s ease;
}
.app-nav-link:hover { background: #f1f5f9; color: #0f172a; }
.app-nav-link.active { background: var(--brand-50); color: var(--brand-700); font-weight: 600; }
.app-nav-link.active i { color: var(--brand-600); }
.app-nav-link i { font-size: 1.05rem; color: #94a3b8; flex-shrink: 0; }
.app-nav-link .nav-badge {
  margin-left: auto;
  background: var(--accent-500);
  color: white;
  font-size: 0.65rem;
  font-weight: 700;
  padding: 0.1rem 0.45rem;
  border-radius: 999px;
  min-width: 1.25rem;
  text-align: center;
}

.app-sidebar-footer {
  border-top: 1px solid #f1f5f9;
  padding: 0.75rem;
}
.app-sidebar-user {
  display: flex; align-items: center; gap: 0.65rem;
  padding: 0.5rem;
  border-radius: 0.5rem;
  text-decoration: none;
  color: inherit;
  transition: background 0.12s ease;
}
.app-sidebar-user:hover { background: #f8fafc; }
.app-sidebar-user .avatar { flex-shrink: 0; }
.app-sidebar-user .user-info { min-width: 0; flex: 1; }
.app-sidebar-user .user-name { font-size: 0.825rem; font-weight: 600; color: #0f172a; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.app-sidebar-user .user-role { font-size: 0.7rem; color: #94a3b8; }

/* Main column */
.app-main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

/* Topbar */
.app-topbar {
  position: sticky;
  top: 0;
  z-index: 1020;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: saturate(180%) blur(12px);
  -webkit-backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid #e8ecef;
  padding: 0.75rem 1.25rem;
}
.app-topbar-row {
  display: flex; align-items: center; justify-content: space-between;
  gap: 1rem;
}
.app-topbar-title { line-height: 1.15; min-width: 0; flex: 1; }
.app-topbar-title h1 {
  font-family: 'Bricolage Grotesque', sans-serif;
  font-size: 1.3rem;
  font-weight: 700;
  color: #0f172a;
  margin: 0 0 2px;
  letter-spacing: -0.02em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.app-topbar-title .subtitle { font-size: 0.75rem; color: #94a3b8; }

@media (min-width: 992px) {
  .app-topbar { padding: 1rem 2rem; }
  .app-topbar-title h1 { font-size: 1.45rem; }
}

/* Content area */
.app-content {
  flex: 1;
  padding: 1.25rem;
  max-width: 1400px;
  width: 100%;
}
@media (min-width: 992px) { .app-content { padding: 1.75rem 2rem; } }

.app-footer {
  padding: 1rem 2rem 1.5rem;
  font-size: 0.7rem;
  color: #94a3b8;
  text-align: center;
}

/* Mobile sidebar */
.sidebar-toggle { display: none; }
.sidebar-backdrop {
  display: none;
  position: fixed; inset: 0;
  background: rgba(15, 23, 42, 0.5);
  z-index: 1039;
}

@media (max-width: 991.98px) {
  .app-sidebar {
    position: fixed;
    transform: translateX(-100%);
    box-shadow: var(--shadow-lg);
  }
  .app-sidebar.open { transform: translateX(0); }
  .sidebar-backdrop.show { display: block; }
  .sidebar-toggle { display: inline-flex; }
}

/* ============================================================
   Reusable Components
   ============================================================ */

/* Avatar */
.avatar {
  display: inline-flex; align-items: center; justify-content: center;
  width: 2.25rem; height: 2.25rem;
  border-radius: 50%;
  font-weight: 700; font-size: 0.75rem;
  color: white;
  flex-shrink: 0;
  text-transform: uppercase;
  letter-spacing: -0.02em;
}
.avatar-sm { width: 1.75rem; height: 1.75rem; font-size: 0.65rem; }
.avatar-lg { width: 3rem; height: 3rem; font-size: 0.95rem; }
.avatar-xl { width: 4rem; height: 4rem; font-size: 1.2rem; }

/* Stat Card */
.stat-card {
  background: white;
  border: 1px solid #e8ecef;
  border-radius: 0.875rem;
  padding: 1.1rem 1.25rem;
  position: relative;
  overflow: hidden;
  transition: transform .15s ease, box-shadow .15s ease;
}
.stat-card:hover { transform: translateY(-1px); box-shadow: var(--shadow-md); }
.stat-card .stat-label {
  font-size: 0.65rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.08em;
  color: #94a3b8; margin-bottom: 0.4rem;
}
.stat-card .stat-value {
  font-family: 'Bricolage Grotesque', sans-serif;
  font-weight: 700; font-size: 1.65rem; line-height: 1.1;
  color: #0f172a; letter-spacing: -0.02em;
}
.stat-card .stat-meta { font-size: 0.75rem; color: #64748b; margin-top: 0.4rem; }
.stat-card .stat-icon {
  position: absolute; top: 1rem; right: 1rem;
  width: 36px; height: 36px;
  border-radius: 0.5rem;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.05rem;
}

.stat-card.stat-brand .stat-icon { background: var(--brand-50); color: var(--brand-700); }
.stat-card.stat-success .stat-icon { background: #d1fae5; color: #047857; }
.stat-card.stat-warning .stat-icon { background: #fef3c7; color: #b45309; }
.stat-card.stat-danger .stat-icon { background: #fee2e2; color: #b91c1c; }
.stat-card.stat-info .stat-icon { background: #dbeafe; color: #1e40af; }
.stat-card.stat-accent .stat-icon { background: #ffedd5; color: var(--accent-600); }

/* Welcome banner (dashboard hero) */
.welcome-banner {
  background: linear-gradient(135deg, var(--brand-700) 0%, var(--brand-900) 100%);
  color: white;
  border-radius: 1rem;
  padding: 1.5rem 1.75rem;
  position: relative;
  overflow: hidden;
}
.welcome-banner::before, .welcome-banner::after {
  content: '';
  position: absolute;
  border-radius: 50%;
  filter: blur(40px);
}
.welcome-banner::before {
  width: 280px; height: 280px;
  background: rgba(14, 147, 132, 0.4);
  top: -100px; right: -60px;
}
.welcome-banner::after {
  width: 200px; height: 200px;
  background: rgba(232, 93, 38, 0.25);
  bottom: -80px; left: 35%;
}
.welcome-banner > * { position: relative; }
.welcome-banner .greeting { font-size: 0.85rem; color: rgba(255, 255, 255, 0.85); margin-bottom: 0.25rem; }
.welcome-banner h1 {
  font-family: 'Bricolage Grotesque', sans-serif;
  font-weight: 800;
  font-size: 1.65rem;
  letter-spacing: -0.02em;
  color: white;
  margin: 0 0 0.4rem;
}
@media (min-width: 992px) { .welcome-banner h1 { font-size: 2.1rem; } }
.welcome-banner .lead { font-size: 0.9rem; color: rgba(255, 255, 255, 0.85); }

.attendance-pill {
  display: inline-flex; align-items: center; gap: 0.85rem;
  padding: 0.5rem 1rem;
  background: rgba(255, 255, 255, 0.12);
  backdrop-filter: blur(10px);
  border-radius: 999px;
  font-size: 0.8rem;
  margin-top: 1rem;
}
.attendance-pill .dot {
  width: 7px; height: 7px; border-radius: 50%;
  display: inline-block;
}
.attendance-pill .dot.in { background: #6ee7b7; }
.attendance-pill .dot.out { background: #fdba74; }

/* Empty state */
.empty-state {
  text-align: center;
  padding: 3.5rem 1.5rem;
  color: #94a3b8;
}
.empty-state i {
  font-size: 2.5rem;
  color: #cbd5e1;
  margin-bottom: 0.75rem;
}
.empty-state h5 { color: #475569; margin-bottom: 0.4rem; }

/* Filter chip group */
.chip-group { display: inline-flex; flex-wrap: wrap; gap: 0.4rem; }
.chip {
  display: inline-flex; align-items: center; gap: 0.35rem;
  padding: 0.4rem 0.85rem;
  background: white;
  border: 1px solid #e8ecef;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
  color: #64748b;
  text-decoration: none;
  transition: all 0.12s ease;
}
.chip:hover { background: #f1f5f9; color: #1e293b; }
.chip.active { background: #0f172a; border-color: #0f172a; color: white; }

/* Page header (used inside content) */
.page-header {
  display: flex; align-items: flex-start; justify-content: space-between;
  flex-wrap: wrap; gap: 1rem;
  margin-bottom: 1.25rem;
}
.page-header h2 {
  font-family: 'Bricolage Grotesque', sans-serif;
  font-size: 1.15rem;
  font-weight: 700;
  margin: 0;
  color: #0f172a;
}
.page-header .meta { font-size: 0.8rem; color: #64748b; margin-top: 2px; }

/* Detail row */
.detail-row { display: flex; gap: 1rem; padding: 0.65rem 0; border-bottom: 1px solid #f1f5f9; }
.detail-row:last-child { border-bottom: 0; }
.detail-row .label { width: 40%; font-size: 0.75rem; text-transform: uppercase; font-weight: 600; letter-spacing: 0.04em; color: #94a3b8; }
.detail-row .value { flex: 1; font-size: 0.875rem; color: #1e293b; font-weight: 500; }

/* Progress (slim) */
.progress-slim { height: 6px; border-radius: 999px; background: #f1f5f9; overflow: hidden; }
.progress-slim > div { height: 100%; background: var(--brand-600); border-radius: 999px; transition: width 0.3s ease; }

/* Utility: line clamp */
.line-clamp-2 {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* Utility: card hover lift */
.lift { transition: transform .15s ease, box-shadow .15s ease; }
.lift:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }

/* ===== Auth pages ===== */
.auth-shell {
  min-height: 100vh;
  display: flex; align-items: center; justify-content: center;
  padding: 1rem;
  background: linear-gradient(135deg, #f0fdf4 0%, #f5f7fa 50%, #fff7ed 100%);
  position: relative;
  overflow: hidden;
}
.auth-shell::before, .auth-shell::after {
  content: ''; position: absolute; border-radius: 50%; filter: blur(80px); pointer-events: none;
}
.auth-shell::before { width: 500px; height: 500px; background: rgba(6, 90, 80, 0.15); top: -200px; right: -150px; }
.auth-shell::after { width: 400px; height: 400px; background: rgba(232, 93, 38, 0.15); bottom: -150px; left: -100px; }

.auth-card {
  width: 100%; max-width: 410px;
  position: relative;
  background: white;
  border-radius: 1.25rem;
  padding: 2.25rem;
  box-shadow: 0 20px 60px rgba(15, 23, 42, 0.12);
  border: 1px solid #f1f5f9;
}

/* Print payslip */
@media print {
  body { background: white; }
  .no-print { display: none !important; }
  .print-page { box-shadow: none !important; max-width: 100% !important; margin: 0 !important; padding: 0 !important; }
  @page { margin: 12mm; size: A4; }
}

/* ===== Misc ===== */
[x-cloak] { display: none !important; }
.cursor-pointer { cursor: pointer; }
.text-decoration-none-i { text-decoration: none !important; }
hr { border-color: #e8ecef; }
.fs-tiny { font-size: 0.7rem; }
.bg-soft { background: #f8fafc; }
