/* ============================================
   CLINIRED MÉXICO - Estilos Personalizados
   ============================================ */

/* === Variables CSS === */
:root {
    --primary: #137fec;
    --primary-dark: #0e62b8;
    --primary-light: #e8f2fd;
    --background-light: #f6f7f8;
    --background-dark: #101922;
    --text-dark: #111418;
    --text-light: #ffffff;
    --gray-50: #f9fafb;
    --gray-100: #f3f4f6;
    --gray-200: #e5e7eb;
    --gray-300: #d1d5db;
    --gray-400: #9ca3af;
    --gray-500: #6b7280;
    --gray-600: #4b5563;
    --gray-700: #374151;
    --gray-800: #1f2937;
    --gray-900: #111827;
    --success: #10b981;
    --warning: #f59e0b;
    --error: #ef4444;
    --info: #3b82f6;
    --border-radius: 0.5rem;
    --border-radius-lg: 0.75rem;
    --border-radius-xl: 1rem;
    --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);
    --transition-fast: 150ms ease;
    --transition-normal: 300ms ease;
    --transition-slow: 500ms ease;
}

/* === Reset & Base === */
*, *::before, *::after {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
    -webkit-text-size-adjust: 100%;
}

body {
    margin: 0;
    padding: 0;
    overflow-x: hidden;
}

img {
    max-width: 100%;
    height: auto;
    display: block;
}

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

/* === Animations === */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

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

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

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

@keyframes slideInRight {
    from {
        opacity: 0;
        transform: translateX(30px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes pulse-soft {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.7; }
}

@keyframes float {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-6px); }
}

.animate-fade-in { animation: fadeIn 0.6s ease-out; }
.animate-fade-in-up { animation: fadeInUp 0.6s ease-out; }
.animate-fade-in-down { animation: fadeInDown 0.6s ease-out; }
.animate-slide-in-left { animation: slideInLeft 0.6s ease-out; }
.animate-slide-in-right { animation: slideInRight 0.6s ease-out; }
.animate-float { animation: float 3s ease-in-out infinite; }

/* Stagger children animations */
.stagger-children > *:nth-child(1) { animation-delay: 0.05s; }
.stagger-children > *:nth-child(2) { animation-delay: 0.1s; }
.stagger-children > *:nth-child(3) { animation-delay: 0.15s; }
.stagger-children > *:nth-child(4) { animation-delay: 0.2s; }
.stagger-children > *:nth-child(5) { animation-delay: 0.25s; }
.stagger-children > *:nth-child(6) { animation-delay: 0.3s; }
.stagger-children > *:nth-child(7) { animation-delay: 0.35s; }
.stagger-children > *:nth-child(8) { animation-delay: 0.4s; }
.stagger-children > *:nth-child(9) { animation-delay: 0.45s; }
.stagger-children > *:nth-child(10) { animation-delay: 0.5s; }
.stagger-children > *:nth-child(11) { animation-delay: 0.55s; }
.stagger-children > *:nth-child(12) { animation-delay: 0.6s; }

/* === Scroll reveal (via IntersectionObserver in JS) === */
.reveal {
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 0.7s ease, transform 0.7s ease;
}

.reveal.revealed {
    opacity: 1;
    transform: translateY(0);
}

/* === Mobile Navigation === */
.mobile-nav-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 90;
    opacity: 0;
    pointer-events: none;
    transition: opacity var(--transition-normal);
}

.mobile-nav-overlay.active {
    opacity: 1;
    pointer-events: auto;
}

.mobile-nav {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    width: 300px;
    max-width: 85vw;
    background: white;
    z-index: 100;
    transform: translateX(100%);
    transition: transform var(--transition-normal);
    overflow-y: auto;
    box-shadow: var(--shadow-xl);
}

.dark .mobile-nav {
    background: var(--background-dark);
}

.mobile-nav.active {
    transform: translateX(0);
}

.mobile-nav a {
    display: block;
    padding: 1rem 1.5rem;
    font-weight: 600;
    font-size: 0.95rem;
    border-bottom: 1px solid var(--gray-100);
    transition: background var(--transition-fast), color var(--transition-fast);
}

.dark .mobile-nav a {
    border-bottom-color: var(--gray-800);
}

.mobile-nav a:hover {
    background: rgba(17, 20, 24, 0.05);
    color: #111418;
}

.dark .mobile-nav a:hover {
    background: rgba(255, 255, 255, 0.05);
    color: #ffffff;
}

/* === Hamburger Button === */
.hamburger {
    display: none;
    flex-direction: column;
    gap: 5px;
    cursor: pointer;
    padding: 8px;
    z-index: 110;
}

.hamburger span {
    display: block;
    width: 24px;
    height: 2px;
    background: var(--text-dark);
    border-radius: 2px;
    transition: all var(--transition-normal);
}

.dark .hamburger span {
    background: var(--text-light);
}

.hamburger.active span:nth-child(1) {
    transform: rotate(45deg) translateY(5px) translateX(5px);
}

.hamburger.active span:nth-child(2) {
    opacity: 0;
}

.hamburger.active span:nth-child(3) {
    transform: rotate(-45deg) translateY(-5px) translateX(5px);
}

@media (max-width: 768px) {
    .hamburger {
        display: flex;
    }
}

/* === Desktop Navigation Dropdown === */
.nav-dropdown {
    position: relative;
}

.nav-dropdown-toggle {
    background: none;
    border: none;
    cursor: pointer;
    padding: 0;
    font-family: inherit;
    color: inherit;
}

.nav-dropdown-menu {
    min-width: 220px;
    z-index: 1000;
}

.nav-dropdown:hover .nav-dropdown-menu,
.nav-dropdown.active .nav-dropdown-menu {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.nav-dropdown-menu {
    transform: translateY(-10px);
}

.nav-dropdown-toggle .material-symbols-outlined {
    transition: transform 0.2s ease;
}

.nav-dropdown:hover .nav-dropdown-toggle .material-symbols-outlined,
.nav-dropdown.active .nav-dropdown-toggle .material-symbols-outlined {
    transform: rotate(180deg);
}

/* === Mobile Navigation Dropdown === */
.mobile-nav-dropdown-toggle {
    background: none;
    border: none;
    color: inherit;
    font-family: inherit;
}

.mobile-nav-dropdown-toggle .material-symbols-outlined {
    transition: transform 0.2s ease;
}

.mobile-nav-dropdown.active .mobile-nav-dropdown-toggle .material-symbols-outlined {
    transform: rotate(180deg);
}

.mobile-nav-dropdown-content {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
}

.mobile-nav-dropdown.active .mobile-nav-dropdown-content {
    max-height: 500px;
}

.mobile-nav-dropdown-content.hidden {
    display: block;
}

@media (max-width: 768px) {
    .hamburger {
        display: flex;
    }
}

/* === Hero Section === */
.hero-gradient {
    background: linear-gradient(rgba(0, 30, 60, 0.6), rgba(0, 30, 60, 0.7));
}

.hero-search-bar {
    backdrop-filter: blur(10px);
}

/* === Clinic Cards === */
.clinic-card {
    transition: transform var(--transition-normal), box-shadow var(--transition-normal);
}

.clinic-card:hover {
    transform: translateY(-4px);
}

/* === Category Grid Items === */
.category-item {
    transition: all var(--transition-normal);
}

.category-item:hover {
    transform: translateY(-4px);
}

/* === Star Rating === */
.star-rating {
    display: inline-flex;
    gap: 2px;
}

.star-rating .material-symbols-outlined {
    font-size: 18px;
    color: #fbbf24;
    font-variation-settings: 'FILL' 1;
}

.star-rating .material-symbols-outlined.empty {
    color: var(--gray-300);
    font-variation-settings: 'FILL' 0;
}

/* === Breadcrumbs === */
.breadcrumbs {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.875rem;
    color: var(--gray-500);
    flex-wrap: wrap;
}

:where(.breadcrumbs) a {
    color: var(--gray-500);
    transition: color var(--transition-fast);
}

:where(.breadcrumbs) a:hover {
    color: var(--primary);
}

:where(.breadcrumbs) .separator {
    color: var(--gray-300);
    font-size: 0.75rem;
}

:where(.breadcrumbs) .current {
    color: var(--text-dark);
    font-weight: 600;
}

:where(.dark .breadcrumbs) .current {
    color: var(--text-light);
}

/* === Badge === */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 10px;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 600;
    line-height: 1.5;
}

.badge-primary {
    background: var(--primary-light);
    color: var(--primary);
}

.badge-success {
    background: #d1fae5;
    color: #059669;
}

.badge-warning {
    background: #fef3c7;
    color: #d97706;
}

.badge-error {
    background: #fee2e2;
    color: #dc2626;
}

/* === Back to top button === */
.back-to-top {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: var(--primary);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    opacity: 0;
    pointer-events: none;
    transform: translateY(10px);
    transition: all var(--transition-normal);
    box-shadow: var(--shadow-lg);
    z-index: 50;
    border: none;
}

.back-to-top.visible {
    opacity: 1;
    pointer-events: auto;
    transform: translateY(0);
}

.back-to-top:hover {
    background: var(--primary-dark);
    transform: translateY(-2px);
}

/* === Loading skeleton === */
.skeleton {
    background: linear-gradient(90deg, var(--gray-200) 25%, var(--gray-100) 50%, var(--gray-200) 75%);
    background-size: 200% 100%;
    animation: skeleton-loading 1.5s infinite;
    border-radius: var(--border-radius);
}

@keyframes skeleton-loading {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* === Toast notifications === */
.toast-container {
    position: fixed;
    top: 1rem;
    right: 1rem;
    z-index: 200;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.toast {
    padding: 1rem 1.5rem;
    border-radius: var(--border-radius);
    background: white;
    box-shadow: var(--shadow-lg);
    display: flex;
    align-items: center;
    gap: 0.75rem;
    animation: slideInRight 0.3s ease-out;
    max-width: 400px;
    font-size: 0.875rem;
    font-weight: 500;
    border-left: 4px solid var(--primary);
}

/* === Print Styles === */
@media print {
    header, footer, .back-to-top, .mobile-nav, .mobile-nav-overlay {
        display: none !important;
    }

    body {
        font-size: 12pt;
        color: #000;
        background: #fff;
    }

    a {
        color: #000;
    }

    .no-print {
        display: none !important;
    }
}

/* === Focus styles for accessibility === */
a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}

/* === Custom scrollbar === */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: var(--gray-100);
}

::-webkit-scrollbar-thumb {
    background: var(--gray-300);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--gray-400);
}

/* === Navbar & Mobile Nav: Fixed to #111418 regardless of route theme === */
header .text-primary,
#mobile-nav .text-primary {
    color: #111418 !important;
}
.dark header .text-primary,
.dark #mobile-nav .text-primary {
    color: #ffffff !important;
}
header .hover\:text-primary:hover {
    color: rgba(17, 20, 24, 0.6) !important;
}
.dark header .hover\:text-primary:hover {
    color: rgba(255, 255, 255, 0.7) !important;
}
header .bg-primary,
#mobile-nav .bg-primary {
    background-color: #111418 !important;
}
.dark header .bg-primary,
.dark #mobile-nav .bg-primary {
    background-color: #ffffff !important;
    color: #111418 !important;
}
header .hover\:bg-primary-dark:hover,
#mobile-nav .hover\:bg-primary-dark:hover {
    background-color: rgba(17, 20, 24, 0.85) !important;
}
.dark header .hover\:bg-primary-dark:hover,
.dark #mobile-nav .hover\:bg-primary-dark:hover {
    background-color: rgba(255, 255, 255, 0.85) !important;
    color: #111418 !important;
}
header .bg-primary\/10 {
    background-color: rgba(17, 20, 24, 0.1) !important;
}
.dark header .bg-primary\/10 {
    background-color: rgba(255, 255, 255, 0.1) !important;
}
header .shadow-primary\/30 {
    --tw-shadow-color: rgba(17, 20, 24, 0.15) !important;
}

/* === SEO-friendly visually hidden class === */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border-width: 0;
}

/* === CTA Banner === */
.cta-banner {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    position: relative;
    overflow: hidden;
}

.cta-banner::before {
    content: '';
    position: absolute;
    top: -50%;
    right: -20%;
    width: 400px;
    height: 400px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.05);
}

.cta-banner::after {
    content: '';
    position: absolute;
    bottom: -30%;
    left: -10%;
    width: 300px;
    height: 300px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.03);
}

/* === Testimonials === */
.testimonial-card {
    position: relative;
}

.testimonial-card::before {
    content: '"';
    position: absolute;
    top: -10px;
    left: 20px;
    font-size: 5rem;
    color: var(--primary);
    opacity: 0.1;
    font-family: Georgia, serif;
    line-height: 1;
}

/* === FAQ Accordion === */
.faq-item {
    border-bottom: 1px solid var(--gray-200);
}

.faq-question {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1.25rem 0;
    cursor: pointer;
    font-weight: 600;
    font-size: 1rem;
    transition: color var(--transition-fast);
    background: none;
    border: none;
    width: 100%;
    text-align: left;
    color: inherit;
}

.faq-question:hover {
    color: var(--primary);
}

.faq-question .material-symbols-outlined {
    transition: transform var(--transition-normal);
    font-size: 1.25rem;
    color: var(--gray-400);
}

.faq-item.active .faq-question .material-symbols-outlined {
    transform: rotate(180deg);
    color: var(--primary);
}

.faq-answer {
    max-height: 0;
    overflow: hidden;
    transition: max-height var(--transition-normal), padding var(--transition-normal);
    color: var(--gray-600);
    font-size: 0.95rem;
    line-height: 1.7;
}

.faq-item.active .faq-answer {
    max-height: 500px;
    padding-bottom: 1.25rem;
}
