/* =========================================
   MINDER - MODERN DESIGN SYSTEM 2.0
   Slick, Professional, Mobile-First, i18n-Safe
   ========================================= */

:root {
  /* Brand Colors */
  --minder-teal: #367588;       
  --minder-teal-dark: #24515e;
  --minder-teal-light: #f0f9fa;
  --minder-gold: #d4af37;
  --minder-gold-dark: #b8860b;
  --minder-slate: #334155;      
  --minder-navy: #0f172a;       
  
  /* UI Colors */
  --primary: var(--minder-teal);
  --primary-hover: var(--minder-teal-dark);
  --secondary: var(--minder-slate);
  --success: #22c55e;           
  --warning: #f59e0b;           
  --danger: #ef4444;            
  --info: #0ea5e9;              
  --light: #f8fafc;
  --dark: var(--minder-navy);
  --white: #ffffff;

  /* Bootstrap Override Vars */
  --bs-primary: var(--primary);
  --bs-primary-rgb: 54, 117, 136;
  --bs-secondary: var(--secondary);
  --bs-success: var(--success);
  --bs-success-rgb: 34, 197, 94;
  --bs-info: var(--info);
  --bs-warning: var(--warning);
  --bs-danger: var(--danger);
  --bs-light: var(--light);
  --bs-dark: var(--dark);
  --bs-body-color: var(--dark);
  --bs-link-color: var(--primary);
  --bs-link-hover-color: var(--primary-hover);

  /* Surfaces & Borders */
  --surface: #ffffff;
  --surface-muted: #f1f5f9;
  --hairline: #cbd5e1;
  --hairline-dark: #94a3b8;

/* Enhanced Tab Styles */
.nav-pills .nav-link {
    color: #334155;
    font-weight: 700;
}

.nav-pills .nav-link.active {
    background-color: var(--primary) !important;
    color: var(--white) !important;
    box-shadow: 0 4px 12px rgba(var(--bs-primary-rgb), 0.25);
}

.nav-pills .nav-link.active .badge {
    background-color: rgba(255, 255, 255, 0.2) !important;
    color: white !important;
    border: 1px solid rgba(255, 255, 255, 0.3);
}

  /* Design System Units */
  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 24px;
  --radius-pill: 999px;

  /* Spacing */
  --container-max: 1200px;

  /* Shadows - Layered & Realistic */
  --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
  --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
  --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
  --shadow-xl: 0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1);
  --shadow-inner: inset 0 2px 4px 0 rgb(0 0 0 / 0.05);

  /* Transitions */
  --transition-fast: 150ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-base: 250ms cubic-bezier(0.4, 0, 0.2, 1);
}

/* =========================================
   BASE STYLES & i18n SAFETY
   ========================================= */

html {
    height: 100%;
}

body {
  min-height: 100vh; /* Replaces height: 100% for better flex-footer stability */
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  /* Global Resilience for long Armenian/Russian text */
  overflow-wrap: break-word;
  word-wrap: break-word;
}

body {
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  background-color: var(--surface-muted);
  background-image: 
    radial-gradient(at 0% 0%, hsla(194, 43%, 37%, 0.03) 0, transparent 50%), 
    radial-gradient(at 100% 0%, hsla(194, 43%, 37%, 0.03) 0, transparent 50%);
  background-attachment: fixed;
  color: var(--dark);
  line-height: 1.6;
  overflow-x: hidden;
  display: flex;
  flex-direction: column;
}

/* Force Flex containers to allow wrapping for translated strings */
.d-flex:not(.flex-nowrap) {
    flex-wrap: wrap;
}

/* Ensure buttons and badges expand but don't break layout */
.btn, .badge {
    height: auto;
    min-height: 2.4em;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    white-space: normal; /* Allow multi-line buttons if text is extremely long */
    text-align: center;
}

.badge {
    min-height: 1.8em;
    padding: 0.4em 1em;
}

/* Responsive Headings */
h1, h2, h3, h4, h5, h6 {
    line-height: 1.3;
    overflow-wrap: break-word;
    hyphens: auto;
}

[lang="hy"] body, [lang="ru"] body {
  /* Slightly tighter letter-spacing for potentially wider characters */
  letter-spacing: -0.01em;
  line-height: 1.7;
}

/* Enhanced Contrast Overrides */
.text-muted {
    color: #4b5563 !important; /* WCAG AA compliant on light backgrounds */
}

.small.text-muted, .x-small.text-muted {
    color: #374151 !important; /* High contrast for small text */
}

.lead.text-muted {
    color: #1f2937 !important;
}

/* Enhanced Text Color Utilities for Contrast */
.text-primary { color: #2c6e80 !important; } /* Darker Teal */
.text-success { color: #15803d !important; } /* Darker Green */
.text-info { color: #0369a1 !important; }    /* Darker Blue */
.text-warning { color: #92400e !important; } /* Darker Amber */
.text-danger { color: #b91c1c !important; }  /* Darker Red */

.fw-800 { font-weight: 800; }
.fw-900 { font-weight: 900; }

/* Holistic Button High-Contrast Overrides */
.btn, .badge {
    height: auto;
    min-height: 2.4em;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    white-space: normal; /* Allow multi-line buttons if text is extremely long */
    text-align: center;
    padding: 0.5rem 1.25rem;
    overflow-wrap: anywhere; /* Ensure long words in badges don't overflow */
}

/* Fluid Flex Grid - Prevent overlap for long translated strings */
.row-fluid-i18n {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    align-items: flex-start;
}

.item-fluid-i18n {
    flex: 1 1 auto;
    min-width: min-content;
}

/* Fix for overlapping text in dashboards and list items */
.d-flex.justify-content-between {
    gap: 1.5rem; /* Ensure space between items even if they expand */
}



.btn-warning {
    background-color: #f59e0b !important;
    border-color: #d97706 !important;
    color: #111827 !important;
    font-weight: 800 !important;
}

.btn-primary {
    background-color: #2c6e80 !important;
    border-color: #24515e !important;
    color: #ffffff !important;
}

.btn-outline-primary {
    border-color: #2c6e80 !important;
    color: #2c6e80 !important;
    border-width: 2px !important;
    font-weight: 800 !important;
}

.btn-outline-primary:hover {
    background-color: #2c6e80 !important;
    color: #ffffff !important;
}

.btn-success {
    background-color: #15803d !important;
    border-color: #166534 !important;
    color: #ffffff !important;
    font-weight: 800 !important;
}

.btn-success:hover {
    background-color: #166534 !important;
    color: #ffffff !important;
}

.btn-info {
    background-color: #0369a1 !important;
    border-color: #075985 !important;
    color: #ffffff !important;
}

.btn-info:hover {
    background-color: #075985 !important;
}

/* Holistic Badge Contrast Fixes (Soft Badges) */
.badge.bg-info.bg-opacity-10 {
    color: #0369a1 !important;
    background-color: rgba(3, 105, 161, 0.08) !important;
    border-color: rgba(3, 105, 161, 0.2) !important;
}

.badge.bg-success.bg-opacity-10 {
    color: #15803d !important;
    background-color: rgba(21, 128, 61, 0.08) !important;
    border-color: rgba(21, 128, 61, 0.2) !important;
}

.badge.bg-warning.bg-opacity-10 {
    color: #92400e !important;
    background-color: rgba(146, 64, 14, 0.08) !important;
    border-color: rgba(146, 64, 14, 0.2) !important;
}

.badge.bg-primary.bg-opacity-10 {
    color: #164e63 !important;
    background-color: rgba(22, 78, 99, 0.08) !important;
    border-color: rgba(22, 78, 99, 0.2) !important;
}

.badge.bg-danger.bg-opacity-10 {
    color: #b91c1c !important;
    background-color: rgba(185, 28, 28, 0.08) !important;
    border-color: rgba(185, 28, 28, 0.2) !important;
}

/* Background elevation fixes */
.bg-light {
    background-color: #f1f5f9 !important; /* Slightly deeper than surface-muted */
    border: 1px solid var(--hairline) !important;
}

.card.bg-light {
    background-color: #f8fafc !important;
}

/* Ensure form labels are visible */
label, .section-label {
    color: #111827 !important;
    font-weight: 700 !important;
}

/* Table contrast */
.table thead th {
    background-color: #f8fafc !important;
    color: #111827 !important;
    font-weight: 800;
    border-bottom: 2px solid var(--hairline) !important;
}

.table-light {
    --bs-table-bg: #f8fafc;
    --bs-table-color: #111827;
}

/* Alert & Feedback Contrast */
.alert {
    border: none;
    border-radius: var(--radius-md);
    font-weight: 600 !important;
}

.text-dark {
    color: #111827 !important; /* Extremely dark for high contrast */
}

/* Ensure all cards have visible boundaries */
.card {
    border: 1px solid var(--hairline) !important;
}

.card-header {
    border-bottom: 1px solid var(--hairline) !important;
}

.alert-info {
    background-color: #e0f2fe !important;
    color: #0369a1 !important;
    border-left: 4px solid #0ea5e9 !important;
}

.alert-warning {
    background-color: #fffbeb !important;
    color: #92400e !important;
    border-left: 4px solid #f59e0b !important;
}

.alert-success {
    background-color: #ecfdf5 !important;
    color: #15803d !important;
    border-left: 4px solid #10b981 !important;
}

.alert-danger {
    background-color: #fef2f2 !important;
    color: #991b1b !important;
    border-left: 4px solid #ef4444 !important;
}

/* Translation Hub Specialist Fixes */
.translation-hub-btn {
    position: relative;
    z-index: 10;
    pointer-events: auto !important;
}

#debugLogContainer {
    scrollbar-width: thin;
    scrollbar-color: var(--primary) #1a1a1a;
}

/* Global i18n Safe Typography */
h1, h2, h3, h4, h5, h6, p, a, span, label, div {
  overflow-wrap: break-word;
  word-wrap: break-word;
  hyphens: auto;
}

h1, h2, h3, h4, h5, h6 {
  color: var(--dark);
  font-weight: 800;
  letter-spacing: -0.02em;
}

.text-gradient {
  background: linear-gradient(135deg, var(--minder-teal), var(--minder-navy));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

/* =========================================
   LAYOUT
   ========================================= */

.main-container {
  flex: 1 0 auto;
  width: 100%;
  max-width: var(--container-max);
  margin: 0 auto;
  padding: 2rem 1rem;
}

.footer {
    background-color: var(--white);
    margin-top: auto;
}

@media (max-width: 768px) {
  .main-container { padding: 1rem 0.75rem; }
}

/* =========================================
   COMPONENTS
   ========================================= */

/* Navbar - Modern & Glassy */
.navbar {
  background: rgba(255, 255, 255, 0.9) !important;
  backdrop-filter: blur(16px) saturate(180%);
  -webkit-backdrop-filter: blur(16px) saturate(180%);
  border-bottom: 1px solid rgba(0, 0, 0, 0.05);
  padding: 1rem 0;
  transition: all var(--transition-base);
}

.navbar.scrolled {
  padding: 0.5rem 0;
  background: rgba(255, 255, 255, 0.95) !important;
  box-shadow: var(--shadow-sm);
}

.nav-link {
  font-weight: 600;
  color: var(--minder-slate) !important;
  padding: 0.5rem 1rem !important;
  border-radius: var(--radius-sm);
  transition: var(--transition-fast);
}

.nav-link:hover, .nav-link.active {
  background: var(--minder-teal-light);
  color: var(--primary) !important;
}

/* Dropdown styling */
.dropdown-menu {
  background: #ffffff !important;
  border-radius: var(--radius-md);
  border: 1px solid var(--hairline);
  box-shadow: var(--shadow-lg);
  padding: 0.5rem;
}

.dropdown-item {
  border-radius: var(--radius-sm);
  padding: 0.5rem 1rem;
  font-weight: 600;
  color: var(--minder-slate);
  transition: var(--transition-fast);
}

.dropdown-item:hover, .dropdown-item:focus {
  background-color: var(--minder-teal-light);
  color: var(--primary);
}

.dropdown-item.active {
  background-color: var(--primary) !important;
  color: var(--white) !important;
}

/* Header buttons */
.btn-light {
  background-color: var(--surface-muted);
  border: 1px solid var(--hairline);
  color: var(--dark);
}

.btn-light:hover {
  background-color: #e2e8f0;
  color: var(--dark);
}

/* Slick Cards - Architectural Rework for Localization Safety */
.card {
  background: var(--white);
  border: 1px solid var(--hairline) !important;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  transition: var(--transition-base);
  display: flex;
  flex-direction: column;
  min-height: 0; /* Prevents cards from forcing parent overflow */
  flex: 1 1 auto; /* Allows card to stretch within flex/grid parents */
  overflow: hidden;
}

.card-body {
    flex: 1 1 auto; /* Grow to fill space, pushing footer down */
    display: flex;
    flex-direction: column;
    padding: 1.5rem;
}

.card-body.text-center {
    align-items: center;
}

.card-footer {
    background: transparent;
    border-top: 1px solid var(--hairline);
    padding: 1.25rem 1.5rem;
    margin-top: auto; /* Force to bottom regardless of body content */
}

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

.card-header {
  background: #f8fafc;
  border-bottom: 1px solid var(--hairline);
  padding: 1.25rem 1.5rem;
  font-weight: 800;
  color: var(--dark);
}

/* Holistic "Fluid" Grid System */
.grid-stack-safe {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(min(100%, 320px), 1fr));
    gap: 2rem; /* Increased for breathing room */
    align-items: stretch;
}

/* Fix for flex containers with dynamic text */
.d-flex, .flex-column, .flex-row {
    min-width: 0; 
}

.flex-grow-1 {
    min-width: 0;
}

/* Interactive Buttons */
.btn {
  border-radius: var(--radius-md);
  font-weight: 700;
  padding: 0.75rem 1.5rem;
  transition: var(--transition-base);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  cursor: pointer;
  border: 2px solid transparent;
}

/* Global Accessibility & Alignment Fixes */
.badge {
    letter-spacing: 0.02em;
    padding: 0.4em 0.8em;
}

/* Fix for soft-badges readability */
.bg-opacity-10 {
    background-color: rgba(var(--bs-primary-rgb), 0.12) !important; /* Slightly denser for better definition */
}

.card {
    contain: layout; /* Prevent internal text from causing container jank */
}

.btn-primary {
  background-color: var(--primary);
  color: var(--white);
  border-color: var(--primary);
  box-shadow: var(--shadow-sm);
}

.btn-primary:hover {
  background-color: var(--primary-hover);
  border-color: var(--primary-hover);
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}

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

/* =========================================
   ANIMATIONS
   ========================================= */

.animate-fade-in {
  animation: fadeIn 0.5s ease-out;
}

.animate-slide-up {
  animation: slideUp 0.5s ease-out;
}

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

@keyframes slideUp {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}

/* i18n specific spacing adjustments */
[lang="hy"] body, [lang="ru"] body {
  /* Russian and Armenian can be ~20% longer, allow slightly more line height */
  line-height: 1.7;
}

/* Tooltip & Popper custom styling */
.tooltip {
  --bs-tooltip-bg: var(--minder-navy);
  --bs-tooltip-border-radius: var(--radius-sm);
}

/* =========================================
   HOLISTIC LAYERING & STICKY FIX
   ========================================= */

/* Ensure Navbar is ALWAYS on top of everything */
#mainNavbar.navbar.sticky-top {
  z-index: 1050 !important;
}

/* All other sticky elements (sidebars, headers) must be below Navbar */
.sticky-top:not(#mainNavbar) {
  z-index: 1020 !important;
  /* Default top offset for sidebars to prevent them from hitting the very top edge */
  top: 100px;
}

/* Mobile-friendly adjustments for sticky elements */
@media (max-width: 991.98px) {
  .sticky-top:not(#mainNavbar) {
    position: relative !important;
    top: 0 !important;
    z-index: 1 !important;
  }
}

/* Blog Content Styles */
.blog-content h2 {
    font-size: 1.75rem;
    font-weight: 700;
    margin-top: 2rem;
    margin-bottom: 1rem;
    color: var(--dark);
}

.blog-content h3 {
    font-size: 1.4rem;
    font-weight: 600;
    margin-top: 1.5rem;
    margin-bottom: 0.75rem;
    color: var(--minder-navy);
}

.blog-content p {
    margin-bottom: 1.25rem;
}

.blog-content ul, .blog-content ol {
    margin-bottom: 1.25rem;
}

/* Cookie Consent Banner */
.cookie-consent-banner {
    position: fixed;
    bottom: 20px;
    left: 20px;
    right: 20px;
    background: white;
    box-shadow: 0 10px 30px rgba(0,0,0,0.15);
    border: 1px solid var(--hairline);
    border-radius: var(--radius-md);
    padding: 1.5rem;
    z-index: 9999;
    display: none;
    max-width: 500px;
    animation: slideUp 0.5s ease-out;
}

@keyframes slideUp {
    from { transform: translateY(100%); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

@media (min-width: 768px) {
    .cookie-consent-banner {
        left: 30px;
        right: auto;
    }
}

/* =========================================
   GLOBAL MOBILE RESPONSIVENESS FIXES
   ========================================= */

/* Prevent horizontal scroll issues and overflow */
html, body {
    max-width: 100vw;
    overflow-x: hidden;
}

img, video, iframe, canvas {
    max-width: 100%;
}

img:not([height]) {
    height: auto;
}

/* Ensure logos don't scale up uncontrollably on mobile */
.navbar-brand img, .footer img[alt^="Minder"] {
    width: auto !important;
    max-width: 100%;
}

/* Fix dropdown menus escaping viewport on small screens */
.dropdown-menu {
    max-width: 100vw;
    white-space: normal;
    word-wrap: break-word;
}

@media (max-width: 575.98px) {
    .w-100-mobile {
        
        min-width: 0 !important;
    }
    
    /* Ensure navbar dropdowns behave correctly natively */
    .navbar .dropdown-menu {
        position: static !important;
        float: none !important;
        
        border: none !important;
        box-shadow: none !important;
        background: transparent !important;
        padding-left: 1rem;
        padding-right: 1rem;
    }
    
    /* Ensure padding doesn't push elements out of container */
    .container, .container-fluid {
        padding-left: 15px !important;
        padding-right: 15px !important;
        overflow-x: hidden;
    }

    /* Stack elements properly that might be flex-nowrap */
    .d-flex:not(.flex-nowrap) {
        flex-wrap: wrap;
    }

    /* Ensure long text doesn't break layout for text elements only */
    p, h1, h2, h3, h4, h5, h6 {
        word-break: break-word;
        overflow-wrap: break-word;
    }

    /* Prevent iOS auto-zoom on inputs */
    input[type="text"],
    input[type="email"],
    input[type="number"],
    input[type="password"],
    input[type="search"],
    input[type="tel"],
    input[type="url"],
    textarea,
    select,
    .form-control,
    .form-select {
        font-size: 16px !important;
    }

    /* Ensure buttons are clickable and wrap nicely */
    .btn {
        white-space: normal;
        height: auto;
        padding: 0.75rem 1rem;
    }
}

/* =========================================
   CIRCLE INTEGRITY & AVATAR SYSTEM
   ========================================= */

/* Holistic solution for circular elements to prevent ellipses */
.rounded-circle {
    aspect-ratio: 1 / 1 !important;
    display: inline-flex !important; /* Changed from flex to inline-flex for better vertical alignment with text */
    align-items: center !important;
    justify-content: center !important;
    overflow: hidden !important;
    flex-shrink: 0 !important; /* Prevent squeezing in flex containers */
    padding: 0 !important; /* Reset padding to ensure perfect centering of content */
    vertical-align: middle;
}

/* Helper classes for circles that need internal padding without breaking centering */
.circle-p-1 { padding: 0.25rem !important; }
.circle-p-2 { padding: 0.5rem !important; }
.circle-p-3 { padding: 1rem !important; }

/* Ensure images within circular containers cover the area without distortion */
/* We only force 100% if the image is INSIDE a .rounded-circle container */
.rounded-circle > img {
    width: 100% !important;
    height: 100% !important;
    aspect-ratio: 1 / 1 !important;
    object-fit: cover !important;
    margin: 0 !important;
}

/* If the <img> itself has .rounded-circle, we keep aspect-ratio but let width/height attributes work */
img.rounded-circle {
    object-fit: cover !important;
}

/* Fix for letter-based avatars */
.rounded-circle span {
    line-height: 1;
    display: block;
}

/* Hero Section Animation & 3D Stacking */
.hero-card-stack {
    position: relative;
    padding-top: 60px;
    padding-bottom: 60px;
}

.hero-card {
    transition: transform 0.5s ease, box-shadow 0.3s ease;
    width: 90%;
    margin-left: auto;
    margin-right: auto;
}

.hero-card.card-1 {
    transform: rotateY(-15deg) rotateX(5deg) translateZ(-50px) translateX(10%);
    z-index: 1;
}

.hero-card.card-2 {
    transform: rotateY(15deg) rotateX(-5deg) translateZ(50px) translateX(-10%) translateY(-60px);
    z-index: 2;
}

.hero-card:hover {
    transform: rotateY(0) rotateX(0) translateZ(100px) !important;
    z-index: 100;
}

@media (max-width: 991px) {
    .hero-card.card-1, .hero-card.card-2 {
        transform: none !important;
        width: 100%;
        margin-bottom: 20px;
    }
    .hero-card.card-2 {
        margin-top: 0;
        transform: none !important;
    }
}


/* Ensure gradients are visible on dark backgrounds */
.bg-dark .text-gradient, 
.hero-gradient .text-gradient,
.bg-primary .text-gradient {
    background: linear-gradient(135deg, #6edff6 0%, #ffffff 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.text-primary.fw-bold {
    color: var(--primary) !important;
}

.bg-dark .text-primary.fw-bold,
.bg-primary:not([class*="bg-opacity-"]) .text-primary.fw-bold {
    color: #6edff6 !important;
}

/* Fix for distorted SVG and Bootstrap Icons in flex containers */
i[class^="bi-"], i[class*=" bi-"], svg {
    flex-shrink: 0;
}


/* =========================================
   UI/UX ARCHITECTURE CLEANUP - UTILITIES
   ========================================= */

/* Standardized Avatar Sizes */
.avatar-sm { width: 32px !important; height: 32px !important; min-width: 32px !important; min-height: 32px !important; }
.avatar-md { width: 40px !important; height: 40px !important; min-width: 40px !important; min-height: 40px !important; }
.avatar-lg { width: 50px !important; height: 50px !important; min-width: 50px !important; min-height: 50px !important; }
.avatar-xl { width: 64px !important; height: 64px !important; min-width: 64px !important; min-height: 64px !important; }
.avatar-xxl { width: 80px !important; height: 80px !important; min-width: 80px !important; min-height: 80px !important; }
.avatar-xxxl { width: 100px !important; height: 100px !important; min-width: 100px !important; min-height: 100px !important; }
.avatar-huge { width: 120px !important; height: 120px !important; min-width: 120px !important; min-height: 120px !important; }

/* Mobile Alignment Safety Utilities */
@media (max-width: 576px) {
    .mobile-stack {
        flex-direction: column !important;
        align-items: center !important;
        text-align: center !important;
    }
    
    .mobile-px-0 {
        padding-left: 0 !important;
        padding-right: 0 !important;
    }

    .mobile-ms-0 {
        margin-left: 0 !important;
    }

    .btn-mobile-full {
        width: 100% !important;
        margin-bottom: 0.5rem;
    }    
    /* Ensure tables don't force overflow */
    .table-responsive {
        border: 0 !important;
    }
    
    /* Reset margins that are too large for small screens */
    .ms-4, .ps-4 {
        margin-left: 1rem !important;
        padding-left: 0.5rem !important;
    }
}

/* Fix for flex containers with dynamic text */
.d-flex {
    min-width: 0;
}

.flex-grow-1 {
    min-width: 0;
}

/* Professional card layouts */
.rounded-xl {
    border-radius: 1.25rem !important;
}

.card {
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    transition: var(--transition-base);
}

.card:hover {
    box-shadow: var(--shadow-md);
}

/* Ensure interactive list groups have nice hover states */
.list-group-item-action {
    transition: var(--transition-fast);
}

.list-group-item-action:hover {
    background-color: var(--surface-muted) !important;
    transform: translateX(4px);
}

.shadow-xl {
    box-shadow: 0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1) !important;
}

/* Deep Architecture Refactor Utilities */
.sticky-top-offset {
    position: sticky !important;
    top: 100px !important;
    z-index: 1020 !important;
}

.img-h-250 {
    height: 250px !important;
    object-fit: cover !important;
}

.h-220 { height: 220px !important; }
.h-180 { height: 180px !important; }

.max-w-150 { max-width: 150px !important; }
.max-w-200 { max-width: 200px !important; }

.blog-content-text {
    font-size: 1.2rem !important;
    line-height: 1.8 !important;
    font-weight: 450 !important;
    letter-spacing: -0.01em !important;
}

.status-dot {
    width: 10px !important;
    height: 10px !important;
}

/* =========================================
   I18N RESILIENCE REFACTOR
   ========================================= */

/* Global Button & Badge Resilience */
.btn, .badge, .nav-link, .dropdown-item {
    white-space: normal; /* Allow text to wrap if it exceeds width */
    word-break: break-word; /* Break long contiguous strings */
    line-height: 1.3;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem; /* Increased gap for better i18n readability */
}

/* Ensure small buttons still feel balanced with the gap */
.btn-sm, .badge-sm {
    gap: 0.75rem;
    padding-left: 1rem;
    padding-right: 1rem;
}

.max-w-1100 { max-width: 1100px !important; }
.max-w-1200 { max-width: 1200px !important; }


/* Specific overrides for nav and dropdown items to remain block-ish but with flex alignment */
.nav-link, .dropdown-item {
    display: flex; 
    justify-content: flex-start;
}

/* Ensure buttons acting as flex containers safely wrap and space elements */
.btn.d-flex, .badge.d-flex {
    flex-wrap: wrap;
}

/* Enforce icon preservation globally inside buttons and flex containers */
.btn i[class^="bi-"], .btn i[class*=" bi-"], .btn svg,
.badge i[class^="bi-"], .badge i[class*=" bi-"], .badge svg {
    flex-shrink: 0;
    margin-left: 0;
    margin-right: 0;
}


/* =========================================
   UI/UX OVERHAUL FIXES
   ========================================= */

/* 1. Broken Avatar & Profile Components */
.rounded-circle {
    aspect-ratio: 1 / 1 !important;
    border-radius: 50% !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    overflow: hidden !important;
    flex-shrink: 0 !important; 
    padding: 0 !important; 
}

.rounded-circle > img {
    width: 100% !important;
    height: 100% !important;
    object-fit: cover !important;
    margin: 0 !important;
}

.rounded-circle span {
    line-height: 1;
    display: flex;
    justify-content: center;
    align-items: center;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Status Indicator Fix */
.status-indicator, .status-dot {
    position: absolute !important;
    bottom: 0 !important;
    right: 0 !important;
    border: 2px solid var(--white) !important;
    border-radius: 50% !important;
    z-index: 2;
}

/* 2. Stop Vertical Text Wrapping on Buttons & Pills */
.btn, .badge {
    height: auto;
    min-height: 2.4em;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    white-space: nowrap !important; /* Prevent character wrapping */
    text-overflow: ellipsis;
    text-align: center;
}

@media (max-width: 576px) {
    /* Stack action buttons vertically when constrained */
    .btn-group, .d-flex.gap-3 > .btn {
        width: 100% !important;
        flex: 1 1 100%;
        margin-bottom: 0.5rem;
    }
}

/* 3. Center Numbers Inside Circular Badges & Step Indicators */
.step-indicator, .badge-circle, .rounded-circle {
    display: flex !important;
    justify-content: center !important;
    align-items: center !important;
    text-align: center;
}

/* 4. Remove Stray List Markers & Default Browser Artifacts */
ul:not(.blog-content ul):not(.forum-content ul),
ol:not(.blog-content ol):not(.forum-content ol) {
    list-style: none;
    padding-left: 0;
    margin-bottom: 0;
}

/* 5. Correct Icon-to-Text Alignment Across Lists & Empty States */
.icon-list-item, .feature-list li, .list-group-item.d-flex {
    align-items: flex-start !important;
}
.icon-list-item i, .feature-list li i, .list-group-item.d-flex i {
    margin-top: 2px;
}

/* Empty States */
.text-center.py-5, .empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
}
.text-center.py-5 i {
    margin-bottom: 1rem;
}

/* 6. Cleanup Spacing, Padding & Layout Consistency */
.dropdown-item {
    padding: 10px 14px !important;
}

/* 7. Improve Scheduling & Booking Card Structure */
.booking-card {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: center;
    gap: 1.5rem;
    padding: 1.5rem;
}

.booking-card-info {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    flex: 1 1 auto;
    min-width: 250px;
}

.booking-card-actions {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
    justify-content: flex-end;
    flex: 0 0 auto;
}

@media (max-width: 768px) {
    .booking-card-actions {
        width: 100%;
        justify-content: flex-start;
    }
    .booking-card-actions .btn {
        width: 100%;
    }
}

/* 8. Notification Badge Alignment */
#notificationBadge {
    position: absolute !important;
    top: -4px !important;
    right: -4px !important;
    left: auto !important;
    transform: scale(0.8) !important;
    margin: 0 !important;
    border: 2px solid white !important;
    border-radius: 50% !important;
    z-index: 2;
}


/* UI OVERHAUL CONTINUED */
.action-pill {
    display: inline-flex;
    flex-direction: row;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 16px;
    border-radius: 50px;
    white-space: nowrap !important;
}

.clinical-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 8px 16px;
    width: auto;
    max-width: 100%;
    border-radius: 50px;
    text-align: center;
    box-sizing: border-box;
    white-space: normal !important;
}

.text-reason {
    min-width: 200px;
    word-wrap: normal;
    white-space: normal !important;
}


/* --- FINAL VISUAL INTEGRITY PATCH --- */

/* 1. Universal Background Consistency (Default to White) */
.card:not([class*="bg-"]), .b-card:not([class*="bg-"]), .dashboard-content .card:not([class*="bg-"]), .post-card:not([class*="bg-"]), .stage-card:not([class*="bg-"]), .modal-content:not([class*="bg-"]) {
    background-color: #ffffff !important;
    background: #ffffff !important;
    border: 1px solid rgba(0,0,0,0.08) !important;
}

/* Allow bg-* classes to work on cards */
.card[class*="bg-"], .b-card[class*="bg-"] {
    background-color: inherit !important;
    background: inherit !important;
