/* HRMS Premium Theme */
:root {
  --primary-color: #4f46e5;
  /* Indigo 600 */
  --primary-hover: #4338ca;
  /* Indigo 700 */
  --secondary-color: #64748b;
  /* Slate 500 */
  --success-color: #10b981;
  /* Emerald 500 */
  --warning-color: #f59e0b;
  /* Amber 500 */
  --danger-color: #ef4444;
  /* Red 500 */
  --bg-color: #f3f4f6;
  /* Gray 100 */
  --card-bg: #ffffff;
  --text-primary: #111827;
  /* Gray 900 */
  --text-secondary: #6b7280;
  /* Gray 500 */
  --border-color: #e5e7eb;
  /* Gray 200 */
  --sidebar-bg: #1e293b;
  /* Slate 800 */
  --sidebar-width: 260px;
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
  --table-header-bg: #f9fafb;
  --table-row-hover-bg: #f3f4f6;
  --bs-border-radius: 1rem;
}

[data-bs-theme="dark"] {
  --bg-color: #0f172a;
  /* Slate 900 */
  --card-bg: #1e293b;
  /* Slate 800 */
  --text-primary: #f8fafc;
  /* Slate 50 */
  --text-secondary: #cbd5e1;
  /* Slate 300 */
  --border-color: #334155;
  /* Slate 700 */
  --sidebar-bg: #020617;
  /* Slate 950 */
  --shadow-sm: 0 1px 2px 0 rgba(15, 23, 42, 0.8);
  --shadow-md: 0 4px 10px -2px rgba(15, 23, 42, 0.9);
  --shadow-lg: 0 18px 35px rgba(15, 23, 42, 0.95);
  --table-header-bg: #020617;
  --table-row-hover-bg: #1e293b;
}

body {
  font-family: 'Inter', sans-serif;
  background-color: var(--bg-color);
  color: var(--text-primary);
  line-height: 1.5;
}

h1,
h2,
h3,
h4,
h5,
h6 {
  font-weight: 600;
  color: var(--text-primary);
  letter-spacing: -0.025em;
}

a {
  text-decoration: none;
  color: var(--primary-color);
  /* transition removed to prevent flickering */
}

a:hover {
  color: var(--primary-hover);
}

/* Cards */
.card {
  background-color: var(--card-bg);
  border: none;
  border-radius: 1rem;
  box-shadow: var(--shadow-md);
  transition: transform 0.2s, box-shadow 0.2s;
}

.card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
}

.card-header {
  background-color: transparent;
  border-bottom: 1px solid var(--border-color);
  padding: 1.5rem;
}

.card-body {
  padding: 1.5rem;
}

/* Buttons */
.btn {
  font-weight: 500;
  padding: 0.5rem 1rem;
  border-radius: 0.5rem;
  transition: all 0.2s;
}

.btn-primary {
  background-color: var(--primary-color);
  border-color: var(--primary-color);
  box-shadow: 0 4px 6px -1px rgba(79, 70, 229, 0.2);
}

.btn-primary:hover {
  background-color: var(--primary-hover);
  border-color: var(--primary-hover);
  transform: translateY(-1px);
  box-shadow: 0 6px 8px -1px rgba(79, 70, 229, 0.3);
}

.btn-outline-primary {
  color: var(--primary-color);
  border-color: var(--primary-color);
}

.btn-outline-primary:hover {
  background-color: var(--primary-color);
  color: white;
}

.btn-outline-secondary {
  color: var(--secondary-color);
  border-color: var(--secondary-color);
}

.btn-outline-secondary:hover {
  background-color: var(--secondary-color);
  color: #ffffff;
}

.btn:disabled,
.btn.disabled {
  opacity: 0.6;
  box-shadow: none;
  transform: none;
  cursor: not-allowed;
}

/* Tables */
.table {
  margin-bottom: 0;
}

.table th {
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  font-size: 0.75rem;
  letter-spacing: 0.05em;
  background-color: var(--table-header-bg);
  border-bottom: 1px solid var(--border-color);
  padding: 0.75rem 1.5rem;
}

.table td {
  padding: 1rem 1.5rem;
  vertical-align: middle;
  border-bottom: 1px solid var(--border-color);
  color: var(--text-primary);
}

.table-hover tbody tr:hover {
  background-color: #f9fafb;
}

/* Badges */
.badge {
  font-weight: 500;
  padding: 0.35em 0.65em;
  border-radius: 0.375rem;
}

/* Forms */
.form-control,
.form-select {
  border-radius: 0.5rem;
  border-color: var(--border-color);
  padding: 0.625rem 0.875rem;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.form-control:focus,
.form-select:focus {
  border-color: var(--primary-color);
  box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}

.form-label {
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: 0.5rem;
}

/* Modals */
.modal-content {
  border: none;
  border-radius: 1rem;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
}

.modal-header {
  border-bottom: 1px solid var(--border-color);
  padding: 1.5rem;
}

.modal-footer {
  border-top: 1px solid var(--border-color);
  padding: 1.5rem;
}

.modal-backdrop.show {
  opacity: 0.5;
  backdrop-filter: blur(4px);
}

/* Utilities */
.text-muted {
  color: var(--text-secondary) !important;
}

.bg-light {
  background-color: #f9fafb !important;
}

/* Dark mode adjustments for legacy Bootstrap utility classes */
[data-bs-theme="dark"] .text-dark {
  color: var(--text-primary) !important;
}

[data-bs-theme="dark"] .bg-light {
  background-color: #111827 !important;
}

[data-bs-theme="dark"] .btn-light {
  background-color: #111827;
  color: var(--text-primary);
  border-color: var(--border-color);
}

[data-bs-theme="dark"] .btn-light:hover {
  background-color: #1f2937;
}

.shadow-sm {
  box-shadow: var(--shadow-sm) !important;
}

.shadow {
  box-shadow: var(--shadow-md) !important;
}

.shadow-lg {
  box-shadow: var(--shadow-lg) !important;
}

/* Sidebar */
.sidebar {
  width: var(--sidebar-width);
  height: 100vh;
  position: fixed;
  top: 0;
  left: 0;
  background-color: var(--sidebar-bg);
  color: white;
  padding-top: 1rem;
  z-index: 1000;
  transition: all 0.3s;
  overflow-y: auto;
  overflow-x: hidden;
}

/* Custom scrollbar for sidebar */
.sidebar::-webkit-scrollbar {
  width: 6px;
}

.sidebar::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.05);
}

.sidebar::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.2);
  border-radius: 10px;
}

.sidebar::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.3);
}

.sidebar-brand {
  padding: 1rem 1.5rem;
  font-size: 1.5rem;
  font-weight: 700;
  color: white;
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.sidebar-brand:hover {
  color: #e2e8f0;
}

.nav-link {
  color: #94a3b8;
  padding: 0.75rem 1.5rem;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  transition: all 0.2s;
}

.nav-link:hover,
.nav-link.active {
  color: white;
  background-color: rgba(255, 255, 255, 0.1);
  border-right: 3px solid var(--primary-color);
}

.nav-link i {
  font-size: 1.1rem;
}

.main-content {
  margin-left: var(--sidebar-width);
  padding: 2rem;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.card-bg-dynamic {
  background-color: var(--card-bg) !important;
  color: var(--text-primary);
}

/* Page chrome (header + body layout) */
header {
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 1rem;
}

main[role="main"] {
  margin-top: 1.25rem;
}

/* Alerts */
.alert {
  border-radius: 0.75rem;
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow-sm);
}

.alert-success {
  border-color: rgba(16, 185, 129, 0.3);
  background: linear-gradient(90deg, rgba(16, 185, 129, 0.06), rgba(16, 185, 129, 0.02));
  color: #065f46;
}

.alert-danger {
  border-color: rgba(239, 68, 68, 0.3);
  background: linear-gradient(90deg, rgba(239, 68, 68, 0.06), rgba(239, 68, 68, 0.02));
  color: #7f1d1d;
}

.alert-info {
  border-color: rgba(59, 130, 246, 0.25);
  background-color: rgba(59, 130, 246, 0.04);
  color: var(--text-primary);
}

[data-bs-theme="dark"] .alert-info {
  border-color: rgba(148, 163, 184, 0.5);
  background-color: #020617;
  color: var(--text-secondary);
}

/* Tables – compact, professional look */
.table-striped tbody tr:nth-of-type(odd) {
  background-color: #f9fafb;
}

.table td .btn {
  padding-inline: 0.6rem;
  padding-block: 0.25rem;
  font-size: 0.8rem;
}

.table thead th:first-child {
  border-top-left-radius: 0.5rem;
}

.table thead th:last-child {
  border-top-right-radius: 0.5rem;
}

[data-bs-theme="dark"] .table-striped tbody tr:nth-of-type(odd) {
  background-color: #020617;
}

[data-bs-theme="dark"] .table-hover tbody tr:hover {
  background-color: var(--table-row-hover-bg);
}

/* Leave Request – application type pills */
.app-type-pill {
  padding: 0.25rem 0.75rem;
  border-radius: 999px;
  border: 1px solid var(--border-color);
  background-color: rgba(148, 163, 184, 0.05);
}

.app-type-pill .form-check-input {
  display: none;
}

.app-type-pill .form-check-label {
  cursor: pointer;
  font-size: 0.8rem;
  color: var(--text-secondary);
  padding: 0.25rem 0.9rem;
  border-radius: 999px;
}

.app-type-pill .form-check-input:checked+.form-check-label {
  background-color: rgba(79, 70, 229, 0.08);
  color: var(--primary-color);
}

[data-bs-theme="dark"] .app-type-pill .form-check-input:checked+.form-check-label {
  background-color: rgba(129, 140, 248, 0.25);
  color: #e5e7eb;
}

/* Leave Request – neutral sections */
.conditional-section {
  padding: 1.25rem 1.5rem;
  border-radius: 0.75rem;
  border: 1px solid var(--border-color);
  background-color: rgba(148, 163, 184, 0.02);
  margin-bottom: 1.25rem;
}

[data-bs-theme="dark"] .conditional-section {
  background-color: #020617;
}

/* Sidebar nested navigation */
.sidebar .nav .nav {
  padding-left: 0.75rem;
  border-left: 1px dashed rgba(148, 163, 184, 0.4);
}

.sidebar .nav .nav .nav-link {
  padding-top: 0.4rem;
  padding-bottom: 0.4rem;
  font-size: 0.85rem;
}

/* Profile pill + theme toggle refinement */
#theme-toggle {
  background-color: var(--card-bg);
}

#theme-toggle:hover {
  box-shadow: var(--shadow-sm);
}

/* Brand / auth logos */
.sidebar-logo {
  height: 42px;
  width: auto;
  object-fit: contain;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.1));
}

/* Simple, clean logo presentation like Shopify */
.auth-logo-wrapper {
  display: inline-block;
  margin-bottom: 1.5rem;
}

.auth-logo {
  height: 75px;
  width: auto;
  object-fit: contain;
  display: block;
  margin: 0 auto;
}

/* Responsive tweaks */
@media (max-width: 992px) {
  .sidebar {
    width: 220px;
  }

  .main-content {
    margin-left: 220px;
    padding: 1.5rem;
  }
}

@media (max-width: 768px) {
  .sidebar {
    display: none;
  }

  .main-content {
    margin-left: 0;
    padding: 1.25rem 1rem;
  }

  header {
    flex-direction: column;
    align-items: flex-start !important;
    gap: 1rem;
  }

}

/* Custom Selection Dropdowns (Year/Month) */
.year-dropdown-menu,
.month-dropdown-menu {
  max-height: 380px;
  /* Approx 10 items (38px per item) */
  overflow-y: auto;
  min-width: 140px;
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--border-color);
  border-radius: 0.5rem;
  z-index: 1060;
}

.year-dropdown-menu .dropdown-item,
.month-dropdown-menu .dropdown-item {
  padding: 0.6rem 1rem;
  font-weight: 500;
  transition: all 0.15s;
}

.month-dropdown-menu {
  min-width: 160px;
}

.year-dropdown-menu .dropdown-item.active,
.year-dropdown-menu .dropdown-item:active,
.month-dropdown-menu .dropdown-item.active,
.month-dropdown-menu .dropdown-item:active {
  background-color: var(--primary-color);
  color: white;
}

[data-bs-theme="dark"] .year-dropdown-menu,

/* Global Loading Indicator */
.loader-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(255, 255, 255, 0.7);
  backdrop-filter: blur(4px);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 9999;
  visibility: hidden;
  opacity: 0;
  transition: opacity 0.3s ease, visibility 0.3s;
}

.loader-active {
  visibility: visible;
  opacity: 1;
}

[data-bs-theme="dark"] .loader-overlay {
  background: rgba(15, 23, 42, 0.7);
}

.loader-spinner {
  width: 48px;
  height: 48px;
  border: 5px solid var(--primary-color);
  border-bottom-color: transparent;
  border-radius: 50%;
  display: inline-block;
  box-sizing: border-box;
  animation: rotation 1s linear infinite;
}

@keyframes rotation {
  0% {
    transform: rotate(0deg);
  }

  100% {
    transform: rotate(360deg);
  }
}

/* Refined Country Phone Component */
.country-phone-wrapper {
  display: flex;
  align-items: center;
  border: 1px solid var(--border-color);
  border-radius: 0.5rem;
  background-color: var(--card-bg);
  transition: border-color 0.2s, box-shadow 0.2s;
  overflow: visible;
  height: calc(1.5em + 1.25rem + 2px);
  position: relative;
}

.country-phone-wrapper:focus-within {
  border-color: var(--primary-color);
  box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
  z-index: 5;
}

.country-phone-wrapper.is-invalid {
  border-color: var(--danger-color);
}

.country-dropdown {
  position: relative;
  height: 100%;
  border-right: 1px solid var(--border-color);
  min-width: 100px;
}

.selected-country-display {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
  padding: 0 0.75rem;
  cursor: pointer;
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--text-primary);
  white-space: nowrap;
  user-select: none;
}

.selected-country-display:hover {
  background-color: rgba(0, 0, 0, 0.02);
}

.country-options-list {
  position: absolute;
  top: 100%;
  left: 0;
  width: 280px;
  max-height: 300px;
  overflow-y: auto;
  background-color: var(--card-bg);
  border: 1px solid var(--border-color);
  border-radius: 0.5rem;
  z-index: 1050;
  margin-top: 5px;
}

.country-option {
  display: flex;
  align-items: center;
  padding: 0.75rem;
  cursor: pointer;
  transition: background-color 0.15s;
}

.country-option:hover {
  background-color: var(--bg-color);
}

.country-option.active {
  background-color: rgba(79, 70, 229, 0.05);
  border-left: 3px solid var(--primary-color);
}

.country-option.highlighted {
  background-color: rgba(79, 70, 229, 0.1);
  border-left: 3px solid var(--primary-color);
  outline: 1px solid rgba(79, 70, 229, 0.2);
}

.country-flag {
  font-size: 1.25rem;
  margin-right: 0.75rem;
}

.country-name {
  flex-grow: 1;
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--text-primary);
}

.country-iso-code {
  font-size: 0.8rem;
  color: var(--text-secondary);
  margin-left: 0.5rem;
}

.phone-input-field {
  flex-grow: 1;
  border: none !important;
  background: transparent !important;
  padding: 0.625rem 0.875rem;
  font-size: 1rem;
  color: var(--text-primary);
  width: 100%;
  outline: none !important;
}

.phone-input-field::placeholder {
  color: var(--text-secondary);
  opacity: 0.6;
}

/* Dark Mode Overrides */
[data-bs-theme="dark"] .country-options-list {
  background-color: var(--card-bg);
  box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.5) !important;
}

/* Header & Profile Section Utilities */
.transition-all {
  transition: all 0.2s ease-in-out;
}

.hover-opacity:hover {
  opacity: 0.8;
}

.btn-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  width: 38px;
  height: 38px;
  min-width: 38px;
}

.btn-icon i {
  line-height: 1;
}

.ls-1 {
  letter-spacing: 0.5px;
}

/* --- Premium Profile & Header Styles --- */
.profile-pill {
  padding: 6px 14px 6px 6px;
  border-radius: 50px;
  background: var(--card-bg);
  border: 1px solid var(--border-color);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  cursor: pointer;
  box-shadow: var(--shadow-sm);
  display: flex;
  align-items: center;
  gap: 12px;
}

.profile-pill:hover {
  border-color: var(--primary-color);
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
  background: rgba(79, 70, 229, 0.02);
}

.avatar-wrapper {
  position: relative;
  width: 42px;
  height: 42px;
  flex-shrink: 0;
}

.avatar-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
  border: 2px solid white;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.avatar-initial {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary-color), var(--primary-hover));
  color: white;
  font-weight: 700;
  font-size: 1.1rem;
  border: 2px solid white;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.status-indicator {
  position: absolute;
  bottom: 2px;
  right: 2px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--success-color);
  border: 2px solid white;
}

.logout-container {
  padding-left: 15px;
  border-left: 1px solid var(--border-color);
}

.logout-btn {
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 12px;
  background: rgba(239, 68, 68, 0.05);
  color: var(--danger-color);
  border: 1px solid rgba(239, 68, 68, 0.1);
  transition: all 0.3s ease;
  text-decoration: none;
}

.logout-btn:hover {
  background: var(--danger-color);
  color: white;
  transform: rotate(-10deg) scale(1.1);
  box-shadow: 0 4px 12px rgba(239, 68, 68, 0.3);
}

/* Glassmorphism Classes */
.glass-effect {
  background: rgba(255, 255, 255, 0.7) !important;
  backdrop-filter: blur(10px) !important;
  -webkit-backdrop-filter: blur(10px) !important;
}

[data-bs-theme="dark"] .glass-effect {
  background: rgba(30, 41, 59, 0.7) !important;
}

.premium-badge {
  font-size: 0.6rem;
  padding: 2px 8px;
  border-radius: 20px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  display: inline-block;
  margin-top: 2px;
}

.badge-trial {
  background: linear-gradient(90deg, #f59e0b, #fbbf24);
  color: white;
}

.badge-premium {
  background: linear-gradient(90deg, #4f46e5, #818cf8);
  color: white;
}

/* Outfit Font Support */
.font-outfit {
  font-family: 'Outfit', sans-serif !important;
}

/* Back Button Style */
.hover-back {
  transition: all 0.2s ease-in-out;
  color: var(--text-secondary);
  width: fit-content;
}

.hover-back:hover {
  color: var(--primary-color) !important;
  transform: translateX(-4px);
}