/* Coats & Pack HRMS Suite - Hallmark & UI/UX Pro Max Executive Theme */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800;900&family=JetBrains+Mono:wght@400;500;600;700&display=swap');

:root {
  --primary-navy: #0f172a;
  --primary-slate: #1e293b;
  --accent-blue: #2563eb;
  --accent-indigo: #4f46e5;
  --accent-emerald: #059669;
  --accent-amber: #d97706;
  --accent-rose: #e11d48;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  letter-spacing: -0.012em;
  background-color: #f8fafc;
  color: #0f172a;
}

code, pre, .font-mono, td.time-cell, td.code-cell {
  font-family: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace !important;
  font-variant-numeric: tabular-nums;
}

/* Scrollbar polish */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
::-webkit-scrollbar-track {
  background: #f1f5f9;
}
::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 9999px;
}
::-webkit-scrollbar-thumb:hover {
  background: #94a3b8;
}

/* Top Action Bar - Solid Opaque Sticky Surface (Hides all scrolled rows) */
.glass-header {
  background: #ffffff !important;
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
  border-bottom: 1px solid #e2e8f0 !important;
  box-shadow: 0 1px 3px 0 rgba(15, 23, 42, 0.05) !important;
  z-index: 40 !important;
}

.glass-nav {
  background: #ffffff;
  border-bottom: 1px solid #e2e8f0;
}

/* Bento Grid Cards & Elevation */
.modern-card {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 0.75rem;
  box-shadow: 0 1px 2px 0 rgba(15, 23, 42, 0.04);
  transition: all 0.18s cubic-bezier(0.16, 1, 0.3, 1);
}
.modern-card:hover {
  border-color: #cbd5e1;
  box-shadow: 0 6px 16px -4px rgba(15, 23, 42, 0.07);
}

/* Executive Clean Light Sidebar */
#mainSidebar {
  background: #ffffff;
  border-right: 1px solid #e2e8f0;
}

.sidebar-nav .tab-btn {
  color: #475569;
  border-radius: 0.5rem;
  padding: 0.625rem 0.875rem;
  font-size: 0.8125rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  width: 100%;
  transition: all 0.15s ease;
  border: 1px solid transparent;
  text-align: left;
}

.sidebar-nav .tab-btn:hover {
  color: #0f172a;
  background-color: #f1f5f9;
}

.sidebar-nav .tab-btn.active {
  color: #ffffff !important;
  background: #4f46e5 !important; /* Premium Executive Indigo */
  font-weight: 700 !important;
  box-shadow: 0 4px 12px -2px rgba(79, 70, 229, 0.35) !important;
  border-color: #4f46e5 !important;
}

.sidebar-nav .tab-btn.active i {
  color: #ffffff !important;
}

.sidebar-nav .tab-btn.active span {
  color: #ffffff !important;
}

/* Animations */
@keyframes fadeInSlide {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}

.tab-content:not(.hidden) {
  animation: fadeInSlide 0.2s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

/* Button micro-interactions */
button {
  transition: all 0.15s ease;
}
button:active {
  transform: scale(0.98);
}

/* Hallmark & UI/UX Pro Max Status Badges */
.badge-emerald {
  background-color: #ecfdf5;
  color: #047857;
  border: 1px solid #a7f3d0;
}
.badge-rose {
  background-color: #fff1f2;
  color: #be123c;
  border: 1px solid #fecdd3;
}
.badge-amber {
  background-color: #fffbeb;
  color: #b45309;
  border: 1px solid #fde68a;
}
.badge-sky {
  background-color: #f0f9ff;
  color: #0369a1;
  border: 1px solid #bae6fd;
}
.badge-slate {
  background-color: #f8fafc;
  color: #334155;
  border: 1px solid #e2e8f0;
}

/* Data Table Typography & Sticky Headers */
table th {
  letter-spacing: 0.03em;
  font-weight: 700;
}

.overflow-x-auto {
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
}

/* Light Card & Input Focus States */
input:focus, select:focus, textarea:focus {
  border-color: #6366f1 !important;
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.15) !important;
}

/* Responsive Mobile Sidebar Behavior */
@media (max-width: 1023px) {
  #mainSidebar {
    position: fixed;
    top: 0;
    bottom: 0;
    left: 0;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.15), 0 8px 10px -6px rgba(0, 0, 0, 0.1);
  }
}

tbody tr {
  transition: background-color 0.12s ease;
}
tbody tr:hover td {
  background-color: #f8fafc !important;
}

/* Print Stylesheet */
@media print {
  body * {
    visibility: hidden;
  }
  #payslipModal, #payslipModal * {
    visibility: visible;
  }
  #payslipModal {
    position: absolute;
    left: 0;
    top: 0;
    width: 100%;
    height: auto;
    background: white;
    padding: 0;
    box-shadow: none;
    border: none;
  }
  .no-print {
    display: none !important;
  }
}

/* Modern Floating Toast System */
@keyframes toastSlideIn {
  0% {
    opacity: 0;
    transform: translateY(-16px) scale(0.96);
  }
  100% {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.toast-item {
  animation: toastSlideIn 0.22s cubic-bezier(0.16, 1, 0.3, 1) forwards;
  pointer-events: auto;
  min-width: 280px;
}

/* Sticky Attendance Table Container & Header */
.sticky-att-table-wrapper {
  overflow-x: auto !important;
  overflow-y: visible !important;
  max-height: none !important;
  min-height: auto !important;
  position: relative;
}

.sticky-att-table-wrapper table thead th {
  position: sticky;
  top: 0;
  z-index: 20;
  background-color: #f8fafc;
  border-bottom: 2px solid #e2e8f0;
  box-shadow: 0 1px 3px 0 rgba(15, 23, 42, 0.05);
}

/* Dedicated Full-Screen Enterprise Login */
#loginOverlay {
  position: fixed !important;
  inset: 0 !important;
  width: 100vw !important;
  height: 100vh !important;
  z-index: 99999 !important;
  background: radial-gradient(circle at 50% 25%, #1e1b4b 0%, #0f172a 55%, #020617 100%) !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
}

#loginOverlay.hidden {
  display: none !important;
}

#appWorkspace.hidden {
  display: none !important;
}

/* Glassmorphism for Login Card */
.login-glass-card {
  background: rgba(255, 255, 255, 0.98);
  box-shadow: 0 25px 50px -12px rgba(15, 23, 42, 0.45), 0 0 0 1px rgba(255, 255, 255, 0.3);
}

.login-bg-glow {
  position: absolute;
  border-radius: 50%;
  filter: blur(80px);
  opacity: 0.25;
  pointer-events: none;
}


/* Guaranteed Solid Sticky Table Headers across all tables & browsers */
/* Tables use separate border model so sticky th headers never glitch or leak borders */
#attTable,
#deptTable,
#missTable,
#empTable,
#payrollTable,
#indivAttTable,
#loanTable,
#essAttTable,
#essPermTable,
#logsTable,
#admUsersTable,
#admSessionsTable,
#ipWhitelistTable {
  border-collapse: separate !important;
  border-spacing: 0 !important;
}

#attTable thead,
#deptTable thead,
#missTable thead,
#empTable thead,
#payrollTable thead,
#indivAttTable thead,
#loanTable thead,
#essAttTable thead,
#essPermTable thead,
#logsTable thead,
#admUsersTable thead,
#admSessionsTable thead,
#ipWhitelistTable thead {
  position: sticky !important;
  top: 57px !important;
  z-index: 25 !important;
}

/* Individual th cells stick directly below the 57px top navbar when user scrolls page down */
#attTable thead th,
.sticky-att-table-wrapper table thead th,
#deptTable thead th,
#missTable thead th,
#empTable thead th,
#payrollTable thead th,
#indivAttTable thead th,
#loanTable thead th,
#essAttTable thead th,
#essPermTable thead th,
#logsTable thead th,
#admUsersTable thead th,
#admSessionsTable thead th,
#ipWhitelistTable thead th {
  position: sticky !important;
  top: 57px !important;
  z-index: 25 !important;
  background-color: #f1f5f9 !important;
  background: #f1f5f9 !important;
  opacity: 1 !important;
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
  border-bottom: 2px solid #cbd5e1 !important;
  box-shadow: 0 2px 4px 0 rgba(15, 23, 42, 0.08) !important;
}

/* Sleek Action Dropdown Menu */
.action-dropdown-menu {
  min-width: 190px;
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 0.75rem;
  box-shadow: 0 10px 25px -5px rgba(15, 23, 42, 0.18), 0 8px 10px -6px rgba(15, 23, 42, 0.1);
  padding: 0.375rem;
  z-index: 50;
  animation: fadeInSlide 0.15s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

td:has(.action-dropdown-menu:not(.hidden)) {
  z-index: 40 !important;
  position: relative;
}

/* ==========================================================================
   ESS Employee Self-Service Layout Isolation (Strict No Sidebar for Staff)
   ========================================================================== */
body.ess-mode #mainSidebar {
  display: none !important;
}
body.ess-mode #btnSidebarToggle {
  display: none !important;
}
body.ess-mode #adminBreadcrumb {
  display: none !important;
}
body.ess-mode #essHeaderBrand {
  display: flex !important;
}
body.ess-mode .admin-header-action {
  display: none !important;
}
body.ess-mode #essUserPill {
  display: flex !important;
}
body.ess-mode main {
  max-width: 1400px;
  margin-left: auto;
  margin-right: auto;
}

.action-dropdown-item {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  width: 100%;
  padding: 0.5rem 0.75rem;
  border-radius: 0.5rem;
  font-size: 0.75rem;
  font-weight: 600;
  color: #334155;
  transition: all 0.15s ease;
  text-align: left;
}

.action-dropdown-item:hover {
  background-color: #f1f5f9;
  color: #0f172a;
}

.action-dropdown-item.danger {
  color: #e11d48;
}

.action-dropdown-item.danger:hover {
  background-color: #fff1f2;
  color: #be123c;
}

/* Select2 Searchable Dropdown Styling */
.custom-select2-container {
  position: relative;
  width: 100%;
}
.custom-select2-search {
  position: sticky;
  top: 0;
  z-index: 10;
  background: #ffffff;
  padding: 6px;
  border-bottom: 1px solid #e2e8f0;
}
.custom-select2-dropdown {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  max-height: 240px;
  overflow-y: auto;
  background: #ffffff;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  box-shadow: 0 10px 25px -5px rgba(15, 23, 42, 0.15);
  z-index: 50;
}
.custom-select2-option {
  padding: 8px 12px;
  cursor: pointer;
  font-size: 12px;
  transition: background-color 0.15s ease;
}
.custom-select2-option:hover, .custom-select2-option.active {
  background-color: #e0e7ff;
  color: #3730a3;
  font-weight: 600;
}

/* Adjustment History Popover */
.adj-history-popover {
  position: fixed;
  z-index: 70;
  background: #ffffff;
  border: 1px solid #cbd5e1;
  border-radius: 12px;
  box-shadow: 0 20px 25px -5px rgba(15, 23, 42, 0.2), 0 8px 10px -6px rgba(15, 23, 42, 0.1);
  min-width: 320px;
  max-width: 380px;
  padding: 12px;
}
