/* =========================================================
   HRMS Pro Enterprise - Modern Glassmorphism & Vibrant UI
   ========================================================= */

@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@300;400;500;600;700;800&display=swap');

:root {
  --primary: #4f46e5;
  --primary-hover: #4338ca;
  --primary-gradient: linear-gradient(135deg, #4f46e5 0%, #6366f1 100%);
  --primary-light: #eef2ff;
  --primary-border: #c7d2fe;
  
  --secondary: #0ea5e9;
  --secondary-light: #f0f9ff;
  
  --success: #10b981;
  --success-light: #ecfdf5;
  --success-border: #a7f3d0;
  
  --warning: #f59e0b;
  --warning-light: #fffbeb;
  --warning-border: #fde68a;
  
  --danger: #ef4444;
  --danger-light: #fef2f2;
  --danger-border: #fecaca;
  
  --info: #3b82f6;
  --info-light: #eff6ff;
  
  --dark: #0f172a;
  --dark-surface: #1e293b;
  --dark-border: #334155;
  
  --bg-main: #f8fafc;
  --card-bg: #ffffff;
  --text-main: #0f172a;
  --text-secondary: #334155;
  --text-muted: #64748b;
  --border-color: #e2e8f0;
  
  --sidebar-width: 260px;
  --sidebar-bg: #0b1329;
  --sidebar-card: #152243;
  --sidebar-hover: rgba(255, 255, 255, 0.07);
  --sidebar-active: #4f46e5;
  
  --radius-sm: 8px;
  --radius: 14px;
  --radius-lg: 18px;
  --radius-full: 9999px;
  
  --shadow-xs: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow-sm: 0 2px 4px 0 rgba(0, 0, 0, 0.04), 0 1px 2px 0 rgba(0, 0, 0, 0.02);
  --shadow: 0 4px 12px -2px rgba(0, 0, 0, 0.06), 0 2px 6px -1px rgba(0, 0, 0, 0.03);
  --shadow-lg: 0 12px 24px -4px rgba(0, 0, 0, 0.08), 0 4px 8px -2px rgba(0, 0, 0, 0.04);
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
}

body {
  background-color: var(--bg-main);
  color: var(--text-main);
  min-height: 100vh;
  display: flex;
  overflow-x: hidden;
}

a {
  text-decoration: none;
  color: inherit;
}

/* Scrollbars */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: var(--radius-full);
}
::-webkit-scrollbar-thumb:hover {
  background: #94a3b8;
}

/* Layout */
.app-wrapper {
  display: flex;
  width: 100%;
  max-width: 100vw;
  min-height: 100vh;
  overflow-x: hidden;
}

/* Sidebar */
.sidebar {
  width: var(--sidebar-width);
  background: #0f172a;
  color: #f1f5f9;
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  bottom: 0;
  left: 0;
  z-index: 100;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  border-right: 1px solid rgba(255, 255, 255, 0.08);
}

.sidebar-brand {
  padding: 20px 18px;
  display: flex;
  align-items: center;
  gap: 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  transition: opacity 0.2s ease;
}

.sidebar-brand:hover {
  opacity: 0.95;
}

.brand-icon {
  width: 40px;
  height: 40px;
  border-radius: 11px;
  background: var(--primary-gradient);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #ffffff;
  font-size: 19px;
  box-shadow: 0 4px 12px rgba(79, 70, 229, 0.4);
  flex-shrink: 0;
}

.brand-text h2 {
  font-size: 16.5px;
  font-weight: 800;
  letter-spacing: -0.2px;
  color: #ffffff;
  margin: 0;
}

.brand-text span {
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: 1.1px;
  color: #818cf8;
  font-weight: 700;
  display: block;
}

.sidebar-menu {
  flex: 1;
  padding: 14px 12px;
  overflow-y: auto;
  list-style: none;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.12) transparent;
}

.sidebar-menu::-webkit-scrollbar {
  width: 4px;
}

.sidebar-menu::-webkit-scrollbar-track {
  background: transparent;
}

.sidebar-menu::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.12);
  border-radius: 4px;
}

.sidebar-menu::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.2);
}

.menu-category {
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: #64748b;
  font-weight: 800;
  padding: 14px 10px 4px;
}

.menu-item {
  margin-bottom: 3px;
}

.menu-link {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 9px 12px;
  color: #94a3b8;
  text-decoration: none;
  font-size: 13px;
  font-weight: 600;
  border-radius: 9px;
  transition: all 0.2s ease;
}

.menu-link:hover {
  background: rgba(255, 255, 255, 0.06);
  color: #ffffff;
  transform: translateX(3px);
}

.menu-link.active {
  background: var(--primary-gradient);
  color: #ffffff;
  font-weight: 700;
  box-shadow: 0 4px 14px rgba(79, 70, 229, 0.35);
}

.menu-link i {
  font-size: 17px;
  width: 20px;
  text-align: center;
}

.sidebar-user {
  padding: 12px 14px;
  margin: 10px 12px 14px;
  border-radius: 11px;
  display: flex;
  align-items: center;
  gap: 10px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.user-avatar {
  width: 38px;
  height: 38px;
  border-radius: 9px;
  background: linear-gradient(135deg, #6366f1 0%, #4f46e5 100%);
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 13.5px;
  box-shadow: 0 2px 8px rgba(79, 70, 229, 0.3);
  flex-shrink: 0;
}

.user-info {
  flex: 1;
  overflow: hidden;
}

.user-name {
  font-size: 13px;
  font-weight: 700;
  color: #f8fafc;
  white-space: nowrap;
  text-overflow: ellipsis;
  overflow: hidden;
}

.user-role-badge {
  display: inline-block;
  font-size: 9.5px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  padding: 2px 6px;
  border-radius: var(--radius-full);
  background: rgba(99, 102, 241, 0.25);
  color: #c7d2fe;
  margin-top: 2px;
}

/* Main Content Area */
.main-wrapper {
  flex: 1;
  margin-left: var(--sidebar-width);
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  min-width: 0;
  max-width: calc(100% - var(--sidebar-width));
  width: calc(100% - var(--sidebar-width));
  overflow-x: hidden;
}

.topbar {
  height: 68px;
  background: #ffffff;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 32px;
  position: sticky;
  top: 0;
  z-index: 90;
  box-shadow: var(--shadow-xs);
  min-width: 0;
  width: 100%;
}

.topbar-title h1 {
  font-size: 18px;
  font-weight: 800;
  color: var(--dark);
  letter-spacing: -0.3px;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 14px;
}

.content-body {
  flex: 1;
  padding: 28px 32px;
  background-color: var(--bg-main);
  min-width: 0;
  max-width: 100%;
}

/* Page Header Breadcrumb / Hero Component */
.page-header-card {
  background: #ffffff;
  border-radius: var(--radius);
  padding: 22px 28px;
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow-sm);
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 16px;
  margin-bottom: 24px;
}

.page-header-card h2 {
  font-size: 20px;
  font-weight: 800;
  color: var(--dark);
  letter-spacing: -0.3px;
  margin-bottom: 4px;
}

.page-header-card p {
  font-size: 13.5px;
  color: var(--text-muted);
}

.page-header-title {
  display: flex;
  align-items: center;
  gap: 14px;
}

.page-header-icon {
  width: 46px;
  height: 46px;
  border-radius: 12px;
  background: var(--primary-light);
  color: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
}

.page-header-text h1 {
  font-size: 20px;
  font-weight: 800;
  color: var(--dark);
  letter-spacing: -0.4px;
}

/* Modern Segmented Capsule Tabs */
.tabs-capsule-container {
  display: flex;
  align-items: center;
  gap: 6px;
  background: #e2e8f0;
  padding: 6px;
  border-radius: 14px;
  margin-bottom: 24px;
  width: 100%;
  max-width: 100%;
  overflow-x: auto;
  scrollbar-width: thin;
}

.tab-pill-btn {
  flex: 1 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 18px;
  border-radius: 10px;
  font-size: 13.5px;
  font-weight: 600;
  color: #475569;
  background: transparent;
  border: none;
  cursor: pointer;
  white-space: nowrap;
  text-decoration: none !important;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.tab-pill-btn:hover,
.tab-pill-btn:visited,
.tab-pill-btn:focus {
  color: var(--primary);
  background: rgba(255, 255, 255, 0.5);
  text-decoration: none !important;
}

.tab-pill-btn.active {
  background: #ffffff;
  color: var(--primary);
  font-weight: 700;
  text-decoration: none !important;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08);
}

.tab-pill-badge {
  background: #f1f5f9;
  color: #475569;
  padding: 2px 7px;
  border-radius: var(--radius-full);
  font-size: 11px;
  font-weight: 700;
}

.tab-pill-btn.active .tab-pill-badge {
  background: var(--primary-light);
  color: var(--primary);
}

.master-grid {
  display: grid;
  grid-template-columns: 320px minmax(0, 1fr);
  gap: 20px;
  align-items: start;
  min-width: 0;
  width: 100%;
}

@media (max-width: 1080px) {
  .master-grid {
    grid-template-columns: 1fr;
  }
}

/* Masters Side Navigation Layout */
.masters-layout-container {
  display: grid;
  grid-template-columns: 270px minmax(0, 1fr);
  gap: 24px;
  align-items: start;
  width: 100%;
}

@media (max-width: 1024px) {
  .masters-layout-container {
    grid-template-columns: 1fr;
  }
}

.master-side-nav {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.master-side-link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid transparent;
  background: transparent;
  text-align: left;
  cursor: pointer;
  width: 100%;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  color: var(--text-main);
  text-decoration: none;
}

.master-side-link:hover {
  background: #f8fafc;
  border-color: var(--border-color);
  transform: translateX(3px);
}

.master-side-link.active {
  background: #f0f4ff;
  border-color: #c7d2fe;
  box-shadow: 0 2px 8px rgba(79, 70, 229, 0.08);
}

.side-link-icon {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  flex-shrink: 0;
}

.side-link-text {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.side-link-text strong {
  font-size: 13.5px;
  font-weight: 700;
  color: #0f172a;
}

.master-side-link.active .side-link-text strong {
  color: #4f46e5;
}

.side-link-text small {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 1px;
}

.side-link-badge {
  background: #e2e8f0;
  color: #475569;
  font-size: 11px;
  font-weight: 800;
  padding: 2px 8px;
  border-radius: 20px;
  flex-shrink: 0;
}

.master-side-link.active .side-link-badge {
  background: #4f46e5;
  color: #ffffff;
}

/* Flash Alerts */
.alert {
  padding: 14px 18px;
  border-radius: var(--radius-sm);
  font-size: 13.5px;
  font-weight: 600;
  margin-bottom: 20px;
  display: flex;
  align-items: center;
  gap: 12px;
  box-shadow: var(--shadow-xs);
  animation: slideDown 0.3s ease;
}

@keyframes slideDown {
  from { opacity: 0; transform: translateY(-8px); }
  to { opacity: 1; transform: translateY(0); }
}

.alert-success {
  background: var(--success-light);
  color: #065f46;
  border: 1px solid var(--success-border);
}

.alert-error {
  background: var(--danger-light);
  color: #991b1b;
  border: 1px solid var(--danger-border);
}

/* Stat Cards */
.grid-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 20px;
  margin-bottom: 28px;
}

.stat-card {
  background: var(--card-bg);
  border-radius: var(--radius);
  padding: 22px;
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow-sm);
  display: flex;
  align-items: center;
  justify-content: space-between;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.stat-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow);
}

.stat-info h3 {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: var(--text-muted);
  margin-bottom: 6px;
}

.stat-info .stat-number {
  font-size: 26px;
  font-weight: 800;
  color: var(--dark);
  letter-spacing: -0.5px;
}

.stat-icon {
  width: 50px;
  height: 50px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
}

.stat-icon.primary { background: var(--primary-light); color: var(--primary); }
.stat-icon.success { background: var(--success-light); color: var(--success); }
.stat-icon.warning { background: var(--warning-light); color: var(--warning); }
.stat-icon.danger { background: var(--danger-light); color: var(--danger); }
.stat-icon.info { background: var(--info-light); color: var(--info); }

/* Card & Tables */
.card {
  background: var(--card-bg);
  border-radius: var(--radius);
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow-sm);
  margin-bottom: 24px;
  overflow: hidden;
}

.card-header {
  padding: 18px 24px;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #ffffff;
}

.card-header h2 {
  font-size: 15.5px;
  font-weight: 700;
  color: var(--dark);
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0;
}

.card-body {
  padding: 24px;
}

.table-responsive {
  width: 100%;
  max-width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
}

.data-table th {
  padding: 13px 20px;
  background: #f8fafc;
  font-size: 11.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border-color);
}

.data-table td {
  padding: 14px 20px;
  font-size: 13.5px;
  color: var(--text-main);
  border-bottom: 1px solid var(--border-color);
  vertical-align: middle;
}

.data-table tr:hover td {
  background-color: #fafbfc;
}

/* Badges */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  border-radius: var(--radius-full);
  font-size: 11.5px;
  font-weight: 700;
}

.badge-success { background: var(--success-light); color: #065f46; border: 1px solid var(--success-border); }
.badge-warning { background: var(--warning-light); color: #92400e; border: 1px solid var(--warning-border); }
.badge-danger { background: var(--danger-light); color: #991b1b; border: 1px solid var(--danger-border); }
.badge-primary { background: var(--primary-light); color: var(--primary); border: 1px solid var(--primary-border); }
.badge-info { background: var(--info-light); color: #1e40af; border: 1px solid #bfdbfe; }
.badge-dark { background: #f1f5f9; color: #334155; border: 1px solid #cbd5e1; }

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 9px 18px;
  border-radius: 9px;
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  border: 1px solid transparent;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.btn-primary {
  background: var(--primary-gradient);
  color: #ffffff;
  box-shadow: 0 2px 6px rgba(79, 70, 229, 0.25);
}
.btn-primary:hover {
  background: linear-gradient(135deg, #4338ca 0%, #4f46e5 100%);
  box-shadow: 0 4px 12px rgba(79, 70, 229, 0.35);
  transform: translateY(-1px);
}

.btn-secondary {
  background: #ffffff;
  color: var(--text-secondary);
  border-color: var(--border-color);
}
.btn-secondary:hover {
  background: #f8fafc;
  border-color: #cbd5e1;
  color: var(--dark);
}

.btn-success {
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
  color: #ffffff;
  box-shadow: 0 2px 6px rgba(16, 185, 129, 0.25);
}
.btn-success:hover {
  box-shadow: 0 4px 12px rgba(16, 185, 129, 0.35);
  transform: translateY(-1px);
}

.btn-danger {
  background: #ef4444;
  color: #ffffff;
  border-color: #dc2626;
}
.btn-danger:hover {
  background: #dc2626;
}

.btn-sm {
  padding: 5px 12px;
  font-size: 12px;
  border-radius: 7px;
}

/* Forms */
.form-group {
  margin-bottom: 16px;
}

.form-label {
  display: block;
  font-size: 12.5px;
  font-weight: 700;
  color: var(--text-secondary);
  margin-bottom: 6px;
}

.form-control {
  width: 100%;
  padding: 9px 13px;
  border: 1px solid var(--border-color);
  border-radius: 9px;
  font-size: 13.5px;
  color: var(--text-main);
  background-color: #ffffff;
  transition: border-color 0.2s, box-shadow 0.2s;
}

textarea.form-control {
  min-height: 72px;
  resize: vertical;
}

.form-control:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.15);
}

.form-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
}

/* Auth Page */
.auth-page {
  width: 100vw;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #0b1329 0%, #1e1b4b 50%, #2e1065 100%);
  padding: 24px;
}

.auth-card {
  width: 100%;
  max-width: 480px;
  background: rgba(255, 255, 255, 0.98);
  border-radius: 20px;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.4);
  padding: 40px;
  backdrop-filter: blur(12px);
}

.auth-header {
  text-align: center;
  margin-bottom: 30px;
}

.auth-header .brand-icon {
  margin: 0 auto 16px;
  width: 56px;
  height: 56px;
  font-size: 26px;
}

.role-switcher {
  background: #f8fafc;
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 16px;
  margin-top: 24px;
}

.role-switcher h4 {
  font-size: 11.5px;
  font-weight: 800;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 10px;
  letter-spacing: 0.5px;
}

.role-btn-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
}

.role-btn {
  background: #ffffff;
  border: 1px solid var(--border-color);
  padding: 8px 10px;
  border-radius: 8px;
  font-size: 11.5px;
  font-weight: 600;
  cursor: pointer;
  text-align: left;
  transition: all 0.2s ease;
}

.role-btn:hover {
  background: var(--primary-light);
  border-color: var(--primary);
  color: var(--primary);
}

/* Master KPI Switcher Cards */
.master-kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 24px;
}

@media (max-width: 1024px) {
  .master-kpi-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 640px) {
  .master-kpi-grid {
    grid-template-columns: 1fr;
  }
}

.master-kpi-card {
  background: #ffffff;
  border-radius: 14px;
  padding: 18px 20px;
  border: 2px solid transparent;
  box-shadow: var(--shadow-sm);
  cursor: pointer;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  display: flex;
  align-items: center;
  gap: 14px;
  position: relative;
  overflow: hidden;
}

.master-kpi-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow);
  border-color: var(--primary-border);
}

.master-kpi-card.active {
  background: #ffffff;
  border-color: var(--primary);
  box-shadow: 0 8px 20px -4px rgba(79, 70, 229, 0.15);
}

.master-kpi-card.active::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: var(--primary-gradient);
}

.master-kpi-icon {
  width: 46px;
  height: 46px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  flex-shrink: 0;
}

.master-kpi-info {
  flex: 1;
}

.master-kpi-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-muted);
  margin-bottom: 2px;
}

.master-kpi-count {
  font-size: 22px;
  font-weight: 800;
  color: var(--dark);
  letter-spacing: -0.5px;
}

.master-kpi-desc {
  font-size: 11px;
  color: var(--text-muted);
}

/* Master Guide Banner */
.guide-banner {
  background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
  border: 1px solid var(--border-color);
  border-left: 4px solid var(--primary);
  border-radius: 12px;
  padding: 14px 18px;
  margin-bottom: 20px;
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 13px;
  color: var(--text-secondary);
}

.guide-banner i {
  font-size: 20px;
  color: var(--primary);
  flex-shrink: 0;
}

/* Modal Dialog */
.modal-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(15, 23, 42, 0.65);
  backdrop-filter: blur(4px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  padding: 20px;
  animation: fadeIn 0.2s ease;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.modal-dialog {
  background: #ffffff;
  border-radius: 18px;
  width: 100%;
  max-width: 520px;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
  overflow: hidden;
  animation: modalPop 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes modalPop {
  from { opacity: 0; transform: scale(0.95) translateY(10px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}

.modal-header {
  padding: 18px 24px;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #ffffff;
}

.modal-header h3 {
  font-size: 16px;
  font-weight: 800;
  color: var(--dark);
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0;
}

.modal-close {
  background: transparent;
  border: none;
  font-size: 20px;
  color: var(--text-muted);
  cursor: pointer;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}

.modal-close:hover {
  background: #f1f5f9;
  color: var(--danger);
}

.modal-body {
  padding: 24px;
}

.modal-footer {
  padding: 16px 24px;
  border-top: 1px solid var(--border-color);
  background: #f8fafc;
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

/* ==========================================================================
   Attendance Monthly Matrix Grid Styling (Modern SaaS Pro Design)
   ========================================================================== */
.attendance-matrix-card {
  background: #ffffff;
  border-radius: 16px;
  border: 1px solid var(--border-color);
  box-shadow: 0 4px 20px -4px rgba(0, 0, 0, 0.05);
  overflow: hidden;
  width: 100%;
}

.attendance-matrix-wrapper {
  width: 100%;
  max-width: 100%;
  overflow-x: auto;
  overflow-y: auto;
  max-height: calc(100vh - 280px);
  min-height: 440px;
  -webkit-overflow-scrolling: touch;
}

.attendance-matrix-wrapper::-webkit-scrollbar {
  height: 9px;
  width: 8px;
}

.attendance-matrix-wrapper::-webkit-scrollbar-track {
  background: #f8fafc;
  border-radius: 8px;
}

.attendance-matrix-wrapper::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 8px;
  border: 2px solid #f8fafc;
}

.attendance-matrix-wrapper::-webkit-scrollbar-thumb:hover {
  background: #94a3b8;
}

.matrix-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 12px;
}

.matrix-table th,
.matrix-table td {
  padding: 8px 6px;
  vertical-align: middle;
  border-bottom: 1px solid #f1f5f9;
  border-right: 1px solid #f8fafc;
  white-space: nowrap;
}

.matrix-table th {
  background: #f8fafc;
  font-weight: 700;
  color: #334155;
  position: sticky;
  top: 0;
  z-index: 10;
  border-bottom: 2px solid #e2e8f0;
}

.matrix-table tbody tr:hover td {
  background-color: #f8fafc;
}

/* Sticky Left Columns */
.matrix-sticky-num {
  position: sticky;
  left: 0;
  background: #ffffff;
  z-index: 5;
  width: 44px;
  min-width: 44px;
  max-width: 44px;
  text-align: center;
  font-weight: 700;
  color: #64748b;
  border-right: 1px solid #e2e8f0 !important;
}

th.matrix-sticky-num {
  z-index: 20;
  background: #f8fafc;
  border-right: 1px solid #e2e8f0 !important;
}

.matrix-sticky-emp {
  position: sticky;
  left: 44px;
  background: #ffffff;
  z-index: 5;
  min-width: 220px;
  max-width: 240px;
  padding-left: 12px !important;
  padding-right: 14px !important;
  border-right: 2px solid #e2e8f0 !important;
  box-shadow: 4px 0 10px -2px rgba(15, 23, 42, 0.06);
}

th.matrix-sticky-emp {
  z-index: 20;
  background: #f8fafc;
  border-right: 2px solid #e2e8f0 !important;
  box-shadow: 4px 0 10px -2px rgba(15, 23, 42, 0.06);
}

/* Day Badges */
.matrix-day-cell {
  width: 32px;
  min-width: 32px;
  max-width: 36px;
  text-align: center;
  padding: 5px 2px !important;
}

.matrix-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border-radius: 6px;
  font-size: 10.5px;
  font-weight: 800;
  cursor: default;
  transition: transform 0.15s cubic-bezier(0.4, 0, 0.2, 1), box-shadow 0.15s ease;
}

.matrix-badge:hover {
  transform: translateY(-2px) scale(1.1);
  box-shadow: 0 4px 8px rgba(0,0,0,0.15);
}

.matrix-badge-p {
  background: #10b981;
  color: #ffffff;
}

.matrix-badge-l {
  background: #f59e0b;
  color: #ffffff;
}

.matrix-badge-hd {
  background: #8b5cf6;
  color: #ffffff;
}

.matrix-badge-lv {
  background: #0284c7;
  color: #ffffff;
}

.matrix-badge-a {
  background: #fee2e2;
  color: #dc2626;
  border: 1px solid #fca5a5;
}

.matrix-badge-upcoming {
  color: #cbd5e1;
  font-weight: 600;
  font-size: 12px;
}

/* Summary Header & Cells */
.matrix-summary-col {
  text-align: center;
  font-weight: 700;
  min-width: 52px;
  padding: 8px 8px !important;
}

.matrix-kpi-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 2px 8px;
  border-radius: 6px;
  font-weight: 800;
  font-size: 11.5px;
}

.matrix-payable-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: #0f172a;
  color: #ffffff;
  padding: 4px 10px;
  border-radius: 20px;
  font-weight: 800;
  font-size: 11px;
  letter-spacing: -0.2px;
}

.matrix-hours-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: rgba(14, 165, 233, 0.1);
  color: #0284c7;
  padding: 4px 8px;
  border-radius: 6px;
  font-family: monospace;
  font-weight: 800;
  font-size: 11px;
}

/* ==========================================================================
   Full Viewport 100% Screen Fit & Responsive Architecture
   ========================================================================== */
html, body {
  width: 100%;
  max-width: 100%;
  overflow-x: hidden;
}

.app-wrapper {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  overflow-x: hidden;
}

.main-wrapper {
  width: calc(100% - var(--sidebar-width));
  max-width: calc(100% - var(--sidebar-width));
  min-width: 0;
  overflow-x: hidden;
}

.content-body {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  overflow-x: hidden;
}

.table-responsive {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.card {
  width: 100%;
  max-width: 100%;
  min-width: 0;
}

.master-grid {
  display: grid;
  grid-template-columns: 320px minmax(0, 1fr);
  gap: 20px;
  align-items: start;
  width: 100%;
  max-width: 100%;
  min-width: 0;
}

@media (max-width: 1080px) {
  .master-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 768px) {
  :root {
    --sidebar-width: 0px;
  }
  .sidebar {
    transform: translateX(-100%);
    position: fixed;
    z-index: 999;
  }
  .sidebar.mobile-open {
    transform: translateX(0);
  }
  .main-wrapper {
    margin-left: 0;
    width: 100%;
    max-width: 100%;
  }
  .content-body {
    padding: 16px;
  }
  .topbar {
    padding: 0 16px;
  }
}

