:root {
    --primary-color: #ffffff;
    --primary-dark: #f4f6f8;
    --primary-light: #fbfcfd;
    --secondary-color: #ffb400; /* refined accent (slightly warmer) */
    --logo-claro: #ffd300;
    --logo-dark: #111111;
    --success-color: #28a745;
    --danger-color: #dc3545;
    --warning-color: #ffc107;
    --dark-color: #2f353b; /* slightly cooler dark */
    --light-color: #f8f9fa;
    --text-color: #222; /* darker for better contrast */
    --border-radius: 12px;
    --border-radius-sm: 8px;
    --box-shadow: 0 2px 12px rgba(0,0,0,0.08);
    --box-shadow-hover: 0 8px 24px rgba(0,0,0,0.12);
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    /* Desplazamiento horizontal aplicado al menú (positivo = mueve el menú a la derecha en desktop) */
    --nav-menu-shift: 48px;
     /* Desplazamiento horizontal adicional aplicado a cada enlace <a> dentro del menú en desktop
         Esto empuja el contenido de los enlaces ligeramente a la derecha sin cambiar la estructura. */
     --nav-link-shift: 8px;
     /* Logo sizing variables (include units) */
     --logo-min: 36px;
     --logo-preferred: 5vw;
     --logo-max: 96px;
    /* Space reserved on the left for the logo at large sizes */
    --logo-space: 240px;
/* end of file adjustments */
}

/* Skip link visible on focus */
.skip-link:focus {
    position: static !important;
    width: auto !important;
    height: auto !important;
    left: 0 !important;
    top: 0 !important;
    background: var(--secondary-color);
    color: #000;
    padding: 0.5rem 1rem;
    z-index: 1200;
}

/* ============ SISTEMA DE NOTIFICACIONES TOAST ============ */
#toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 10000;
    display: flex;
    flex-direction: column;
    gap: 12px;
    max-width: 400px;
}

.toast {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 16px;
    background: white;
    border-radius: var(--border-radius-sm);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    opacity: 0;
    transform: translateX(400px);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    min-width: 320px;
    border-left: 4px solid #6c757d;
}

.toast.show {
    opacity: 1;
    transform: translateX(0);
}

.toast-icon {
    font-size: 24px;
    font-weight: bold;
    line-height: 1;
    flex-shrink: 0;
}

.toast-message {
    flex: 1;
    font-size: 14px;
    line-height: 1.5;
    color: #333;
    word-wrap: break-word;
}

.toast-close {
    background: none;
    border: none;
    font-size: 24px;
    line-height: 1;
    color: #999;
    cursor: pointer;
    padding: 0;
    width: 24px;
    height: 24px;
    flex-shrink: 0;
    transition: color 0.2s ease;
}

.toast-close:hover {
    color: #333;
}

/* Toast Success */
.toast-success {
    border-left-color: var(--success-color);
}

.toast-success .toast-icon {
    color: var(--success-color);
}

/* Toast Error */
.toast-error {
    border-left-color: var(--danger-color);
}

.toast-error .toast-icon {
    color: var(--danger-color);
}

/* Toast Warning */
.toast-warning {
    border-left-color: var(--warning-color);
}

.toast-warning .toast-icon {
    color: var(--warning-color);
}

/* Toast Info */
.toast-info {
    border-left-color: #17a2b8;
}

.toast-info .toast-icon {
    color: #17a2b8;
}

/* Toast Question/Confirm */
.toast-question {
    border-left-color: var(--secondary-color);
    flex-direction: column;
    gap: 12px;
}

.toast-question .toast-icon {
    color: var(--secondary-color);
}

.toast-question .toast-message {
    padding-right: 0;
}

.toast-actions {
    display: flex;
    gap: 8px;
    width: 100%;
    margin-top: 8px;
}

.toast-btn {
    flex: 1;
    padding: 8px 16px;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.toast-btn-confirm {
    background: var(--secondary-color);
    color: #000;
}

.toast-btn-confirm:hover {
    background: #e6a200;
    transform: translateY(-1px);
}

.toast-btn-cancel {
    background: #6c757d;
    color: white;
}

.toast-btn-cancel:hover {
    background: #5a6268;
    transform: translateY(-1px);
}

/* Dark Theme */
body.dark-theme .toast {
    background: #2a2a3e;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
}

body.dark-theme .toast-message {
    color: #e0e0e0;
}

body.dark-theme .toast-close {
    color: #999;
}

body.dark-theme .toast-close:hover {
    color: #e0e0e0;
}

/* Responsive */
@media (max-width: 768px) {
    #toast-container {
        top: 10px;
        right: 10px;
        left: 10px;
        max-width: none;
    }

    .toast {
        min-width: auto;
        width: 100%;
    }
}

/* Tema Oscuro */
body.dark-theme {
    --primary-color: #3D3C3B; /* slightly lighter dark as requested */
    --primary-dark: #343332;
    --primary-light: #4a4948;
    --secondary-color: #ffb400; /* keep accent visible in dark */
    --text-color: #f3f4f6;
    --light-color: #222427;
    --box-shadow: 0 2px 12px rgba(0,0,0,0.45);
    --box-shadow-hover: 0 8px 24px rgba(0,0,0,0.55);
    background-color: var(--primary-color);
    color: var(--text-color);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: var(--font-family);
    line-height: 1.6;
    color: var(--text-color);
    background-color: var(--primary-color);
    transition: var(--transition);
}

/* Ensure theme toggle SVG uses a dark icon color so sun/moon remain visible */
#themeToggle svg {
    color: var(--logo-dark);
    fill: currentColor;
    stroke: currentColor;
}

/* Theme toggle styles for main navbar (harmonize with admin mobile icons) */
.theme-mini {
    display: inline-flex;
    align-items: center;
}
.theme-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    border-radius: 8px;
    border: 1px solid rgba(0,0,0,0.06);
    background: transparent;
    padding: 0;
    cursor: pointer;
    color: var(--logo-dark);
}
.theme-toggle svg {
    width: 20px;
    height: 20px;
    display: block;
}

/* Hover/focus affordance */
.theme-toggle:hover,
.theme-toggle:focus {
    background: rgba(0,0,0,0.04);
    outline: none;
}

/* Dark theme: keep the icon visible; JS will force an explicit color when needed but this provides base styling */
body.dark-theme .theme-toggle {
    color: var(--logo-dark);
    border-color: rgba(255,255,255,0.06);
}

@media (max-width: 900px) {
    .theme-toggle { width: 36px; height: 36px; border-radius: 6px; }
}

/* Make layout a column so footer with `margin-top: auto` sticks to bottom
   even when page content is short. `main` will grow to fill available space. */
html, body {
    height: 100%;
}
body {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

main {
    flex: 1 0 auto;
}
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

/* ==================== NAVBAR ==================== */
.navbar {
    background-color: var(--primary-color);
    box-shadow: var(--box-shadow);
    padding: 1rem 0;
    position: sticky;
    top: 0;
    z-index: 1000;
    transition: var(--transition);
}

.navbar.scrolled {
    box-shadow: 0 4px 20px rgba(0,0,0,0.1);
}

    .navbar .container {
    display: flex;
    justify-content: flex-start;
    align-items: center;
    position: relative;
    gap: 1rem;
    max-width: 100%;
    width: 100%;
}

/* Controles del header (modo oscuro + hamburguesa) */
.header-controls {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}
.logo {
    display: inline-flex;
    align-items: center;
    gap: 0.6rem;
    text-decoration: none;
    cursor: pointer;
}

.logo img.logo-img {
    display: block;
    /* Controlled by CSS variables so size can be tuned without editing multiple places */
    height: clamp(var(--logo-min), var(--logo-preferred), var(--logo-max));
    width: auto;
    object-fit: contain;
    background: transparent;
}

.logo img.logo-secondary {
    height: clamp(20px, 3.5vw, 34px);
    opacity: 0.95;
}

/* fallback: if images not available keep textual appearance */
.logo:not(:has(img)) {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--logo-dark);
    transition: var(--transition);
}

body.dark-theme .logo:not(:has(img)) {
    color: var(--text-color);
}

.nav-menu {
    display: flex;
    list-style: none;
    gap: 1.25rem;
    align-items: center;
    flex-wrap: nowrap;
    justify-content: center;
}


.nav-menu a {
    text-decoration: none;
    color: var(--text-color);
    font-weight: 500;
    position: relative;
    padding: 0.5rem 0.25rem;
    font-size: 0.95rem;
    white-space: nowrap;
}

/* Logo container at same level as navbar */
.logo-container {
    display: inline-flex;
    align-items: center;
    margin-right: 0.75rem;
}
.logo-container .logo-img {
    height: clamp(36px, 4.5vw, 72px);
    width: auto;
    display: block;
}

/* Header row when logo is placed to the left of the navbar */
.header-row {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

/* If a `.container` is used inside the `nav` (as in `includes/navbar.php`),
   remove its horizontal padding so the nav aligns exactly with the outer
   `.header-row.container` and with other `.container`-based content. */
.header-row > nav > .container {
    padding-left: 0;
    padding-right: 0;
    max-width: 100%;
}

/* Left-side logo container sits at the same vertical height as the navbar */
.left-logo-container {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    padding-inline-end: 12px;
}

/* Force the navbar to take remaining space when inside .header-row */
.header-row .navbar {
    flex: 1 1 auto;
}

/* Ensure the nav-inner container aligns controls to the right (inside navbar) */
.nav-inner {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 1rem;
}

/* Make navbar a flex row so the nav menu can be centered between logo and controls */
.header-row .navbar {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.header-row .navbar > .nav-menu {
    margin-left: auto;
    margin-right: auto;
}

/* Page-specific header alignment: ensure the header/nav aligns with
   the main `.container` on the `zonas-termicas` page. This overrides
   the centering so the menu starts at the same left margin as content. */
body.zonas-termicas .header-row {
    max-width: 1200px;
    margin: 0 auto;
    padding-left: 20px;
    padding-right: 20px;
}

body.zonas-termicas .header-row > nav > .container {
    padding-left: 0;
    padding-right: 0;
    width: 100%;
}

body.zonas-termicas .header-row .nav-menu {
    margin-left: 0;
    margin-right: 0;
    justify-content: flex-start;
}

body.zonas-termicas .header-row .left-logo-container {
    flex: 0 0 auto;
}

/* Prefer to align the actual `.header-row.container` to the page container
   so the header's left edge matches other page content exactly. This
   targets the element that already has both classes in the markup. */
body.zonas-termicas .header-row.container {
    box-sizing: border-box;
    max-width: 1200px;
    margin: 0 auto;
    padding-left: 20px; /* same as .container padding */
    padding-right: 20px;
}

/* Ensure the nested .container inside the nav does not add additional
   horizontal padding that would shift the menu relative to the outer
   header-row.container. */
body.zonas-termicas .header-row.container > nav > .container {
    padding-left: 0;
    padding-right: 0;
}

/* Keep menu left-aligned inside the header-row container */
body.zonas-termicas .header-row.container .nav-menu {
    margin-left: 0;
    margin-right: 0;
    justify-content: flex-start;
}

/* Preferred desktop size for the logo the user liked (85x50) */
.left-logo-container .logo-img {
    /* Larger header logo for top area (increased as requested) */
    width: 220px;
    height: 132px;
    max-width: 220px;
    max-height: 132px;
    object-fit: contain;
    display: block;
}

/* Scale the logo down on smaller screens so the header remains tidy */
@media (max-width: 900px) {
    .left-logo-container .logo-img {
        /* Mobile scaling: slightly larger min/max to keep logo prominent */
        height: clamp(56px, 10vw, 110px);
        width: auto;
    }
    .header-row {
        gap: 0.5rem;
    }
}

/* Small theme control grouped in header controls */
.theme-mini {
    display: inline-flex;
    align-items: center;
    margin-right: 0.5rem;
}
.theme-mini .theme-toggle {
    background: transparent;
    border: none;
    font-size: 1.05rem;
    padding: 6px 8px;
    cursor: pointer;
}

.nav-menu a::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 0;
    height: 2px;
    background: var(--secondary-color);
    transition: var(--transition);
}

.nav-menu a:hover::after,
.nav-menu a.active::after {
    width: 100%;
}

.nav-menu a:hover,
.nav-menu a.active {
    color: var(--secondary-color);
}

.btn-login {
    background: var(--secondary-color);
    color: var(--text-color) !important;
    padding: 0.5rem 1.25rem;
    border-radius: 25px;
    box-shadow: 0 4px 15px rgba(255,211,0,0.3);
    transition: var(--transition);
    font-weight: 600;
    font-size: 0.9rem;
}

.btn-login:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(255,211,0,0.4);
    opacity: 0.9;
}

body.dark-theme .btn-login {
    background: var(--secondary-color);
    color: #000000 !important;
}

.btn-login::after {
    display: none;
}

/* Admin panel button in the navbar */
.nav-admin-btn {
    background: #FA8C4F;
    color: #fff;
    padding: 0.5rem 1rem;
    border-radius: 25px;
    font-weight: 600;
    box-shadow: 0 6px 18px rgba(0,0,0,0.12);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.9rem;
}
.nav-admin-btn:hover {
    background: #e77035;
    transform: translateY(-2px);
}

/* Mobile menu base (defined later in "Responsive Header Completo") */

/* ==================== BUTTONS ==================== */
.btn-primary,
.btn-secondary {
    padding: 0.85rem 2rem;
    border: none;
    border-radius: 25px;
    cursor: pointer;
    font-size: 1rem;
    font-weight: 600;
    transition: var(--transition);
    text-decoration: none;
    display: inline-block;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
}

.btn-primary {
    background: var(--secondary-color);
    color: #000000;
    font-weight: 600;
}

.btn-primary:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 20px rgba(255,211,0,0.3);
    opacity: 0.9;
}

body.dark-theme .btn-primary {
    background: var(--secondary-color);
    color: #000000;
}

.btn-secondary {
    background: var(--primary-color);
    color: var(--text-color);
    border: 2px solid var(--secondary-color);
}

.btn-secondary:hover {
    background: var(--secondary-color);
    color: var(--text-color);
    transform: translateY(-3px);
}

body.dark-theme .btn-secondary {
    background: var(--primary-color);
    color: #ffffff;
    border-color: var(--secondary-color);
}

body.dark-theme .btn-secondary:hover {
    background: var(--secondary-color);
    color: #ffffff;
}

/* ==================== HERO SECTION ==================== */
.hero {
    background: linear-gradient(135deg, #ffffff 0%, #ffd300 80%);
    color: white;
    /* Reduce top padding so header and hero are closer */
    padding: 6rem 0 4rem;
    text-align: center;
    position: relative;
    overflow: hidden;
}

.hero::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: url('data:image/svg+xml,<svg width="100" height="100" xmlns="http://www.w3.org/2000/svg"><rect fill="rgba(255,255,255,0.05)" width="50" height="50"/></svg>');
    opacity: 0.1;
}

.hero .container {
    position: relative;
    z-index: 1;
}

.hero h1 {
    font-size: clamp(2.5rem, 5vw, 4rem);
    margin-bottom: 1.5rem;
    font-weight: 800;
    text-shadow: 0 4px 20px rgba(0,0,0,0.2);
    animation: fadeInUp 0.8s ease-out;
}

/* Make the main page H1 explicitly black for better contrast */
body.home .hero h1 {
    color: #000000;
}

/* Make the main page hero paragraph black in light mode, and readable in dark */
body.home .hero p {
    color: #000000;
}

/* If dark theme is active on the same page, use the theme text color */
/* Force hero paragraph to black even in dark theme as requested */
body.dark-theme.home .hero p,
body.home.dark-theme .hero p {
    color: #000000 !important;
}

.hero p {
    font-size: clamp(1.1rem, 2vw, 1.4rem);
    margin-bottom: 2.5rem;
    opacity: 0.95;
    animation: fadeInUp 0.8s ease-out 0.2s backwards;
}

.hero .btn-primary,
.hero .btn-secondary {
    margin: 0 0.75rem 1rem;
    animation: fadeInUp 0.8s ease-out 0.4s backwards;
}

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

/* ==================== FEATURES ==================== */
.features {
    padding: 6rem 0;
    background-color: var(--primary-color);
}

.features h2 {
    text-align: center;
    font-size: clamp(2rem, 4vw, 2.5rem);
    margin-bottom: 4rem;
    color: var(--text-color);
    font-weight: 700;
}

/* CTA section styled to use the site's yellow accent */
.cta-section {
    background: linear-gradient(135deg, var(--secondary-color) 0%, #ffd85a 100%);
    padding: 4rem 0;
    margin-top: 4rem;
    color: #000;
}
.cta-section .cta-inner {
    text-align: center;
    color: #111;
}
.cta-section .cta-title {
    margin-bottom: 1rem;
    font-size: 2rem;
    color: #000;
}
.cta-section .cta-copy {
    font-size: 1.2rem;
    margin-bottom: 2rem;
    opacity: 0.95;
    color: rgba(0,0,0,0.85);
}
.cta-section .cta-cta {
    background: #ffffff;
    color: var(--secondary-color);
    box-shadow: 0 6px 18px rgba(0,0,0,0.12);
}

/* Improve feature cards visual in light mode */
/* Refined feature-card styling for light theme: stronger borders, layered shadows and divider */
body:not(.dark-theme) .feature-card {
    background: #ffffff;
    border: 1px solid #e9ecef; /* use the site's gray used elsewhere for clearer definition */
    box-shadow: 0 8px 24px rgba(16,24,40,0.06), 0 2px 8px rgba(16,24,40,0.04);
    transition: transform 0.22s cubic-bezier(.2,.9,.2,1), box-shadow 0.22s ease, border-color 0.22s ease;
    padding: 2.2rem; /* slightly tighter padding */
}

body:not(.dark-theme) .feature-card::after {
    /* subtle internal divider at bottom to separate content if needed */
    content: '';
    display: block;
    height: 1px;
    background: linear-gradient(90deg, rgba(0,0,0,0.03), #e9ecef, rgba(0,0,0,0.03));
    margin-top: 1.4rem;
    border-radius: 2px;
    opacity: 0.95;
}

body:not(.dark-theme) .feature-card h3 {
    color: #071226;
    font-weight: 700;
    margin-bottom: 0.75rem;
}

body:not(.dark-theme) .feature-card p {
    color: rgba(7,18,38,0.78);
    line-height: 1.75;
}

body:not(.dark-theme) .feature-card:hover {
    transform: translateY(-10px) scale(1.01);
    box-shadow: 0 22px 48px rgba(16,24,40,0.12), 0 8px 20px rgba(16,24,40,0.06);
    border-color: rgba(16,24,40,0.12);
}

/* Slightly increase rounded corners on cards for a modern aesthetic */
body:not(.dark-theme) .feature-card {
    border-radius: 14px;
}


.features-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 2rem;
}


/* Base feature-card (kept minimal) */
.feature-card {
    background: var(--primary-light);
    padding: 2.4rem;
    border-radius: 12px;
    text-align: center;
    transition: var(--transition);
    border: 1px solid transparent;
    box-shadow: none;
}

/* Stronger/light-mode specific visuals placed here to ensure they override earlier definitions */
body:not(.dark-theme) .features .feature-card,
body:not(.dark-theme) .feature-card {
    background: #ffffff;
    border: 1px solid #e9ecef; /* clear gray border used across site */
    box-shadow: 0 10px 30px rgba(16,24,40,0.06), 0 4px 10px rgba(16,24,40,0.04);
    padding: 2.2rem;
    border-radius: 14px;
}

body:not(.dark-theme) .features .feature-card::after,
body:not(.dark-theme) .feature-card::after {
    content: '';
    display: block;
    height: 1px;
    background: linear-gradient(90deg, rgba(0,0,0,0.03), #e9ecef, rgba(0,0,0,0.03));
    margin-top: 1.4rem;
    border-radius: 2px;
    opacity: 0.95;
}

body:not(.dark-theme) .features .feature-card h3,
body:not(.dark-theme) .feature-card h3 {
    font-size: 1.5rem;
    margin-bottom: 0.8rem;
    color: #071226;
    font-weight: 700;
}

body:not(.dark-theme) .features .feature-card p,
body:not(.dark-theme) .feature-card p {
    color: rgba(7,18,38,0.78);
    line-height: 1.75;
}

body:not(.dark-theme) .features .feature-card:hover,
body:not(.dark-theme) .feature-card:hover {
    transform: translateY(-10px) scale(1.01);
    box-shadow: 0 26px 60px rgba(16,24,40,0.12), 0 10px 30px rgba(16,24,40,0.06);
    border-color: rgba(16,24,40,0.08);
}

body.dark-theme .feature-card {
    background: var(--primary-dark);
    border-color: var(--secondary-color);
}

/* ==================== MODULES - DISEÑO MEJORADO ==================== */
.page-header {
    background: linear-gradient(135deg, var(--dark-color), #1a1f2e);
    color: white;
    padding: 4rem 0;
    text-align: center;
}

.page-header h1 {
    font-size: clamp(2rem, 4vw, 3rem);
    margin-bottom: 1rem;
    font-weight: 700;
}

.page-header p {
    font-size: 1.2rem;
    opacity: 0.9;
}

.modules-section {
    padding: 4rem 0;
    background-color: var(--primary-color);
}

/* Modules page: use the light hero style like the homepage for consistency */
body.modules .page-header {
    background: linear-gradient(135deg, var(--primary-color), var(--primary-light));
    color: var(--text-color);
    padding: 3.5rem 0;
}

body.modules .page-header h1,
body.modules .page-header p {
    color: #000000;
}

/* Make H3 headings black on the modules page in light mode */
body.modules h3 {
    color: #000000;
}

/* Ensure H3 headings use theme text color in dark mode */
body.dark-theme.modules h3 {
    color: var(--text-color);
}

/* Dashboard: ensure stat numbers have proper contrast in both modes */
.stat-number {
    font-size: 3rem;
    font-weight: 800;
    color: #000000;
    margin: 0;
}

body.dark-theme .stat-number {
    color: #ffffff;
}

/* In dark theme, make sure the modules page header remains readable */
body.dark-theme.modules .page-header {
    background: linear-gradient(135deg, var(--primary-dark), var(--primary-color));
    color: var(--text-color);
}
body.dark-theme.modules .page-header h1,
body.dark-theme.modules .page-header p {
    color: var(--text-color);
}

.modules-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
    gap: 2.5rem;
}

.module-card {
    background: white;
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow);
    overflow: hidden;
    transition: var(--transition);
    display: flex;
    flex-direction: column;
    height: 100%;
    border: 1px solid #f0f0f0;
}

.module-card:hover {
    transform: translateY(-10px) scale(1.02);
    box-shadow: var(--box-shadow-hover);
}

.module-card-image {
    position: relative;
    height: 220px;
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    padding: 2rem;
    color: white;
    overflow: hidden;
}

.module-card-image::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(to bottom, rgba(0,0,0,0.3), rgba(0,0,0,0.8));
    z-index: 1;
}

.module-card-image::after {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(255,255,255,0.1) 0%, transparent 70%);
    opacity: 0;
    transition: var(--transition);
    z-index: 2;
}

.module-card:hover .module-card-image::after {
    opacity: 1;
}

.module-card-image > * {
    position: relative;
    z-index: 3;
}

.module-subtitle {
    font-size: 0.85rem;
    opacity: 0.9;
    margin-bottom: 0.5rem;
    font-weight: 600;
    letter-spacing: 0.5px;
    text-transform: uppercase;
}

.module-card h3 {
    margin: 0;
    font-size: 1.75rem;
    color: white;
    text-shadow: 0 2px 8px rgba(0,0,0,0.3);
    line-height: 1.3;
}

.module-duration-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    background-color: rgba(255,255,255,0.2);
    backdrop-filter: blur(15px);
    padding: 0.5rem 1rem;
    border-radius: 20px;
    font-size: 0.9rem;
    margin-top: 1rem;
    border: 1px solid rgba(255,255,255,0.3);
    font-weight: 600;
}

.module-duration-badge::before {
    content: '⏱️';
    font-size: 1.1rem;
}

.module-card-body {
    padding: 2rem;
    flex: 1;
    display: flex;
    flex-direction: column;
}

.module-card-body h4 {
    margin: 0 0 0.75rem 0;
    font-size: 1.2rem;
    color: #000000;
    font-weight: 700;
}

body.dark-theme .module-card-body h4 {
    color: #ffffff;
}

.module-published-date {
    font-size: 0.85rem;
    color: var(--secondary-color);
    margin-bottom: 1.25rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.module-published-date::before {
    content: '📅';
}

.module-description {
    color: #444444;
    line-height: 1.7;
    margin-bottom: auto;
    font-size: 0.95rem;
}

body.dark-theme .module-description {
    color: #cccccc;
}

.module-card-footer {
    padding: 1.25rem 2rem;
    background: linear-gradient(to bottom, transparent, rgba(0,123,255,0.03));
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-top: 1px solid #f0f0f0;
    gap: 1rem;
    flex-wrap: wrap;
}

.module-meta {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.chapters-count {
    font-size: 0.9rem;
    color: var(--secondary-color);
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 500;
}

.chapters-count::before {
    content: '📚';
    font-size: 1.1rem;
}

.module-level-badge {
    display: inline-block;
    padding: 0.35rem 1rem;
    border-radius: 15px;
    font-size: 0.8rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.module-level-badge.principiante {
    background: linear-gradient(135deg, #d4edda, #c3e6cb);
    color: #155724;
}

.module-level-badge.intermedio {
    background: linear-gradient(135deg, #fff3cd, #ffeaa7);
    color: #856404;
}

.module-level-badge.avanzado {
    background: linear-gradient(135deg, #f8d7da, #f5c6cb);
    color: #721c24;
}

.btn-view-module {
    background: var(--secondary-color);
    color: #000000;
    padding: 0.75rem 2rem;
    border-radius: 25px;
    text-decoration: none;
    font-weight: 600;
    transition: var(--transition);
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    box-shadow: 0 4px 15px rgba(255,180,0,0.3);
}

body.dark-theme .btn-view-module {
    background: var(--secondary-color);
    color: #000000;
}

.btn-view-module::after {
    content: '→';
    transition: var(--transition);
}

.btn-view-module:hover {
    transform: translateX(5px);
    box-shadow: 0 6px 20px rgba(0,123,255,0.3);
}

.btn-view-module:hover::after {
    transform: translateX(5px);
}

/* ==================== CHAPTER VIEW ==================== */
.chapter-view {
    display: flex;
    min-height: calc(100vh - 80px);
}

.chapter-sidebar {
    width: 320px;
    background: white;
    padding: 2rem;
    border-right: 1px solid #e0e0e0;
    overflow-y: auto;
    box-shadow: 2px 0 10px rgba(0,0,0,0.05);
}

body.dark-theme .chapter-sidebar {
    background: var(--primary-dark);
    border-right-color: rgba(255,255,255,0.1);
}

.chapter-sidebar h3 {
    margin-bottom: 1.5rem;
    color: #000000;
    font-size: 1.4rem;
    font-weight: 700;
}

body.dark-theme .chapter-sidebar h3 {
    color: #ffffff;
}

.module-progress {
    margin: 1.5rem 0;
}

.progress-bar {
    width: 100%;
    height: 10px;
    background-color: #e9ecef;
    border-radius: 10px;
    overflow: hidden;
    margin-bottom: 0.75rem;
}

body.dark-theme .progress-bar {
    background-color: rgba(255,255,255,0.1);
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--secondary-color), var(--success-color));
    transition: width 0.5s ease;
    box-shadow: 0 0 10px rgba(255,180,0,0.5);
}

body.dark-theme .progress-fill {
    background: linear-gradient(90deg, var(--secondary-color), var(--success-color));
    box-shadow: 0 0 10px rgba(255,180,0,0.5);
}

.progress-text {
    font-size: 0.9rem;
    color: var(--secondary-color);
    font-weight: 500;
}

.chapter-sidebar ul {
    list-style: none;
}

.chapter-sidebar li {
    padding: 1.25rem;
    margin-bottom: 0.75rem;
    border-radius: var(--border-radius-sm);
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    background: #f8f9fa;
    border: 2px solid transparent;
    color: #000000;
}

body.dark-theme .chapter-sidebar li {
    background: rgba(255,255,255,0.05);
    color: #ffffff;
}

.chapter-sidebar li:hover {
    background: #e9ecef;
    border-color: var(--secondary-color);
    transform: translateX(5px);
}

body.dark-theme .chapter-sidebar li:hover {
    background: rgba(255,255,255,0.1);
}

.chapter-sidebar li.active {
    background: linear-gradient(135deg, var(--secondary-color), #d39e00);
    color: #000000;
    box-shadow: 0 4px 15px rgba(255,180,0,0.3);
}

body.dark-theme .chapter-sidebar li.active {
    background: linear-gradient(135deg, var(--secondary-color), #d39e00);
    color: #000000;
}

.chapter-sidebar li.completed {
    background: #d4edda;
    border-color: var(--success-color);
    color: #155724;
}

body.dark-theme .chapter-sidebar li.completed {
    background: rgba(40, 167, 69, 0.15);
    border-color: var(--success-color);
    color: #4ade80;
}

.chapter-number {
    font-weight: 700;
    margin-right: 0.75rem;
    font-size: 1.1rem;
    color: inherit;
}

.chapter-check {
    color: var(--success-color);
    font-weight: 700;
    font-size: 1.2rem;
}

.chapter-sidebar li.active .chapter-check {
    color: white;
}

.chapter-duration {
    font-size: 0.8rem;
    color: #6c757d;
    margin-top: 0.5rem;
    display: block;
}

body.dark-theme .chapter-duration {
    color: #9ca3af;
}

.chapter-sidebar li.active .chapter-duration {
    color: rgba(0,0,0,0.7);
}

body.dark-theme .chapter-sidebar li.active .chapter-duration {
    color: rgba(0,0,0,0.7);
}

.chapter-content {
    flex: 1;
    padding: 3rem;
    background: #fafbfc;
    overflow-y: auto;
    box-shadow: inset 0 0 20px rgba(0,0,0,0.03);
}

body.dark-theme .chapter-content {
    background: var(--primary-color);
    box-shadow: inset 0 0 20px rgba(0,0,0,0.3);
}

.chapter-content .container {
    max-width: 900px;
}

.chapter-content h1 {
    font-size: clamp(1.75rem, 3vw, 2.5rem);
    margin-bottom: 2rem;
    color: #000000;
    font-weight: 700;
}

body.dark-theme .chapter-content h1 {
    color: #ffffff;
}

/* Estilos para video responsive */
.chapter-video {
    position: relative;
    width: 100%;
    max-width: 900px;
    margin: 2rem auto;
    border-radius: var(--border-radius);
    overflow: hidden;
    background: #000;
}

.chapter-video video,
.chapter-video iframe {
    width: 100%;
    height: auto;
    min-height: 300px;
    max-height: 70vh;
    display: block;
    border: none;
}

/* Aspect ratio 16:9 para iframes (YouTube, Vimeo, Drive) */
.chapter-video iframe {
    aspect-ratio: 16 / 9;
}

/* iOS Safari fixes */
.chapter-video video {
    object-fit: contain;
}

/* Android Chrome fixes */
.chapter-video video::-webkit-media-controls {
    display: flex !important;
}

.chapter-video video::-webkit-media-controls-panel {
    display: flex !important;
}

/* Mobile optimizations */
@media (max-width: 768px) {
    .chapter-video {
        margin: 1.5rem 0;
        border-radius: 8px;
    }
    
    .chapter-video video,
    .chapter-video iframe {
        min-height: 200px;
        max-height: 50vh;
    }
    
    /* Android: asegurar que controles sean visibles */
    .chapter-video video {
        -webkit-tap-highlight-color: rgba(0, 0, 0, 0);
    }
}

.content-body {
    background: white;
    padding: 3rem;
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow);
    margin: 2rem 0;
    line-height: 1.8;
}

body.dark-theme .content-body {
    background: var(--primary-dark);
    color: var(--text-color);
}

.chapter-navigation {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    margin-top: 3rem;
    flex-wrap: wrap;
}

/* Mobile Chapter View */
@media (max-width: 992px) {
    .chapter-view {
        flex-direction: column;
    }
    
    .chapter-sidebar {
        width: 100%;
        border-right: none;
        border-bottom: 1px solid #e0e0e0;
        padding: 1.5rem;
        max-height: none;
    }
    
    body.dark-theme .chapter-sidebar {
        border-bottom-color: rgba(255,255,255,0.1);
    }
    
    .chapter-content {
        padding: 2rem 1.5rem;
    }
}

@media (max-width: 768px) {
    .chapter-content {
        padding: 1.5rem 1rem;
    }
    
    .chapter-content .container {
        max-width: 100%;
    }
    
    .content-body {
        padding: 1.5rem;
        margin: 1.5rem 0;
    }
    
    .chapter-navigation {
        flex-direction: column;
        gap: 0.75rem;
    }
    
    .chapter-navigation button {
        width: 100%;
    }
}

/* ==================== FOOTER ==================== */
footer {
    background: #353333;
    color: white;
    padding: 3rem 0 1rem;
    margin-top: auto;
}

.footer-content {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 2rem;
    margin-bottom: 2rem;
    text-align: left;
    align-items: start;
}

/* Desktop: reserve a fixed column for the logo so it doesn't overlap menus */
@media (min-width: 992px) {
    .footer-content {
        grid-template-columns: 140px 1fr 1fr 1fr;
        align-items: start;
    }
    .footer-logo { justify-content: flex-start }
}

.footer-section h3,
.footer-section h4 {
    color: #ffffff;
    margin-bottom: 1rem;
}

.footer-section h3 { font-size: 1.5rem; font-weight:700; }
.footer-section h4 { font-size: 1.05rem; font-weight:600; }

.footer-section p { color: rgba(255,255,255,0.85); line-height:1.6; margin:0 }

.footer-menu { list-style:none; padding:0; margin:0 }
.footer-menu li { margin-bottom: .75rem }
.footer-menu a { color: rgba(255,255,255,0.85); text-decoration:none; transition: var(--transition); display:inline-block }
.footer-menu a:hover { color: var(--primary-color); transform: translateX(5px) }

.footer-bottom {
    border-top: 1px solid rgba(255,255,255,0.08);
    padding-top: 1.75rem;
    margin-top: 2rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

.footer-links { list-style:none; display:flex; gap:2rem; margin:0; padding:0; align-items:center }
.footer-links a { color: rgba(255,255,255,0.8); text-decoration:none }
.footer-links a:hover { color: #fff }

/* Footer logo section (left column) */
.footer-logo-section { display:flex; flex-direction:column; gap: .75rem }
.footer-logo { display:flex; align-items:center }
.footer-logo .footer-logo-large { width:140px; height:140px; object-fit:contain; display:block }
.footer-tagline { margin:0; color: rgba(255,255,255,0.82); max-width:420px }

/* Responsive tweaks */
@media (max-width: 1200px) {
    .footer-logo .footer-logo-large { width:120px; height:120px }
}
@media (max-width: 768px) {
    .footer-content { grid-template-columns: 1fr; }
    .footer-section { text-align:center }
    .footer-bottom { flex-direction:column; align-items:center; text-align:center }
    .footer-logo { justify-content:center }
    .footer-logo .footer-logo-large { width:110px; height:110px }
    .footer-tagline { max-width:100% }
}

/* On small screens, hide the tagline to reduce vertical space and avoid wrapping issues */
@media (max-width: 480px) {
    .footer-tagline { display: none }
}

/* end footer */

/* ==================== COMMENTS SECTION - MEJORADO ==================== */
.comments-section {
    margin-top: 4rem;
    padding-top: 3rem;
    border-top: 2px solid #e9ecef;
}

.comments-section h2 {
    margin-bottom: 2rem;
    font-size: 1.75rem;
    color: #000000;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

body.dark-theme .comments-section h2 {
    color: #ffffff;
}

.comments-section h2::before {
    content: '💬';
    font-size: 2rem;
}

.comment-form {
    background: white;
    padding: 2rem;
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow);
    margin-bottom: 2.5rem;
    border: 2px solid #f0f0f0;
    transition: var(--transition);
}

body.dark-theme .comment-form {
    background: var(--primary-dark);
    border-color: rgba(255,255,255,0.1);
}

.comment-form:focus-within {
    border-color: var(--primary-color);
    box-shadow: 0 4px 20px rgba(0,123,255,0.15);
}

.comment-form textarea {
    width: 100%;
    padding: 1.25rem;
    border: 2px solid #e9ecef;
    border-radius: var(--border-radius-sm);
    font-family: var(--font-family);
    font-size: 1rem;
    resize: vertical;
    margin-bottom: 1.25rem;
    transition: var(--transition);
    line-height: 1.6;
    min-height: 120px;
    background-color: white;
    color: #000000;
}

body.dark-theme .comment-form textarea {
    background-color: rgba(255,255,255,0.05);
    border-color: rgba(255,255,255,0.1);
    color: #ffffff;
}

.comment-form textarea:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(0,123,255,0.1);
}

body.dark-theme .comment-form textarea:focus {
    border-color: var(--secondary-color);
    box-shadow: 0 0 0 3px rgba(255,180,0,0.15);
}

.comment-form textarea::placeholder {
    color: #adb5bd;
    font-style: italic;
}

body.dark-theme .comment-form textarea::placeholder {
    color: #6b7280;
}

.comment-form button {
    background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
    color: white;
    padding: 0.9rem 2.5rem;
    border: none;
    border-radius: 25px;
    cursor: pointer;
    font-weight: 600;
    font-size: 1rem;
    transition: var(--transition);
    box-shadow: 0 4px 15px rgba(0,123,255,0.3);
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.comment-form button::before {
    content: '📤';
    font-size: 1.1rem;
}

.comment-form button:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0,123,255,0.4);
}

.comment-form button:active {
    transform: translateY(0);
}

.comments-list {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.comment-item {
    background: white;
    padding: 2rem;
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow);
    transition: var(--transition);
    border-left: 4px solid var(--secondary-color);
    position: relative;
}

body.dark-theme .comment-item {
    background: var(--primary-dark);
    border-left-color: var(--secondary-color);
}

.comment-item:hover {
    box-shadow: var(--box-shadow-hover);
    transform: translateX(5px);
}

.comment-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 1.25rem;
    gap: 1rem;
}

.comment-author {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.comment-avatar {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 1.3rem;
    box-shadow: 0 4px 12px rgba(0,123,255,0.3);
    flex-shrink: 0;
}

.comment-info {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.comment-name {
    font-weight: 700;
    font-size: 1.05rem;
    color: #000000;
}

body.dark-theme .comment-name {
    color: #ffffff;
}

.comment-date {
    font-size: 0.85rem;
    color: var(--secondary-color);
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.comment-date::before {
    content: '🕒';
    font-size: 0.9rem;
}

.comment-text {
    line-height: 1.8;
    color: #495057;
    font-size: 1rem;
    margin-bottom: 1rem;
    word-wrap: break-word;
}

body.dark-theme .comment-text {
    color: #d1d5db;
}

.comment-actions {
    margin-top: 1rem;
    display: flex;
    gap: 1.5rem;
    padding-top: 1rem;
    border-top: 1px solid #f0f0f0;
}

.comment-action-btn {
    background: none;
    border: none;
    color: var(--secondary-color);
    cursor: pointer;
    font-size: 0.95rem;
    padding: 0.5rem 1rem;
    border-radius: 20px;
    transition: var(--transition);
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 500;
}

.comment-action-btn:hover {
    background-color: var(--light-color);
    color: var(--text-color);
}

.comment-action-btn.liked {
    color: var(--text-color);
    background-color: var(--primary-light);
}

.comment-replies {
    margin-left: 3.5rem;
    margin-top: 1.5rem;
    padding-left: 2rem;
    border-left: 3px solid var(--primary-light);
}

.comment-replies .comment-item {
    border-left-color: var(--secondary-color);
    background: #f8f9fa;
}

.comment-replies .comment-avatar {
    width: 40px;
    height: 40px;
    font-size: 1.1rem;
}

/* Empty State - Sin comentarios */
.empty-comments {
    text-align: center;
    padding: 3rem;
    background: white;
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow);
}

body.dark-theme .empty-comments {
    background: var(--primary-dark);
}

.empty-comments-icon {
    font-size: 4rem;
    margin-bottom: 1rem;
    opacity: 0.5;
}

.empty-comments h3 {
    color: var(--secondary-color);
    font-size: 1.3rem;
    margin-bottom: 0.5rem;
}

.empty-comments p {
    color: #adb5bd;
    font-size: 1rem;
}

body.dark-theme .empty-comments p {
    color: #9ca3af;
}

/* Loading State */
.comment-loading {
    text-align: center;
    padding: 2rem;
    color: var(--secondary-color);
}

.comment-loading::before {
    content: '⏳';
    font-size: 2rem;
    display: block;
    margin-bottom: 1rem;
}

/* ==================== AUTH PAGES (LOGIN, REGISTER, FORGOT PASSWORD) ==================== */
.auth-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #000000 0%, var(--secondary-color) 100%);
    padding: 2rem;
    position: relative;
    overflow: hidden;
}

.auth-container::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: url('data:image/svg+xml,<svg width="100" height="100" xmlns="http://www.w3.org/2000/svg"><rect fill="rgba(255,255,255,0.05)" width="50" height="50"/></svg>');
    opacity: 0.1;
}

/* Dark theme: keep black base but a subtle golden tint to preserve branding */
body.dark-theme .auth-container {
    background: linear-gradient(135deg, #000000 0%, rgba(37, 33, 8, 0.06) 100%);
}

.auth-box {
    background: white;
    padding: 3rem;
    border-radius: var(--border-radius);
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
    max-width: 480px;
    width: 100%;
    position: relative;
    z-index: 1;
    animation: fadeInUp 0.6s ease-out;
}

body.dark-theme .auth-box {
    background: var(--primary-dark);
}

.auth-box h1 {
    text-align: center;
    margin-bottom: 0.5rem;
    color: #000000;
    font-size: 2rem;
    font-weight: 700;
}

body.dark-theme .auth-box h1 {
    color: #ffffff;
}

.subtitle {
    text-align: center;
    color: var(--secondary-color);
    margin-bottom: 2rem;
    font-size: 0.95rem;
    line-height: 1.5;
}

/* Forms */
.form-group {
    margin-bottom: 1.5rem;
}

/* Make form groups positioned so we can place inline controls (show password) */
.form-group {
    position: relative;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    color: var(--dark-color);
    font-weight: 600;
    font-size: 0.95rem;
}

.form-group input,
.form-group select {
    width: 100%;
    padding: 0.9rem 1rem;
    border: 2px solid #e9ecef;
    border-radius: var(--border-radius-sm);
    font-size: 1rem;
    transition: var(--transition);
    font-family: var(--font-family);
}

/* Password toggle button (eye icon) placed inside form-group */
.password-toggle {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border: none;
    background: transparent;
    color: var(--text-color);
    cursor: pointer;
    padding: 4px;
    border-radius: 6px;
}

.password-toggle svg {
    width: 20px;
    height: 20px;
    display: block;
}

/* Give password inputs extra right padding so text doesn't hide under the button */
.form-group input[type="password"],
.form-group input[type="text"].revealed-password {
    padding-right: 3.6rem;
}

body.dark-theme .password-toggle {
    color: #fff;
}

/* Small, unobtrusive scroll indicator on the right side (visible even if native scrollbar hidden) */
.scroll-indicator {
    position: fixed;
    top: 0;
    right: 8px;
    height: 100vh;
    width: 8px;
    z-index: 2200;
    pointer-events: none; /* don't block clicks */
    display: block;
}
.scroll-indicator .track {
    position: absolute;
    inset: 12px 0 12px 0;
    left: 50%;
    transform: translateX(-50%);
    width: 4px;
    background: rgba(0,0,0,0.06);
    border-radius: 6px;
}
.scroll-indicator .thumb {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    width: 4px;
    background: rgba(0,0,0,0.45);
    border-radius: 6px;
    transition: top 120ms linear, height 120ms linear, background 160ms ease;
}
body.dark-theme .scroll-indicator .track {
    background: rgba(255,255,255,0.06);
}
body.dark-theme .scroll-indicator .thumb {
    background: rgba(255,255,255,0.9);
}

@media (max-width: 800px) {
    /* Slightly reduced presence on very small screens */
    .scroll-indicator { right: 6px; }
    .scroll-indicator .track, .scroll-indicator .thumb { width: 3px; }
}

.form-group input:focus,
.form-group select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(0,123,255,0.1);
}

.form-group input::placeholder {
    color: #adb5bd;
}

body.dark-theme .form-group input,
body.dark-theme .form-group select {
    background: rgba(255,255,255,0.05);
    border-color: rgba(255,255,255,0.1);
    color: #ffffff;
}

body.dark-theme .form-group input:focus,
body.dark-theme .form-group select:focus {
    border-color: var(--primary-color);
    background: rgba(255,255,255,0.08);
}

body.dark-theme .form-group input::placeholder {
    color: #9ca3af;
}

body.dark-theme .form-group label {
    color: #f3f4f6;
}

.checkbox-group {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 1.5rem;
}

.checkbox-group input[type="checkbox"] {
    width: auto;
    width: 18px;
    height: 18px;
    cursor: pointer;
}

.checkbox-group label {
    margin: 0;
    font-weight: 400;
    cursor: pointer;
    user-select: none;
}

.checkbox-group a {
    color: var(--secondary-color);
    text-decoration: none;
    font-weight: 600;
}

.checkbox-group a:hover {
    text-decoration: underline;
}

.auth-box .btn-primary {
    width: 100%;
    padding: 1rem;
    font-size: 1.05rem;
    margin-top: 0.5rem;
}

.form-links {
    margin-top: 2rem;
    text-align: center;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    padding-top: 1.5rem;
    border-top: 1px solid #e9ecef;
}

.form-links a {
    color: var(--secondary-color);
    text-decoration: none;
    font-weight: 600;
    transition: var(--transition);
}

.form-links a:hover {
    color: #000000;
    text-decoration: underline;
}

.back-link {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    text-align: center;
    margin-top: 1.5rem;
    color: var(--secondary-color);
    text-decoration: none;
    font-weight: 500;
    transition: var(--transition);
}

.back-link::before {
    content: '←';
    font-size: 1.2rem;
}


    /* Move the anchor (link) content slightly to the right on desktop to
       create more breathing room from the logos. This adjusts padding-left
       for visual offset but keeps the anchor clickable area sensible. */
    .nav-menu a {
        /* original vertical padding preserved; add left offset */
        padding-left: calc(0.5rem + var(--nav-link-shift));
        padding-right: 0.5rem; /* ensure some right padding remains */
    }
.back-link:hover {
    color: #000000;
}

/* ==================== CONTACT PAGE ==================== */
.contact-section {
    padding: 4rem 0;
    background-color: white;
}

body.dark-theme .contact-section {
    background-color: var(--primary-color);
}

.contact-grid {
    display: grid;
    grid-template-columns: 1fr 1.5fr;
    gap: 4rem;
    margin-top: 2rem;
}

.contact-info {
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

.contact-item {
    background: var(--light-color);
    padding: 2rem;
    border-radius: var(--border-radius);
    border-left: 4px solid var(--primary-color);
    transition: var(--transition);
}

.contact-item:hover {
    transform: translateX(5px);
    box-shadow: var(--box-shadow);
}

.contact-item h3 {
    font-size: 1.3rem;
    margin-bottom: 0.75rem;
    color: #000000;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

body.dark-theme .contact-item h3 {
    color: #ffffff;
}

.contact-item p {
    color: var(--secondary-color);
    line-height: 1.7;
    font-size: 1rem;
}

.contact-form-container {
    background: white;
    padding: 3rem;
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow);
    border: 2px solid #f0f0f0;
}

.contact-form-container h2 {
    margin-bottom: 2rem;
    color: #000000;
    font-size: 2rem;
    font-weight: 700;
}

body.dark-theme .contact-form-container h2 {
    color: #ffffff;
}

.contact-form-container .form-group textarea {
    width: 100%;
    padding: 1rem;
    border: 2px solid #e9ecef;
    border-radius: var(--border-radius-sm);
    font-family: var(--font-family);
    font-size: 1rem;
    resize: vertical;
    transition: var(--transition);
    min-height: 150px;
}

.contact-form-container .form-group textarea:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(0,123,255,0.1);
}

.contact-form-container .btn-primary {
    width: 100%;
    margin-top: 1rem;
}

/* Dark theme adjustments specifically for contact page */
body.dark-theme .contact-section {
    background-color: var(--primary-dark);
    color: var(--text-color);
}

body.dark-theme .contact-grid {
    --card-bg: var(--primary-dark);
}

body.dark-theme .contact-item {
    background: rgba(255,255,255,0.02);
    border-left-color: var(--secondary-color);
    color: var(--text-color);
    box-shadow: 0 2px 12px rgba(0,0,0,0.35);
}

body.dark-theme .contact-item h3 {
    color: var(--secondary-color);
}

body.dark-theme .contact-item p {
    color: rgba(255,255,255,0.9);
}

body.dark-theme .contact-form-container {
    background: var(--primary-dark);
    border-color: rgba(255,255,255,0.04);
    box-shadow: 0 10px 40px rgba(0,0,0,0.45);
}

body.dark-theme .contact-form-container h2 {
    color: #ffffff;
}

body.dark-theme .contact-form-container .form-group label {
    color: rgba(255,255,255,0.9);
}

body.dark-theme .contact-form-container .form-group input,
body.dark-theme .contact-form-container .form-group textarea,
body.dark-theme .contact-form-container .form-group select {
    background: rgba(255,255,255,0.03);
    border-color: rgba(255,255,255,0.08);
    color: #fff;
}

body.dark-theme .contact-form-container .form-group input::placeholder,
body.dark-theme .contact-form-container .form-group textarea::placeholder {
    color: rgba(255,255,255,0.6);
    font-style: italic;
}

body.dark-theme .contact-form-container .btn-primary {
    background: linear-gradient(135deg, var(--secondary-color), #d4c200);
    color: #000000;
    box-shadow: 0 6px 20px rgba(0,0,0,0.5);
}

/* Improve focus styles for accessibility in dark mode */
body.dark-theme .contact-form-container .form-group input:focus,
body.dark-theme .contact-form-container .form-group textarea:focus {
    box-shadow: 0 0 0 4px rgba(255,215,0,0.12);
    border-color: var(--secondary-color);
}

/* Slight tint to footer when dark theme and contact page present */
body.dark-theme footer {
    background: linear-gradient(135deg, #2a2a28, #111);
}

/* ==================== PROFILE PAGE ==================== */
.profile-page {
    padding: 3rem 0;
    min-height: calc(100vh - 80px);
    background-color: #fafbfc;
}

body.dark-theme .profile-page {
    background-color: var(--primary-color);
}

.profile-page h1 {
    margin-bottom: 2rem;
    color: #000000;
    font-size: 2.5rem;
    font-weight: 700;
}

body.dark-theme .profile-page h1 {
    color: #ffffff;
}

.profile-container {
    display: grid;
    grid-template-columns: 350px 1fr;
    gap: 2.5rem;
    margin-top: 2rem;
}

.profile-sidebar {
    /* Light theme: user-requested darker sidebar for profile */
    background: #555e6f;
    padding: 2.5rem;
    border-radius: var(--border-radius);
    box-shadow: 0 8px 20px rgba(16,24,40,0.04);
    height: fit-content;
    border: 1px solid #e0e0e0;
}

.profile-avatar {
    text-align: center;
    margin-bottom: 2rem;
}

.avatar-circle {
    width: 140px;
    height: 140px;
    border-radius: 50%;
    /* make avatar more visible on light backgrounds */
    background: linear-gradient(135deg, #e6f0ff, #d7e9ff);
    color: var(--secondary-color);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 4rem;
    margin: 0 auto 1.5rem;
    box-shadow: 0 8px 24px rgba(13,71,161,0.08);
    font-weight: 700;
}

.btn-sm {
    padding: 0.6rem 1.5rem;
    font-size: 0.9rem;
    border-radius: 20px;
}

.profile-stats {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
    margin-top: 2rem;
    padding-top: 2rem;
    border-top: 2px solid #f0f0f0;
}

.stat-item {
    text-align: center;
    padding: 1.5rem;
    background: linear-gradient(135deg, #f5f9ff, #e6f2ff);
    border-radius: var(--border-radius-sm);
    transition: var(--transition);
}

.stat-item:hover {
    transform: scale(1.05);
    box-shadow: var(--box-shadow);
}

.stat-value {
    display: block;
    font-size: 2.5rem;
    font-weight: 800;
    color: #000000;
}

body.dark-theme .stat-value {
    color: #ffffff;
}

.stat-label {
    font-size: 0.9rem;
    color: var(--secondary-color);
    font-weight: 600;
    margin-top: 0.5rem;
}

.profile-content {
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

.profile-section {
    background: #555e6f;
    padding: 2.5rem;
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow);
    border: 1px solid #f0f0f0;
}

.profile-section h2 {
    margin-bottom: 2rem;
    color: var(--dark-color);
    font-size: 1.75rem;
    font-weight: 700;
    padding-bottom: 1rem;
    border-bottom: 2px solid var(--primary-color);
}

.profile-section textarea {
    width: 100%;
    padding: 1rem;
    border: 2px solid #e9ecef;
    border-radius: var(--border-radius-sm);
    font-family: var(--font-family);
    resize: vertical;
    font-size: 1rem;
    transition: var(--transition);
}

.profile-section textarea:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(0,123,255,0.1);
}

/* Profile page: improved contrast and responsive tweaks */
/* Make labels and small helper text darker in light mode and white in dark mode */
.profile-page .form-group label {
    color: var(--text-color);
    font-weight: 700;
}

.profile-page .form-group small {
    color: #ffffff; /* helper text white in profile (light view) per request */
    font-size: 0.85rem;
}

/* Dark theme: make labels and helper text clearly visible */
body.dark-theme .profile-page .form-group label,
body.dark-theme .profile-page .form-group small {
    color: #ffffff !important;
}

/* Readonly / disabled inputs (email) should look appropriate in dark mode */
body.dark-theme .profile-page .form-group input[readonly],
body.dark-theme .profile-page .form-group input[disabled] {
    background: rgba(255,255,255,0.03) !important;
    color: #ffffff !important;
    border-color: rgba(255,255,255,0.06) !important;
}

/* Profile cards in dark mode */
body.dark-theme .profile-page .profile-sidebar,
body.dark-theme .profile-page .profile-section {
    background: var(--primary-dark);
    border-color: rgba(255,255,255,0.04);
    box-shadow: 0 8px 30px rgba(0,0,0,0.45);
    color: var(--text-color);
}

/* Ensure stat cards remain legible in dark mode */
body.dark-theme .profile-page .stat-item {
    background: linear-gradient(135deg, rgba(255,255,255,0.02), rgba(255,255,255,0.03));
    border: 1px solid rgba(255,255,255,0.03);
}

/* Mobile: tighten spacing and stack profile blocks neatly */
@media (max-width: 768px) {
    .profile-container {
        grid-template-columns: 1fr;
        gap: 1.25rem;
    }

    .profile-sidebar {
        padding: 1.5rem;
    }

    .profile-section {
        padding: 1.5rem;
    }

    .avatar-circle {
        width: 100px;
        height: 100px;
        font-size: 3rem;
    }

    .stat-value {
        font-size: 2rem;
    }
}

/* Small adjustments for very small screens */
@media (max-width: 420px) {
    .profile-page h1 {
        font-size: 1.75rem;
    }
    .btn-sm {
        padding: 0.5rem 1rem;
    }
}

/* ==================== CERTIFICATES PAGE ==================== */
.certificates-page {
    padding: 3rem 0;
    min-height: calc(100vh - 80px);
    background-color: #fafbfc;
}

body.dark-theme .certificates-page {
    background-color: var(--primary-color);
}

.certificates-page h1 {
    margin-bottom: 1rem;
    color: #000000;
    font-size: 2.5rem;
    font-weight: 700;
}

body.dark-theme .certificates-page h1 {
    color: #ffffff;
}

.certificates-page .subtitle {
    color: var(--secondary-color);
    font-size: 1.1rem;
    margin-bottom: 3rem;
}

.certificates-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(380px, 1fr));
    gap: 2.5rem;
    margin-top: 2rem;
}

.certificate-card {
    background: white;
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow);
    overflow: hidden;
    transition: var(--transition);
    border: 2px solid #f0f0f0;
}

body.dark-theme .certificate-card {
    background: var(--primary-dark);
    border-color: rgba(255,255,255,0.1);
}

.certificate-card:hover {
    transform: translateY(-10px) scale(1.02);
    box-shadow: var(--box-shadow-hover);
    border-color: var(--primary-color);
}

.certificate-preview {
    background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
    color: white;
    padding: 3.5rem 2.5rem;
    text-align: center;
    position: relative;
    overflow: hidden;
}

.certificate-preview::before {
    content: '🎓';
    position: absolute;
    font-size: 10rem;
    opacity: 0.1;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

.certificate-preview h3 {
    margin: 0 0 1rem 0;
    font-size: 1.75rem;
    position: relative;
    z-index: 1;
    text-shadow: 0 2px 8px rgba(0,0,0,0.2);
}

.certificate-preview p {
    position: relative;
    z-index: 1;
    opacity: 0.95;
    font-size: 1.05rem;
}

.certificate-info {
    padding: 2rem;
}

.certificate-date {
    color: var(--secondary-color);
    font-size: 0.95rem;
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.certificate-date::before {
    content: '📅';
}

.certificate-code {
    background: var(--light-color);
    padding: 0.75rem 1rem;
    border-radius: var(--border-radius-sm);
    font-family: 'Courier New', monospace;
    font-size: 0.9rem;
    color: var(--dark-color);
    margin-bottom: 1.5rem;
    border: 1px dashed var(--secondary-color);
}

body.dark-theme .certificate-code {
    background: rgba(255,255,255,0.1);
    color: #ffffff;
    border-color: var(--secondary-color);
}

.btn-download {
    width: 100%;
    text-align: center;
    background: linear-gradient(135deg, var(--success-color), #1e7e34);
}

.btn-download:hover {
    background: linear-gradient(135deg, #1e7e34, var(--success-color));
}

.empty-state {
    text-align: center;
    padding: 5rem 2rem;
    background: white;
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow);
}

body.dark-theme .empty-state {
    background: var(--primary-dark);
}

.empty-state h2 {
    color: var(--secondary-color);
    margin-bottom: 1rem;
    font-size: 2rem;
}

.empty-state p {
    color: #adb5bd;
    font-size: 1.1rem;
    margin-bottom: 2rem;
}

body.dark-theme .empty-state p {
    color: #9ca3af;
}

/* ==================== DASHBOARD ==================== */
.dashboard {
    padding: 0 0;
}

.dashboard h1 {
    margin-bottom: 3rem;
    color: #000000;
    font-size: 2.5rem;
    font-weight: 700;
}

/* Align header (header-row.container) with page content for dashboard */
body.dashboard .header-row.container {
    box-sizing: border-box;
    max-width: 1200px;
    margin: 0 auto;
    padding-left: 20px; /* match .container */
    padding-right: 20px;
}

body.dashboard .header-row.container > nav > .container {
    padding-left: 0;
    padding-right: 0;
}

body.dashboard .header-row.container .nav-menu {
    margin-left: 0;
    margin-right: 0;
    justify-content: flex-start;
}

body.dashboard .header-row.container .left-logo-container {
    flex: 0 0 auto;
}

body.dark-theme .dashboard h1 {
    color: #ffffff;
}

/* Dashboard page scaffold (match zonas-termicas layout) */
.dashboard-page {
    padding: 3rem 0;
    min-height: calc(100vh - 80px);
}

.dashboard-header {
    text-align: center;
    margin-bottom: 3rem;
}

.dashboard-header h1 {
    color: #000000;
    margin-bottom: 1rem;
}

body.dark-theme .dashboard-header h1 {
    color: #ffffff;
}

.dashboard-container {
    max-width: 1200px;
    margin: 0 auto;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 2rem;
    margin-bottom: 3rem;
}

/* Zonas termicas - format toggle */
.format-toggle-row {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin: 0.5rem 0 1rem 0;
}
.format-status {
    font-size: 0.95rem;
    color: var(--text-color);
}
.format-status strong { font-weight: 700; }

.stat-card {
    background: linear-gradient(180deg, #ffffff 0%, #fbfbfd 100%);
    padding: 2.5rem;
    border-radius: var(--border-radius);
    /* slightly stronger shadow on light theme so the cards have visible relief */
    box-shadow: 0 8px 24px rgba(140,140,140,0.12);
    text-align: center;
    border: 1px solid #8c8c8c;
    transition: var(--transition);
}

body.dark-theme .stat-card {
    background: var(--primary-dark);
    border-color: rgba(255,255,255,0.1);
}

.stat-card:hover {
    transform: translateY(-6px);
    border-color: #8c8c8c;
    box-shadow: 0 12px 40px rgba(140,140,140,0.16);
}

.stat-card h3 {
    margin-bottom: 1rem;
    color: var(--secondary-color);
    font-size: 1rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.my-modules {
    background: white;
    padding: 2.5rem;
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow);
    border: 1px solid #f0f0f0;
}

body.dark-theme .my-modules {
    background: var(--primary-dark);
    border-color: rgba(255,255,255,0.1);
}

.my-modules h2 {
    margin-bottom: 2rem;
    color: #000000;
    font-size: 2rem;
    font-weight: 700;
    border-bottom: 2px solid var(--primary-color);
    padding-bottom: 1rem;
}

body.dark-theme .my-modules h2 {
    color: #ffffff;
}

/* ==================== RESPONSIVE - AUTH & OTHER PAGES ==================== */
@media (max-width: 1024px) {
    .profile-container {
        grid-template-columns: 300px 1fr;
        gap: 2rem;
    }
    
    .contact-grid {
        grid-template-columns: 1fr;
        gap: 3rem;
    }
}

@media (max-width: 768px) {
    .auth-box {
        padding: 2rem;
    }
    
    .auth-box h1 {
        font-size: 1.75rem;
    }
    
    .contact-grid {
        grid-template-columns: 1fr;
        gap: 2rem;
    }
    
    .contact-form-container {
        padding: 2rem;
    }
    
    .profile-container {
        grid-template-columns: 1fr;
    }
    
    .certificates-grid {
        grid-template-columns: 1fr;
        gap: 2rem;
    }
    
    .stats-grid {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }
}

@media (max-width: 480px) {
    .auth-container {
        padding: 1rem;
    }
    
    .auth-box {
        padding: 1.5rem;
    }
    
    .auth-box h1 {
        font-size: 1.5rem;
    }
    
    .avatar-circle {
        width: 100px;
        height: 100px;
        font-size: 3rem;
    }
    
    .profile-sidebar,
    .profile-section,
    .contact-form-container,
    .my-modules {
        padding: 1.5rem;
    }
    
    .certificate-preview {
        padding: 2.5rem 1.5rem;
    }
    
    .certificate-preview h3 {
        font-size: 1.4rem;
    }

    /* Ajustes para hero en móviles */
    .hero {
        padding: 4rem 0 3rem;
    }

    .hero p {
        font-size: 1rem;
    }
}

/* ==================== ANIMACIONES Y EFECTOS ==================== */
@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.5;
    }
}

.loading {
    animation: pulse 1.5s ease-in-out infinite;
}

/* Smooth Scrolling */
html {
    scroll-behavior: smooth;
}

/* Selection Color */
::selection {
    background: var(--primary-color);
    color: white;
}

/* Focus Styles for Accessibility */
*:focus {
    outline: 3px solid var(--secondary-color);
    outline-offset: 2px;
}

button:focus,
a:focus {
    outline-offset: 4px;
}

/* Print Styles */
@media print {
    .navbar,
    footer,
    .chapter-sidebar,
    .chapter-navigation {
        display: none;
    }
    
    .chapter-content {
        padding: 0;
    }
}

/* Dark theme overrides for common components to improve contrast and legibility */
body.dark-theme .module-card,
body.dark-theme .comment-item,
body.dark-theme .admin-table,
body.dark-theme .auth-box,
body.dark-theme .profile-section,
body.dark-theme .certificate-card,
body.dark-theme .empty-state,
body.dark-theme .comment-form,
body.dark-theme .profile-sidebar,
body.dark-theme .admin-section {
    background: var(--primary-dark);
    border-color: rgba(255,255,255,0.04);
    color: var(--text-color);
    box-shadow: 0 8px 24px rgba(0,0,0,0.45);
}

/* Ensure text inside these components uses readable color */
body.dark-theme .module-card h4,
body.dark-theme .module-card-body h4,
body.dark-theme .comment-item .comment-name,
body.dark-theme .comment-text,
body.dark-theme .auth-box h1,
body.dark-theme .profile-section h2 {
    color: var(--text-color);
}

/* Zonas térmicas: ensure proper contrast in both modes */
body.dark-theme.zonas-termicas main.zonas-termicas-page p,
body.dark-theme.zonas-termicas main.zonas-termicas-page h3,
body.dark-theme.zonas-termicas main.zonas-termicas-page h1 {
    color: #ffffff !important;
}

/* Links and action buttons in dark theme */
body.dark-theme a,
body.dark-theme .btn-primary,
body.dark-theme .btn-secondary,
body.dark-theme .btn-login {
    color: inherit;
}

body.dark-theme .btn-primary {
    background: linear-gradient(135deg, var(--secondary-color), #d4c200);
    color: #111;
}


/* ==================== ALERTS ==================== */
.alert {
    padding: 1rem 1.5rem;
    border-radius: var(--border-radius-sm);
    margin-bottom: 1.5rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-weight: 500;
    animation: slideInDown 0.3s ease;
}

.alert-success {
    background: linear-gradient(135deg, #d4edda, #c3e6cb);
    color: #155724;
    border-left: 4px solid #28a745;
}

.alert-success::before {
    content: '✓';
    font-size: 1.5rem;
}

.alert-danger,
.alert-error {
    background: linear-gradient(135deg, #f8d7da, #f5c6cb);
    color: #721c24;
    border-left: 4px solid #dc3545;
}

.alert-danger::before,
.alert-error::before {
    content: '✕';
    font-size: 1.5rem;
}

.alert-warning {
    background: linear-gradient(135deg, #fff3cd, #ffeaa7);
    color: #856404;
    border-left: 4px solid #ffc107;
}

.alert-warning::before {
    content: '⚠';
    font-size: 1.5rem;
}

.alert-info {
    background: linear-gradient(135deg, #d1ecf1, #bee5eb);
    color: #0c5460;
    border-left: 4px solid #17a2b8;
}

.alert-info::before {
    content: 'ℹ';
    font-size: 1.5rem;
}

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

/* Responsive header adjustments consolidated later — see "RESPONSIVE GENERAL" and final mobile adjustments */

/* ===========================
   RESPONSIVE HEADER COMPLETO
   =========================== */

/* ----- Estilo base del botón hamburguesa ----- */
.menu-toggle {
    display: none;
    flex-direction: column;
    cursor: pointer;
    gap: 5px;
}

.menu-toggle span {
    width: 28px;
    height: 3px;
    background: currentColor;
    transition: all 0.3s ease;
}

/* Ensure the toggle itself is visually transparent and uses the text color
   so the bars (which use currentColor) contrast in both light and dark themes. */
.menu-toggle {
    background: transparent;
    border: none;
    padding: 0.25rem;
    color: var(--text-color);
}

/* Animación del toggle */
.menu-toggle.open span:nth-child(1) {
    transform: translateY(8px) rotate(45deg);
}

.menu-toggle.open span:nth-child(2) {
    opacity: 0;
}

.menu-toggle.open span:nth-child(3) {
    transform: translateY(-8px) rotate(-45deg);
}

/* ====================
   RESPONSIVE GENERAL
   ==================== */

@media (max-width: 900px) {

    /* Contenedor del navbar */
    .navbar .container {
        display: flex;
        align-items: center;
        justify-content: space-between !important;
        padding: 10px 15px;
    }

    /* Mostrar hamburguesa */
    .menu-toggle {
        display: flex;
    }

    /* Menú móvil: full-width overlay con scroll interno y transiciones */
    .nav-menu {
        position: fixed;
        left: 0;
        right: 0;
        top: 70px;
        width: 100%;
        background: var(--primary-color, #ffffff);
        flex-direction: column;
        align-items: center;

    /* Ensure the toggle button is clickable above other elements on small screens */
    .menu-toggle {
        background: transparent;
        border: none;
        padding: 0.5rem;
        z-index: 1201;
        pointer-events: auto;
        color: var(--text-color);
    }

    .menu-toggle span {
        display: block;
    }
        justify-content: center;
        gap: 20px;
        padding: 25px 0;
        display: none;
        z-index: 1100;
        box-shadow: 0 4px 14px rgba(0,0,0,0.15);
        animation: fadeMenu 0.25s ease-out;
        max-height: calc(100vh - 70px);
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
        transition: opacity 0.22s ease, transform 0.22s ease;
        transform-origin: top;
    }

    /* Cuando no está activo, lo hacemos invisible pero permitimos animación
       y soportamos tanto las clases .show-menu como .active (compatibilidad). */
    .nav-menu:not(.show-menu):not(.active) {
        opacity: 0;
        transform: translateY(-6px);
        pointer-events: none;
    }

    /* Menú abierto */
    .nav-menu.show-menu,
    .nav-menu.active {
        display: flex !important;
        opacity: 1;
        transform: translateY(0);
        pointer-events: auto;
    }

    /* On small screens allow nav to wrap vertically (mobile overlay) */
    .nav-menu {
        flex: 0 0 auto;
        width: 100%;
    }

    .nav-menu li {
        width: 100%;
        padding: 0;
        text-align: center;
    }

    .nav-menu a {
        width: 100%;
        display: block;
        padding: 12px 18px;
        font-size: 18px;
        box-sizing: border-box;
        text-align: center;
    }

    /* Botón iniciar sesión corregido */
    .btn-login {
        width: 80%;
        max-width: 250px;
        margin-top: 10px;
        padding: 12px 18px;
        font-size: 17px;
    }

    /* Centrar botón de iniciar sesión dentro del menú móvil */
    .nav-menu .btn-login {
        display: inline-block;
        margin: 0.5rem auto 0 auto;
        text-align: center;
    }

    /* Ajustes de logo y controles para pantallas pequeñas */
    .logo {
        gap: 0.45rem;
    }

    .logo img.logo-img {
        height: clamp(24px, 6.5vw, 36px);
    }

    .logo img.logo-secondary {
        height: clamp(18px, 5.5vw, 26px);
    }

    .header-controls {
        gap: 0.5rem;
    }

}

/* Animación */
@keyframes fadeMenu {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Keep fixed 100x100 across breakpoints; reduce slightly on very small screens */
@media (max-width: 480px) {
    .footer-logo .footer-logo-large {
        width: 100px;
        height: 100px;
        max-width: 100px;
    }
    .logo {
        position: relative;
        margin-left: 12px;
        z-index: 1065;
        display: inline-flex;
        align-items: center;
        gap: 0.6rem;
    }

    /* Create breathing room on the left so centered nav/menu doesn't collide
       with the logos. Tweak this value if you need more/less space. */
    .navbar .container {
        padding-left: 20px;
        padding-right: 20px;
        height: 100%;
        align-items: center;
        display: flex;
        gap: 1rem;
        /* make the container a single-line flex row so logo, nav and controls sit inline */
        flex-wrap: nowrap;
    }
    /* Desktop: logo scales responsively but kept harmonious (smaller than before) */
    .logo img.logo-img {
        height: clamp(36px, 4.5vw, 72px);
        width: auto;
        max-height: 72px;
        object-fit: contain;
        display: block;
    }

    /* Place nav in the middle by allowing it to grow and centering its contents */
    .nav-menu {
        position: static;
        transform: none;
        display: flex !important;
        justify-content: center;
        align-items: center;
        gap: 1.75rem;
        margin: 0;
        width: auto;
        flex: 1 1 auto;
        flex-wrap: nowrap;
        list-style: none;
    }

    /* Keep header controls (theme, menu toggle, login) to the right */
    .header-controls {
        position: relative;
        margin-left: auto;
        z-index: 1050;
        display: flex;
        align-items: center;
        gap: 0.75rem;
    }
    /* Keep header controls aligned to the right using flex (avoid absolute to prevent overlap/clipping) */
    .header-controls {
        position: relative;
        margin-left: auto;
        z-index: 1050;
        display: flex;
        align-items: center;
        gap: 0.75rem;
    }
    /* Desktop: center the nav then shift horizontally using the CSS variable
       --nav-menu-shift. This moves the whole menu block to the right without
       changing its centered alignment logic. */
    /* Desktop: place nav in the normal flow so it doesn't get covered by the logo.
       Use margin auto to keep it centered between logo and controls. */
    .nav-menu {
        position: static;
        transform: none;
        display: flex !important;
        justify-content: center;
        align-items: center;
        gap: 2rem;
        margin: 0 auto;
        width: auto;
        background: transparent;
        box-shadow: none;
        z-index: 1040;
    }

    /* Desktop: ensure login button is visible and not clipped */
    .btn-login {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        padding: 10px 18px;
        white-space: nowrap;
        z-index: 1060;
        border-radius: 999px;
        line-height: 1;
    }

    /* Larger fixed logo for very wide screens */
    @media (min-width: 1200px) {
        .logo img.logo-img {
            height: 120px;
            width: auto;
        }
        .navbar {
            min-height: 120px;
        }
    }
}

/* Modal de Usuario - Admin */
.user-modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    align-items: center;
    justify-content: center;
}

.user-modal-overlay.active {
    display: flex;
}

.user-modal-content {
    background: white;
    border-radius: 12px;
    max-width: 600px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

.user-modal-header {
    padding: 1.5rem;
    border-bottom: 1px solid #e9ecef;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.user-modal-header h2 {
    margin: 0;
    color: #333;
}

.user-modal-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: #999;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.3s;
}

.user-modal-close:hover {
    color: #333;
}

.user-modal-body {
    padding: 1.5rem;
}

.user-detail-grid {
    display: grid;
    gap: 1rem;
}

.user-detail-row {
    display: grid;
    grid-template-columns: 120px 1fr;
    gap: 0.5rem;
    align-items: center;
}

.user-detail-label {
    color: #666;
    font-weight: 600;
}

.user-badge {
    padding: 0.25rem 0.75rem;
    color: white;
    border-radius: 4px;
    display: inline-block;
    width: fit-content;
    font-size: 0.875rem;
}

.user-badge.admin {
    background: #dc3545;
}

.user-badge.user {
    background: #28a745;
}

.user-badge.active {
    background: #28a745;
}

.user-badge.inactive {
    background: #dc3545;
}

/* Botones de acción en tablas admin */
.admin-action-btn {
    border: none;
    padding: 0.4rem 0.8rem;
    border-radius: 4px;
    cursor: pointer;
    margin-right: 0.25rem;
    font-size: 0.875rem;
    transition: opacity 0.3s;
}

.admin-action-btn:hover {
    opacity: 0.8;
}

.admin-action-btn.btn-view {
    background: #007bff;
    color: white;
}

.admin-action-btn.btn-toggle {
    color: white;
}

.admin-action-btn.btn-toggle.deactivate {
    background: #dc3545;
}

.admin-action-btn.btn-toggle.activate {
    background: #28a745;
}

/* Tema oscuro para modal de usuario */
body.dark-theme .user-modal-content {
    background: #2a2a2a;
}

body.dark-theme .user-modal-header {
    border-bottom-color: #3a3a3a;
}

body.dark-theme .user-modal-header h2 {
    color: #ffffff;
}

body.dark-theme .user-modal-close {
    color: #aaaaaa;
}

body.dark-theme .user-modal-close:hover {
    color: #ffffff;
}

body.dark-theme .user-detail-label {
    color: #aaaaaa;
}

body.dark-theme .user-detail-row span:not(.user-badge) {
    color: #ffffff;
}

/* Zonas Térmicas Page */
.zonas-termicas-page {
    padding: 3rem 0;
    min-height: calc(100vh - 80px);
}

.zonas-termicas-header {
    text-align: center;
    margin-bottom: 3rem;
}

.zonas-termicas-header h1 {
    color: #000000;
    margin-bottom: 1rem;
}

body.dark-theme .zonas-termicas-header h1 {
    color: #ffffff;
}

.zonas-termicas-header p {
    color: #666666;
    font-size: 1.1rem;
}

body.dark-theme .zonas-termicas-header p {
    color: #cccccc;
}

.zonas-termicas-container {
    max-width: 1200px;
    margin: 0 auto;
}

.region-selector-box {
    background: white;
    padding: 2rem;
    border-radius: 12px;
    box-shadow: 0 2px 12px rgba(0,0,0,0.08);
    margin-bottom: 2rem;
}

body.dark-theme .region-selector-box {
    background: var(--primary-dark);
}

.region-selector-label {
    display: block;
    font-weight: 600;
    margin-bottom: 1rem;
    font-size: 1.1rem;
    color: #000000;
}

body.dark-theme .region-selector-label {
    color: #ffffff;
}

.region-selector {
    width: 100%;
    padding: 1rem;
    font-size: 1rem;
    border: 2px solid #e9ecef;
    border-radius: 8px;
    background: white;
    cursor: pointer;
    transition: all 0.3s;
}

.region-selector:focus {
    border-color: var(--secondary-color);
    outline: none;
}

.image-container-box {
    background: white;
    padding: 2rem;
    border-radius: 12px;
    box-shadow: 0 2px 12px rgba(0,0,0,0.08);
    text-align: center;
}

.placeholder-content {
    padding: 4rem 2rem;
    color: #999;
}

.placeholder-content svg {
    margin: 0 auto 1rem;
}

.placeholder-content p {
    font-size: 1.1rem;
}

.image-content {
    display: none;
}

.image-content.active {
    display: block;
}

.region-title {
    color: #000000;
    margin-bottom: 1.5rem;
    font-size: 1.8rem;
}

body.dark-theme .region-title {
    color: #ffffff;
}

.thermal-image-wrapper {
    position: relative;
    display: inline-block;
    max-width: 100%;
}

.thermal-image {
    max-width: 100%;
    height: auto;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.1);
}

.zone-info-box {
    margin-top: 2rem;
    padding: 1.5rem;
    background: #f8f9fa;
    border-radius: 8px;
    text-align: left;
}

.zone-info-box h3 {
    color: var(--dark-color);
    margin-bottom: 1rem;
}

.zone-info-box p {
    color: #666;
    line-height: 1.6;
}

/* Auth Pages - Floating Theme Toggle */
.auth-theme-toggle {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 1000;
    display: inline-flex;
    align-items: center;
    padding: 0.5rem;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 50%;
    backdrop-filter: blur(10px);
    text-decoration: none;
}

/* Profile Form */
.profile-form .readonly-field {
    background-color: #f5f5f5;
    cursor: not-allowed;
}

.profile-form .field-note {
    color: #666;
    font-size: 0.85em;
    display: block;
    margin-top: 0.25rem;
}

/* CTA Section */
.cta-section {
    background: linear-gradient(135deg, var(--secondary-color) 0%, #ffd85a 100%);
    padding: 4rem 0;
    margin-top: 4rem;
}

.cta-section .cta-inner {
    text-align: center;
    color: #111;
}

.cta-section .cta-title {
    margin-bottom: 1rem;
    font-size: 2rem;
    color: #000;
}

.cta-section .cta-copy {
    font-size: 1.2rem;
    margin-bottom: 2rem;
    opacity: 0.95;
    color: rgba(0,0,0,0.85);
}

.cta-section .cta-cta,
.cta-section .btn-primary {
    background: white;
    color: var(--secondary-color);
    box-shadow: 0 8px 24px rgba(0,0,0,0.12);
    border-radius: 10px;
    padding: 0.75rem 1.4rem;
}

/* CTA actions layout: align buttons and spacing */
.cta-actions {
    display: inline-flex;
    gap: 12px;
    justify-content: center;
    align-items: center;
    margin-top: 8px;
}
.cta-section .cta-contact,
.cta-section .btn-secondary {
    background: transparent;
    color: #111;
    border: 1px solid rgba(0,0,0,0.06);
    padding: 0.7rem 1.2rem;
    border-radius: 10px;
}
.cta-section .cta-contact:hover,
.cta-section .btn-secondary:hover {
    background: rgba(0,0,0,0.04);
}

/* Team Section - About Page */
.team-section {
    padding: 4rem 0;
}

.team-group {
    margin-bottom: 5rem;
}

.team-group h2 {
    text-align: center;
    margin-bottom: 2.5rem;
    font-size: 2rem;
    color: #000000;
}

body.dark-theme .team-group h2 {
    color: #ffffff;
}

.team-grid {
    display: flex;
    flex-direction: column;
    gap: 0;
}

.team-member {
    padding: 1.5rem 0;
    border-bottom: 1px solid #e0e0e0;
}

.team-member:last-child {
    border-bottom: none;
}

.team-member h3 {
    margin: 0 0 0.5rem 0;
    font-size: 1.25rem;
    color: var(--dark-color);
}

.team-member .role {
    margin: 0.25rem 0;
    color: #666;
    font-size: 0.95rem;
}

.team-member .contact {
    margin: 0.5rem 0 0 0;
    font-size: 0.9rem;
}

.team-member .contact a {
    color: var(--secondary-color);
    text-decoration: none;
    transition: var(--transition);
}

.team-member .contact a:hover {
    text-decoration: underline;
}

/* Dark theme para team members */
body.dark-theme .team-member {
    border-bottom-color: #444;
}

body.dark-theme .team-member h3 {
    color: #ffffff;
}

body.dark-theme .team-member .role {
    color: #aaaaaa;
}

/* Admin Tables - Loading/Error States */
.table-loading,
.table-error,
.table-empty {
    text-align: center;
    padding: 2rem;
}

.table-loading {
    color: #666666;
}

body.dark-theme .table-loading {
    color: #cccccc;
}

.table-error {
    color: #dc3545;
}

body.dark-theme .table-error {
    color: #ff6b6b;
}

.table-empty {
    color: #666666;
}

body.dark-theme .table-empty {
    color: #cccccc;
}

/* Admin Center Column */
.admin-center-col {
    text-align: center;
}

/* Success Alert */
.alert-success {
    padding: 1rem;
    background: #d4edda;
    border: 1px solid #c3e6cb;
    border-radius: 8px;
    margin-bottom: 2rem;
    color: #155724;
}

body.dark-theme .alert-success {
    background: rgba(40, 167, 69, 0.2);
    border-color: #28a745;
    color: #4dff88;
}

/* Module/Chapter Inline Styles Helper Classes */
.progress-indicator {
    position: relative;
}

.bg-image-container {
    background-size: cover;
    background-position: center;
}

.hidden {
    display: none;
}

.text-center {
    text-align: center;
}

/* Dark theme adjustments for new classes */
body.dark-theme .region-selector-box,
body.dark-theme .image-container-box {
    background: #2a2a2a;
}

body.dark-theme .region-selector {
    background: #1a1a1a;
    color: #ffffff;
    border-color: #3a3a3a;
}

body.dark-theme .zone-info-box {
    background: #1a1a1a;
}

body.dark-theme .zone-info-box h3,
body.dark-theme .region-title {
    color: #ffffff;
}

body.dark-theme .zone-info-box p {
    color: #aaaaaa;
}

/* ==================== FILE DOWNLOAD STYLES ==================== */
.chapter-files {
    background: white;
    padding: 2rem;
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow);
    margin: 2rem 0;
}

body.dark-theme .chapter-files {
    background: var(--primary-dark);
}

.chapter-files h3 {
    color: #000000;
    margin-bottom: 1.5rem;
    font-size: 1.5rem;
}

body.dark-theme .chapter-files h3 {
    color: #ffffff;
}

.chapter-files ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.chapter-files li {
    margin-bottom: 0.75rem;
}

.file-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 1rem;
    background: #f8f9fa;
    border-radius: 8px;
    border: 1px solid #e9ecef;
    transition: all 0.3s ease;
}

.file-item:hover {
    background: #e9ecef;
    border-color: var(--primary-color);
    transform: translateX(5px);
}

.file-link {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    text-decoration: none;
    color: var(--dark-color);
    flex: 1;
    min-width: 0;
}

.file-icon {
    font-size: 1.5rem;
    flex-shrink: 0;
}

.file-name {
    font-weight: 500;
    color: var(--dark-color);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.file-size {
    color: #6c757d;
    font-size: 0.875rem;
    margin-left: 0.5rem;
    flex-shrink: 0;
}

.file-download-btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    background: var(--primary-color);
    color: var(--dark-color);
    text-decoration: none;
    border-radius: 6px;
    font-weight: 600;
    font-size: 0.9rem;
    transition: all 0.3s ease;
    white-space: nowrap;
    flex-shrink: 0;
}

.file-download-btn:hover {
    background: #e6c200;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(255, 211, 0, 0.3);
}

.file-download-btn svg {
    width: 18px;
    height: 18px;
}

/* Dark theme for files */
body.dark-theme .chapter-files {
    background: #2a2a2a;
}

body.dark-theme .chapter-files h3 {
    color: #ffffff;
}

body.dark-theme .file-item {
    background: #1a1a1a;
    border-color: #3a3a3a;
}

body.dark-theme .file-item:hover {
    background: #2a2a2a;
    border-color: var(--primary-color);
}

body.dark-theme .file-link,
body.dark-theme .file-name {
    color: #ffffff;
}

body.dark-theme .file-size {
    color: #aaaaaa;
}

/* Responsive files */
@media (max-width: 768px) {
    .file-item {
        flex-direction: column;
        align-items: stretch;
        gap: 0.75rem;
    }
    
    .file-link {
        width: 100%;
    }
    
    .file-download-btn {
        width: 100%;
        justify-content: center;
    }
}

/* ==================== DARK THEME - FOOTER ==================== */
body.dark-theme footer {
    /* Keep same solid color in dark theme to ensure consistent appearance */
    background: #353333;
}

body.dark-theme .footer-section h3,
body.dark-theme .footer-section h4 {
    color: var(--primary-color);
}

body.dark-theme .footer-section p,
body.dark-theme .footer-menu a,
body.dark-theme .footer-bottom p,
body.dark-theme .footer-links a {
    color: rgba(255, 255, 255, 0.7);
}

body.dark-theme .footer-menu a:hover {
    color: var(--primary-color);
}

body.dark-theme .footer-bottom {
    border-top-color: rgba(255, 255, 255, 0.1);
}

/* Make H4 headings more visible in dark mode across the site */
body.dark-theme h4 {
    color: #ffffff;
}

/* Ensure footer h4 headings are always white for contrast */
footer .footer-section h4 {
    color: #ffffff !important;
}

/* Footer color override for mobile dark view */
@media (max-width: 768px) {
    body.dark-theme footer {
        background: #353333 !important;
    }
}

/* -----------------------------
   Minimal fix: mobile nav overlay
   Forces the public nav to behave like the admin overlay
   when open, without touching other layout rules.
   ----------------------------- */
@media (max-width: 900px) {
    /* Ensure active/open menu is a full-width fixed overlay under header */
    .nav-menu.show-menu,
    .nav-menu.active {
        position: fixed !important;
        left: 0 !important;
        right: 0 !important;
        top: 70px !important;
        width: 100% !important;
        display: flex !important;
        flex-direction: column !important;
        align-items: center !important;
        justify-content: flex-start !important;
        z-index: 1200 !important;
        box-shadow: 0 4px 14px rgba(0,0,0,0.15) !important;
        background: var(--primary-color) !important;
        max-height: calc(100vh - 70px) !important;
        overflow-y: auto !important;
        -webkit-overflow-scrolling: touch !important;
        opacity: 1 !important;
        transform: translateY(0) !important;
        pointer-events: auto !important;
    }

    /* When closed, hide completely so it doesn't reserve space */
    .nav-menu:not(.show-menu):not(.active) {
        display: none !important;
        opacity: 0 !important;
        pointer-events: none !important;
    }
}