/* Enhanced Heart Risk Monitor Styles - with WHO Parameter Support */

/* Modern Color Palette */
:root {
  --primary: #2c3e50;
  --secondary: #3498db;
  --accent: #e74c3c;
  --light: #ecf0f1;
  --dark: #2c3e50;
  --success: #2ecc71;
  --warning: #f39c12;
  --danger: #e74c3c;
  --font-main: 'Inter', 'Roboto', sans-serif;
  --primary-color: #DC3545;
  --primary-hover: #C82333;
  --sidebar-bg: #fff;
  --sidebar-active: linear-gradient(90deg, #DC3545 0%, #E4606D 100%);
  --sidebar-hover: #fff5f5;
  --ha-primary: #DC3545;
  --ha-primary-dark: #B82D3C;
}

/* Mobile Sidebar Active State Override - HeartAfrika Red */
/* Legacy styles for old list-group-item based sidebars */
.offcanvas .list-group-item-action {
  color: #333;
  border: none;
  transition: all 0.2s ease;
}

.offcanvas .list-group-item-action:hover {
  background-color: rgba(220, 53, 69, 0.08);
  color: #DC3545;
}

.offcanvas .list-group-item-action.active {
  background: linear-gradient(90deg, #DC3545 0%, #E4606D 100%) !important;
  color: white !important;
  border-color: #DC3545 !important;
  box-shadow: 0 4px 12px rgba(220, 53, 69, 0.3);
}

.offcanvas .list-group-item-action.active i {
  color: white !important;
}

.offcanvas .list-group-item-action i {
  color: #DC3545;
}

/* Mobile Sidebar Header - Dark Theme */
#mobileSidebar.offcanvas .offcanvas-header {
  background: transparent !important;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1) !important;
}

#mobileSidebar.offcanvas .offcanvas-title {
  color: #ffffff !important;
}

#mobileSidebar.offcanvas .btn-close {
  filter: invert(1) !important;
}

/* Mobile Sidebar Body - Dark Theme */
#mobileSidebar.offcanvas .offcanvas-body {
  background: transparent !important;
}

/* Legacy light theme for other offcanvas (non-sidebar) */
.offcanvas:not(#mobileSidebar) .offcanvas-header {
  background: linear-gradient(135deg, #1a1a1a 0%, #2d2d2d 100%);
  color: white;
  border-bottom: 3px solid #DC3545 !important;
}

.offcanvas:not(#mobileSidebar) .offcanvas-header .offcanvas-title {
  color: white !important;
}

.offcanvas:not(#mobileSidebar) .offcanvas-header .btn-close {
  filter: invert(1);
}

.offcanvas:not(#mobileSidebar) .offcanvas-body {
  background: #fafafa;
}


body {
  font-family: var(--font-main);
  font-size: 1.05rem;
  background: linear-gradient(120deg, #f8f9fa 0%, #eaf6fb 100%);
  color: #222;
  letter-spacing: 0.01em;
}

body,
.main-content {
  overflow-x: hidden;
}

/* Navbar with gradient */
.navbar {
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

/* Enhanced Card Styles */
.card {
  border-radius: 14px;
  box-shadow: 0 4px 24px rgba(44, 62, 80, 0.07);
  border: none;
  transition: box-shadow 0.2s, transform 0.2s;
  margin-bottom: 1.5rem;
}

.card:hover {
  transform: translateY(-4px) scale(1.01);
  box-shadow: 0 8px 32px rgba(44, 62, 80, 0.12);
}

.card-header {
  border-top-left-radius: 10px !important;
  border-top-right-radius: 10px !important;
}

/* Button Styles */
.btn {
  border-radius: 6px;
  font-weight: 600;
  letter-spacing: 0.01em;
  transition: box-shadow 0.2s, transform 0.2s;
}

.btn:active {
  transform: scale(0.98);
}

.btn-primary {
  background: linear-gradient(to right, var(--primary-color), #E4606D);
  border: none;
}

.btn-primary:hover {
  background: linear-gradient(to right, #E4606D, var(--primary-color));
  transform: translateY(-2px);
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

.btn-outline-primary {
  color: var(--primary-color);
  border-color: var(--primary-color);
  background-color: transparent;
}

.btn-outline-primary:hover {
  background-color: var(--primary-color);
  color: #fff;
  border-color: var(--primary-color);
}

/* Form Styles */
.form-control,
.form-select {
  border-radius: 6px;
  padding: 12px 16px;
  font-size: 1rem;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.form-control:focus,
.form-select:focus {
  border-color: var(--secondary);
  box-shadow: 0 0 0 0.18rem rgba(52, 152, 219, 0.18);
}

label {
  font-weight: 600;
  color: var(--dark);
  margin-bottom: 6px;
}

/* WHO Parameter Styling */
.who-parameter-section {
  background-color: rgba(52, 152, 219, 0.1);
  border-left: 4px solid var(--secondary);
  padding: 15px;
  border-radius: 5px;
  margin-bottom: 20px;
}

/* Age Parameter Animation */
.age-indicator {
  display: inline-block;
  position: relative;
  padding-left: 20px;
}

.age-indicator::before {
  content: '';
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 12px;
  height: 12px;
  border-radius: 50%;
  animation: pulse 2s infinite;
}

.age-low::before {
  background-color: var(--success);
}

.age-mild::before {
  background-color: var(--secondary);
}

.age-moderate::before {
  background-color: var(--warning);
}

.age-high::before,
.age-very-high::before {
  background-color: var(--danger);
}

/* Sex Parameter Styling */
.sex-male {
  color: var(--secondary);
}

.sex-female {
  color: #e83e8c;
  /* Pinkish color for female */
}

/* Risk Category Enhancements */
.risk-score-container {
  position: relative;
  height: 150px;
  width: 150px;
  margin: 0 auto;
}

.risk-score-circle {
  position: relative;
  height: 180px;
  width: 180px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2.5rem;
  font-weight: bold;
  color: white;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
  transition: all 0.5s ease;
}

.risk-score-value {
  position: relative;
  z-index: 2;
  text-shadow: 1px 1px 3px rgba(0, 0, 0, 0.3);
}

.risk-scale {
  font-size: 0.85rem;
  color: #666;
  font-weight: 500;
}

.risk-low {
  background: linear-gradient(135deg, #2ecc71, #27ae60);
  animation: pulse-success 3s infinite;
  position: relative;
  overflow: hidden;
}

.risk-moderate {
  background: linear-gradient(135deg, #f39c12, #e67e22);
  animation: pulse-warning 3s infinite;
  position: relative;
  overflow: hidden;
}

.risk-high {
  background: linear-gradient(135deg, #e74c3c, #c0392b);
  animation: pulse-danger 3s infinite;
  position: relative;
  overflow: hidden;
}

.risk-very-high {
  background: linear-gradient(135deg, #c0392b, #8e44ad);
  animation: pulse-danger 2s infinite;
  position: relative;
  overflow: hidden;
}

.risk-low::after,
.risk-moderate::after,
.risk-high::after,
.risk-very-high::after {
  content: '';
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: radial-gradient(circle, rgba(255, 255, 255, 0.3) 0%, rgba(255, 255, 255, 0) 70%);
  opacity: 0.6;
  z-index: 1;
  animation: shine 3s infinite linear;
}

@keyframes shine {
  from {
    transform: rotate(0deg);
  }

  to {
    transform: rotate(360deg);
  }
}

/* Animations */
@keyframes pulse {
  0% {
    opacity: 1;
    transform: translateY(-50%) scale(1);
  }

  50% {
    opacity: 0.6;
    transform: translateY(-50%) scale(1.2);
  }

  100% {
    opacity: 1;
    transform: translateY(-50%) scale(1);
  }
}

@keyframes pulse-success {
  0% {
    box-shadow: 0 0 0 0 rgba(46, 204, 113, 0.7);
  }

  70% {
    box-shadow: 0 0 0 10px rgba(46, 204, 113, 0);
  }

  100% {
    box-shadow: 0 0 0 0 rgba(46, 204, 113, 0);
  }
}

@keyframes pulse-warning {
  0% {
    box-shadow: 0 0 0 0 rgba(243, 156, 18, 0.7);
  }

  70% {
    box-shadow: 0 0 0 10px rgba(243, 156, 18, 0);
  }

  100% {
    box-shadow: 0 0 0 0 rgba(243, 156, 18, 0);
  }
}

@keyframes pulse-danger {
  0% {
    box-shadow: 0 0 0 0 rgba(231, 76, 60, 0.7);
  }

  70% {
    box-shadow: 0 0 0 10px rgba(231, 76, 60, 0);
  }

  100% {
    box-shadow: 0 0 0 0 rgba(231, 76, 60, 0);
  }
}

/* WHO Graphics */
.who-parameter-icon {
  font-size: 1.5rem;
  margin-right: 10px;
  vertical-align: middle;
}

/* Footer Enhancements */
.footer {
  background: #212529;
  color: #fff;
  border-top: 4px solid var(--primary-color);
  width: 100%;
  position: relative;
}

/* Footer positioning for logged-in users with sidebar */
.app-container:has(.sidebar-nav)~.footer,
.main-content.sidebar-active~.footer {
  margin-left: 280px;
  width: calc(100% - 280px);
  transition: margin-left 0.3s cubic-bezier(0.4, 0, 0.2, 1), width 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.app-container:has(.sidebar-nav.collapsed)~.footer,
.main-content.sidebar-collapsed~.footer,
body.sidebar-collapsed .footer {
  margin-left: 80px;
  width: calc(100% - 80px);
}

/* Footer for guest users (no sidebar) */
body:not(:has(.sidebar-nav)) .footer {
  margin-left: 0;
  width: 100%;
}

.footer a.text-white-50:hover {
  color: #fff !important;
  text-decoration: underline !important;
}

.footer .list-unstyled li {
  margin-bottom: 0.5rem;
}

.footer .fw-bold {
  color: #fff;
}

/* Responsive Adjustments */
@media (max-width: 768px) {
  .risk-score-container {
    height: 120px;
    width: 120px;
  }

  .risk-score-circle {
    height: 140px;
    width: 140px;
    font-size: 1.8rem;
  }

  .risk-scale {
    font-size: 0.75rem;
  }
}



/* --- Sleek Header Styles --- */
header.navbar {
  box-shadow: 0 2px 12px rgba(220, 53, 69, 0.07);
  background: #fff;
}

header .nav-link,
header .dropdown-item {
  color: #222;
}

header .nav-link:hover,
header .dropdown-item:hover {
  color: #DC3545;
}

/* --- Modern App Layout --- */
.app-container {
  display: flex;
  min-height: 100vh;
  background: linear-gradient(120deg, #f8f9fa 0%, #eaf6fb 100%);
}

.main-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  margin-left: 0;
  /* Default: no margin for guests */
  transition: margin-left 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Only apply margin when sidebar exists (user is logged in) */
/* Modern browsers with :has() support AND fallback classes */
.app-container:has(.sidebar-nav) .main-content,
.main-content.sidebar-active {
  margin-left: 280px;
}

.app-container:has(.sidebar-nav.collapsed) .main-content,
.main-content.sidebar-collapsed,
body.sidebar-collapsed .main-content {
  margin-left: 80px;
}

/* Mobile: always no margin */
@media (max-width: 991.98px) {
  .main-content {
    margin-left: 0 !important;
  }
}

.content-area {
  flex: 1;
  padding: 1.5rem 2rem;
}

.content-wrapper {
  max-width: 100%;
  margin: 0;
  width: 100%;
  padding: 0 1rem;
  padding: 0 1rem;
  /* Add horizontal padding for better spacing */
}

/* Responsive adjustments */
@media (max-width: 768px) {
  .content-area {
    padding: 1rem;
  }

  .content-wrapper {
    padding: 0 0.5rem;
  }

  /* Reset footer on mobile */
  .app-container:has(.sidebar-nav)~.footer {
    margin-left: 0 !important;
    width: 100% !important;
  }
}

.content-wrapper .card {
  border-radius: 14px;
  box-shadow: 0 4px 24px rgba(44, 62, 80, 0.07);
  border: none;
  transition: box-shadow 0.2s, transform 0.2s;
  margin-bottom: 1.5rem;
}

.content-wrapper .card:hover {
  transform: translateY(-4px) scale(1.01);
  box-shadow: 0 8px 32px rgba(44, 62, 80, 0.12);
}

/* --- Modern Sidebar Styles --- */
.sidebar-nav {
  width: 280px;
  background: rgba(255, 255, 255, 0.98);
  backdrop-filter: blur(20px);
  border-right: 1px solid rgba(220, 53, 69, 0.1);
  box-shadow: 4px 0 24px rgba(220, 53, 69, 0.08);
  position: fixed;
  left: 0;
  top: 0;
  bottom: 0;
  z-index: 1000;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.sidebar-nav.collapsed {
  width: 80px;
}

.sidebar-nav.collapsed .brand-text,
.sidebar-nav.collapsed .menu-text,
.sidebar-nav.collapsed .menu-label {
  opacity: 0;
  width: 0;
  overflow: hidden;
}

.sidebar-nav.collapsed .sidebar-collapse-btn i {
  transform: rotate(180deg);
}

.sidebar-container {
  height: 100vh;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  overflow-x: hidden;
}

.sidebar-container::-webkit-scrollbar {
  width: 6px;
}

.sidebar-container::-webkit-scrollbar-track {
  background: rgba(220, 53, 69, 0.05);
}

.sidebar-container::-webkit-scrollbar-thumb {
  background: rgba(220, 53, 69, 0.2);
  border-radius: 3px;
}

.sidebar-container::-webkit-scrollbar-thumb:hover {
  background: rgba(220, 53, 69, 0.3);
}

.sidebar-header {
  padding: 1.5rem 1.25rem;
  border-bottom: 1px solid rgba(220, 53, 69, 0.08);
  background: linear-gradient(to bottom, rgba(220, 53, 69, 0.03), transparent);
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-weight: 700;
  font-size: 1.1rem;
  color: var(--primary-color);
  transition: all 0.3s ease;
  white-space: nowrap;
}

.sidebar-collapse-btn {
  color: var(--primary-color);
  transition: all 0.3s ease;
  opacity: 0.6;
}

.sidebar-collapse-btn:hover {
  opacity: 1;
  color: var(--primary-hover);
}

.sidebar-collapse-btn i {
  transition: transform 0.3s ease;
}

.sidebar-nav.collapsed .sidebar-brand {
  gap: 0;
  justify-content: center;
  margin-right: 0;
}

/* Fix for collapsed sidebar header layout */
.sidebar-nav.collapsed .sidebar-header {
  padding: 1rem 0.5rem;
}

.sidebar-nav.collapsed .sidebar-header>div {
  flex-direction: column;
  gap: 1rem;
  justify-content: center;
}

.sidebar-brand i {
  font-size: 1.5rem;
  color: #e74c3c;
}

.brand-text {
  background: linear-gradient(135deg, var(--primary-color), #5f7cff);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.sidebar-menu {
  flex: 1;
  padding: 1.5rem 0;
}

.menu-section {
  margin-bottom: 1.5rem;
}

.sidebar-nav.collapsed .menu-section {
  margin-bottom: 1rem;
}

.menu-section:last-child {
  margin-bottom: 0;
}

.menu-label {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #6c757d;
  padding: 0 1.25rem 0.5rem;
  margin-bottom: 0.25rem;
  transition: all 0.3s ease;
  white-space: nowrap;
}

.sidebar-nav.collapsed .menu-label {
  text-align: center;
  font-size: 0.65rem;
  padding: 0 0.5rem 0.5rem;
}

.menu-items {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.menu-item {
  display: flex;
  align-items: center;
  padding: 0.875rem 1.25rem;
  color: #495057;
  text-decoration: none;
  border-radius: 0 1rem 1rem 0;
  margin: 0 0.75rem 0.25rem 0;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  font-weight: 500;
  white-space: nowrap;
}

.sidebar-nav.collapsed .menu-item {
  padding: 0.875rem 0.5rem;
  justify-content: center;
  margin-right: 0.5rem;
}

.menu-item:hover {
  background: linear-gradient(90deg, rgba(220, 53, 69, 0.08) 0%, rgba(228, 96, 109, 0.04) 100%);
  color: var(--primary-color);
  text-decoration: none;
  transform: translateX(4px);
}

.menu-item.active {
  background: linear-gradient(90deg, var(--primary-color) 0%, #E4606D 100%);
  color: white;
  box-shadow: 0 4px 12px rgba(220, 53, 69, 0.3);
  transform: translateX(4px);
}

.menu-icon {
  font-size: 1.25rem;
  width: 2.25rem;
  height: 2.25rem;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 0.5rem;
  margin-right: 0.75rem;
  transition: all 0.3s ease;
  background: rgba(220, 53, 69, 0.1);
}

.menu-item:hover .menu-icon {
  background: rgba(220, 53, 69, 0.15);
  transform: scale(1.1);
}

.menu-item.active .menu-icon {
  background: rgba(255, 255, 255, 0.2);
  transform: scale(1.1);
}

.menu-icon i {
  font-size: 1.1rem;
  color: var(--primary-color);
}

.menu-item.active .menu-icon i {
  color: white;
}

.menu-text {
  flex: 1;
  font-size: 0.95rem;
  font-weight: 500;
}

.menu-indicator {
  width: 0.25rem;
  height: 0;
  background: var(--primary-color);
  border-radius: 0.125rem;
  transition: height 0.3s ease;
  position: absolute;
  right: 0;
  top: 50%;
  transform: translateY(-50%);
}

/* Tooltip improvements for collapsed sidebar */
.sidebar-nav.collapsed .menu-item .tooltip {
  z-index: 1100;
}

.sidebar-nav.collapsed .menu-icon {
  margin-right: 0;
}

/* Smooth transitions */
.sidebar-nav.collapsed .menu-item:hover {
  transform: translateX(2px);
}

/* Scrollbar styling for sidebar */
.sidebar-nav::-webkit-scrollbar {
  width: 6px;
}

.sidebar-nav::-webkit-scrollbar-track {
  background: rgba(220, 53, 69, 0.05);
}

.sidebar-nav::-webkit-scrollbar-thumb {
  background: rgba(220, 53, 69, 0.2);
  border-radius: 3px;
}

.sidebar-nav::-webkit-scrollbar-thumb:hover {
  background: rgba(220, 53, 69, 0.3);
}

/* Admin section in sidebar */
.sidebar-nav.collapsed .menu-section:not(:last-child)::after {
  content: '';
  display: block;
  height: 1px;
  background: rgba(220, 53, 69, 0.1);
  margin: 0.5rem auto;
  width: 50%;
}

.menu-item.active .menu-indicator {
  height: 1.5rem;
}

/* --- Sidebar Enhancements --- */
.sidebar-nav::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent 0%, rgba(220, 53, 69, 0.1) 50%, transparent 100%);
}

.menu-item {
  overflow: hidden;
}

.menu-item::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.1), transparent);
  transition: left 0.5s ease;
}

.menu-item:hover::before {
  left: 100%;
}

/* --- Dark Mode Support --- */
[data-bs-theme="dark"] .sidebar-nav {
  background: rgba(33, 37, 41, 0.95);
  border-right-color: rgba(220, 53, 69, 0.2);
}

[data-bs-theme="dark"] .menu-item {
  color: #adb5bd;
}

[data-bs-theme="dark"] .menu-item:hover {
  background: linear-gradient(90deg, rgba(220, 53, 69, 0.15) 0%, rgba(228, 96, 109, 0.08) 100%);
  color: #fff;
}

[data-bs-theme="dark"] .menu-label {
  color: #6c757d;
}

[data-bs-theme="dark"] .sidebar-header {
  border-bottom-color: rgba(220, 53, 69, 0.2);
}

/* --- Mobile Sidebar --- */
@media (max-width: 991.98px) {
  .sidebar-nav {
    display: none;
  }

  .app-container {
    flex-direction: column;
  }

  .main-content {
    width: 100%;
  }

  .content-area {
    padding: 1rem;
  }

  .content-wrapper {
    max-width: 100vw;
    padding: 0 0.5rem;
  }

  /* Footer full width on mobile */
  .app-container:has(.sidebar-nav)~.footer {
    margin-left: 0 !important;
    width: 100% !important;
  }
}

@media (max-width: 600px) {
  .content-area {
    padding: 0.5rem;
  }

  .content-wrapper {
    max-width: 100vw;
    padding: 0 0.25rem;
  }
}

/* --- Smooth Scrolling --- */
.sidebar-container {
  scrollbar-width: thin;
  scrollbar-color: rgba(220, 53, 69, 0.3) transparent;
}

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

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

.sidebar-container::-webkit-scrollbar-thumb {
  background: rgba(220, 53, 69, 0.3);
  border-radius: 2px;
}

.sidebar-container::-webkit-scrollbar-thumb:hover {
  background: rgba(220, 53, 69, 0.5);
}

/* --- Avatar and Notification Polish --- */
header .rounded-circle {
  border: 2px solid #eaf6fb;
}

header .badge.bg-danger {
  font-size: 0.75rem;
  padding: 0.3em 0.5em;
}

/* Avatar Initials Style */
.avatar-initials {
  background: #ffe5e8;
  color: #DC3545;
  font-weight: 700;
  font-size: 1.1rem;
  width: 32px;
  height: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  border: 2px solid #eaf6fb;
}

/* Header nav icon spacing */
header .nav-link {
  margin-left: 0.5rem;
  margin-right: 0.5rem;
}

/* Card and content spacing polish */
.card {
  margin-bottom: 1.5rem;
}

body.bg-light {
  background: linear-gradient(120deg, #f8f9fa 0%, #eaf6fb 100%);
}

header.navbar,
.navbar {
  z-index: 1085;
  position: relative;
}

.dropdown-menu,
.navbar .dropdown-menu {
  z-index: 1090 !important;
}

@media (max-width: 600px) {

  .language-selector,
  .dropdown-toggle.language-selector,
  #languageDropdown {
    min-width: 80px;
    max-width: 120px;
    font-size: 0.9rem;
    padding-left: 0.5rem;
    padding-right: 0.5rem;
    white-space: normal;
    overflow: visible;
    text-overflow: clip;
  }

  /* Show text but allow wrapping */
  .language-selector .lang-text,
  #languageDropdown .lang-text {
    display: inline;
    word-wrap: break-word;
  }
}

.dropdown.show .dropdown-menu {
  display: block !important;
  z-index: 2000 !important;
  visibility: visible !important;
}

.navbar,
.main-content,
.card {
  overflow: visible !important;
}

/* Ensure translated text is properly displayed */
.translated-text,
[data-translated="true"] {
  white-space: normal !important;
  overflow: visible !important;
  text-overflow: clip !important;
  word-wrap: break-word !important;
  word-break: normal !important;
}

/* Language selector improvements */
.language-selector-container .dropdown-toggle {
  white-space: normal !important;
  overflow: visible !important;
  text-overflow: clip !important;
}

.language-selector-container .dropdown-toggle span {
  word-wrap: break-word !important;
  word-break: normal !important;
}

/* Ensure dropdown items show full text */
.dropdown-menu .dropdown-item {
  white-space: normal !important;
  word-wrap: break-word !important;
  overflow: visible !important;
}

/* Language selector specific improvements */
.language-selector-container .dropdown-menu {
  min-width: 200px !important;
  max-width: 300px !important;
}

.language-selector-container .dropdown-item {
  padding: 0.5rem 1rem !important;
  font-size: 0.9rem !important;
  line-height: 1.4 !important;
}

/* Ensure text doesn't get cut off in any container */
.text-truncate {
  white-space: normal !important;
  overflow: visible !important;
  text-overflow: clip !important;
}

/* Language text styling */
.language-text {
  white-space: normal !important;
  overflow: visible !important;
  text-overflow: clip !important;
  word-wrap: break-word !important;
  word-break: normal !important;
}

/* Consent Prompt */
.consent-prompt {
  position: fixed;
  bottom: 20px;
  left: 20px;
  width: 320px;
  background: white;
  border-radius: 12px;
  box-shadow: 0 5px 25px rgba(0, 0, 0, 0.15);
  padding: 20px;
  z-index: 9999;
  border-left: 5px solid var(--primary-color);
  display: none;
  /* Hidden by default, shown by JS */
  animation: slideInLeft 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.consent-prompt h5 {
  color: var(--primary-color);
  font-size: 1.1rem;
  margin-bottom: 0.5rem;
  font-weight: 700;
}

.consent-prompt p {
  font-size: 0.9rem;
  color: #555;
  margin-bottom: 1rem;
  line-height: 1.5;
}

.consent-buttons {
  display: flex;
  gap: 10px;
}

.btn-consent-accept {
  background: var(--primary-color);
  color: white;
  border: none;
  padding: 8px 16px;
  border-radius: 6px;
  font-size: 0.85rem;
  font-weight: 600;
  flex: 1;
}

.btn-consent-accept:hover {
  background: var(--primary-hover);
  color: white;
}

.btn-consent-reject {
  background: #f1f3f5;
  color: #495057;
  border: none;
  padding: 8px 16px;
  border-radius: 6px;
  font-size: 0.85rem;
  font-weight: 600;
  flex: 1;
}

.btn-consent-reject:hover {
  background: #e9ecef;
}

@keyframes slideInLeft {
  from {
    transform: translateX(-50px);
    opacity: 0;
  }

  to {
    transform: translateX(0);
    opacity: 1;
  }
}

/* Force Light Mode on Mobile/System Dark Mode */
@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: light;
  }

  body {
    background: linear-gradient(120deg, #f8f9fa 0%, #eaf6fb 100%) !important;
    color: #222 !important;
  }

  .card,
  .navbar,
  .sidebar-nav,
  .footer {
    /* Ensure these components keep their light mode look */
    background-color: white;
    color: #222;
  }

  .text-muted {
    color: #6c757d !important;
  }
}

/* ==============================================
   RTL Support for Arabic Language
   ============================================== */
[dir="rtl"] {
  text-align: right;
}

[dir="rtl"] .sidebar-nav {
  left: auto;
  right: 0;
  border-right: none;
  border-left: 1px solid rgba(220, 53, 69, 0.1);
  box-shadow: -4px 0 24px rgba(220, 53, 69, 0.08);
}

[dir="rtl"] .main-content {
  margin-left: 0 !important;
  margin-right: 280px;
}

[dir="rtl"] .main-content.sidebar-collapsed,
[dir="rtl"] body.sidebar-collapsed .main-content {
  margin-right: 80px;
}

[dir="rtl"] .menu-item {
  border-radius: 1rem 0 0 1rem;
  margin: 0 0 0.25rem 0.75rem;
}

[dir="rtl"] .menu-icon {
  margin-right: 0;
  margin-left: 0.75rem;
}

[dir="rtl"] .menu-indicator {
  right: auto;
  left: 0;
}

[dir="rtl"] .menu-item:hover,
[dir="rtl"] .menu-item.active {
  transform: translateX(-4px);
}

[dir="rtl"] .input-group>.form-control:not(:first-child),
[dir="rtl"] .input-group>.input-group-text:not(:first-child) {
  border-radius: 6px 0 0 6px;
}

[dir="rtl"] .input-group>.form-control:not(:last-child),
[dir="rtl"] .input-group>.input-group-text:not(:last-child) {
  border-radius: 0 6px 6px 0;
}

[dir="rtl"] .bi-arrow-right::before {
  transform: scaleX(-1);
  display: inline-block;
}

[dir="rtl"] .bi-arrow-left::before {
  transform: scaleX(-1);
  display: inline-block;
}

@media (max-width: 991.98px) {
  [dir="rtl"] .main-content {
    margin-right: 0 !important;
  }
}