/* Tokens de diseño — tema oscuro (Fase 1) */
:root {
    --bg: #14171B;
    --bg-elev: #1B2026;
    --surface: #222830;
    --surface-2: #2A313A;
    --border: #3A434E;
    --text: #F3F5F7;
    --text-muted: #B3BAC3;
    --text-dim: #8B949E;
    --primary: #34678a;
    --primary-dark: #2a4f6b;
    --primary-light: #88B9D7;
    --accent: #07969B;
    --accent-dark: #057a7e;
    --accent-soft: #3FB6BB;
    --promo: #E8C47C;
    --focus: #88B9D7;
    --radius: 12px;
    --radius-sm: 8px;
    --font-body: "Inter", "Segoe UI", system-ui, sans-serif;
    --font-brand: "Saira", "Inter", sans-serif;

    /* Alias para CSS existente del sitio */
    --primary-color: var(--primary);
    --secondary-color: var(--accent);
    --accent-color: var(--primary-light);
    --neutral-color: var(--surface-2);
    --secondary-light: var(--accent-soft);
    --secondary-dark: var(--accent-dark);
    --accent-light: #a0c7e0;
    --bg-primary: var(--bg);
    --bg-secondary: var(--bg-elev);
    --bg-card: var(--surface);
    --bg-navbar: var(--bg-elev);
    --text-primary: var(--text);
    --text-secondary: var(--text-muted);
    --border-color: var(--border);
    --border-radius: var(--radius-sm);
    --border-radius-lg: var(--radius);
    --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.25);
    --shadow-md: 0 4px 10px rgba(0, 0, 0, 0.35);
    --shadow-lg: 0 8px 20px rgba(0, 0, 0, 0.45);
    --btn-primary-bg: #057a7e;
    --btn-primary-hover: #046568;
    --btn-secondary-border: #6A808C;
    --content-max: 1120px;

    --text-xs:   0.70rem;
    --text-sm:   0.80rem;
    --text-base: 1rem;
    --text-md:   1.1rem;
    --text-lg:   1.25rem;

    --font-normal:    400;
    --font-medium:    500;
    --font-semibold:  600;
    --font-bold:      700;
    --font-extrabold: 800;
}

/* Estilos generales */
html {
    scroll-padding-top: 5.5rem;
}

body {
    font-family: var(--font-body);
    font-size: 16px;
    line-height: 1.65;
    color: var(--text);
    background-color: var(--bg);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

main {
    flex: 1;
}

main:focus {
    outline: none;
}

h1, h2, h3, h4, h5, h6,
.h1, .h2, .h3, .h4, .h5, .h6 {
    font-family: var(--font-brand);
    font-weight: 700;
    color: var(--text);
}

.container,
.container-lg,
.container-md,
.container-sm,
.container-xl,
.container-xxl {
    max-width: var(--content-max);
}

/* Escala tipográfica */
.text-xs { font-size: var(--text-xs); }
.text-sm { font-size: var(--text-sm); }

/* Enlaces */
a {
    color: var(--accent-soft);
    text-decoration: none;
    transition: color 0.2s ease;
}

a:hover {
    color: var(--primary-light);
}

/* Foco visible (pisa outline:none de Bootstrap) */
:focus {
    outline: none;
}

:focus-visible {
    outline: 2px solid var(--focus) !important;
    outline-offset: 3px !important;
}

.skip-link {
    position: absolute;
    left: 1rem;
    top: -100px;
    z-index: 11000;
    padding: 0.75rem 1rem;
    background: var(--btn-primary-bg);
    color: #fff;
    border-radius: var(--radius-sm);
    font-weight: 600;
}

.skip-link:focus,
.skip-link:focus-visible {
    top: 1rem;
    color: #fff;
}

/* Botones */
.btn {
    padding: 0.75rem 1.5rem;
    border-radius: var(--radius-sm);
    font-weight: 600;
    transition: background-color 0.2s ease, border-color 0.2s ease, color 0.2s ease;
    border: 1px solid transparent;
    position: relative;
}

.btn-primary {
    background: var(--btn-primary-bg);
    border-color: var(--btn-primary-bg);
    color: #fff;
    box-shadow: none;
}

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

.btn-primary:active,
.btn-primary.active {
    background: #035a5d;
    border-color: #035a5d;
    color: #fff;
}

.btn-secondary,
.btn-outline-primary,
.btn-outline-secondary,
.btn-outline-light {
    background: transparent;
    color: var(--text);
    border: 1px solid var(--btn-secondary-border);
    box-shadow: none;
}

.btn-secondary:hover,
.btn-outline-primary:hover,
.btn-outline-secondary:hover,
.btn-outline-light:hover,
.btn-secondary:focus-visible,
.btn-outline-primary:focus-visible,
.btn-outline-secondary:focus-visible,
.btn-outline-light:focus-visible {
    background: var(--surface-2);
    color: var(--text);
    border-color: var(--primary-light);
}

/* ===== Site header (Fase 1) ===== */
.site-header {
    position: sticky;
    top: 0;
    z-index: 1040;
    background: rgba(27, 32, 38, 0.92);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--border);
}

.site-header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    min-height: 4.25rem;
    padding-top: 0.65rem;
    padding-bottom: 0.65rem;
}

.site-brand {
    display: inline-flex;
    align-items: center;
    gap: 0.75rem;
    color: var(--text);
    text-decoration: none;
    min-height: 44px;
}

.site-brand:hover {
    color: var(--text);
}

.site-brand-mark {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    border-radius: 10px;
    background: #fff;
    flex-shrink: 0;
}

.site-brand-mark img {
    display: block;
    width: 32px;
    height: 32px;
    object-fit: contain;
}

.site-brand-wordmark {
    font-family: var(--font-brand);
    font-weight: 800;
    font-size: 1.35rem;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--text) !important;
}

.site-nav-toggle {
    display: none;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    padding: 0;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--surface);
    color: var(--text);
}

.site-nav-toggle-bars,
.site-nav-toggle-bars::before,
.site-nav-toggle-bars::after {
    display: block;
    width: 18px;
    height: 2px;
    background: currentColor;
    border-radius: 1px;
    position: relative;
}

.site-nav-toggle-bars::before,
.site-nav-toggle-bars::after {
    content: '';
    position: absolute;
    left: 0;
}

.site-nav-toggle-bars::before { top: -6px; }
.site-nav-toggle-bars::after { top: 6px; }

.site-nav {
    display: flex !important;
    flex: 1;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

.site-nav-list {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    list-style: none;
    margin: 0;
    padding: 0;
}

.site-nav-link {
    display: inline-flex;
    align-items: center;
    min-height: 44px;
    padding: 0.5rem 0.85rem;
    border-radius: var(--radius-sm);
    color: var(--text-muted);
    font-weight: 600;
}

.site-nav-link:hover,
.site-nav-link:focus-visible {
    color: var(--text);
    background: var(--surface);
}

.site-header-actions {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-left: auto;
}

.site-header-actions .btn {
    min-height: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.site-user-toggle {
    color: var(--text) !important;
    min-height: 44px;
}

@media (max-width: 991.98px) {
    .site-nav-toggle {
        display: inline-flex;
        margin-left: auto;
    }

    .site-nav.collapse:not(.show) {
        display: none !important;
    }

    .site-nav.collapse.show,
    .site-nav.collapsing {
        display: flex !important;
        flex-direction: column;
        align-items: stretch;
        width: 100%;
        flex-basis: 100%;
        padding: 0.75rem 0 1rem;
        gap: 1rem;
    }

    .site-nav-list {
        flex-direction: column;
        align-items: stretch;
        width: 100%;
    }

    .site-nav-link {
        width: 100%;
    }

    .site-header-actions {
        margin-left: 0;
        flex-direction: column;
        align-items: stretch;
        width: 100%;
    }

    .site-header-actions .btn,
    .site-header-actions .dropdown {
        width: 100%;
    }

    .site-header-inner {
        flex-wrap: wrap;
    }
}

/* Header y navegación (legado / panel) */
.navbar {
    background: var(--bg-navbar) !important;
    box-shadow: var(--shadow-sm);
    padding: 1rem 0;
    transition: all 0.3s ease;
}

.navbar-brand {
    font-weight: 800;
    font-size: 1.5rem;
    color: var(--primary-color) !important;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.navbar-nav .nav-link {
    font-weight: 600;
    color: var(--text-primary) !important;
    margin: 0 0.5rem;
    padding: 0.5rem 1rem !important;
    border-radius: 0px;
    transition: all 0.3s ease;
}

.navbar-nav .nav-link:hover {
    color: var(--primary-color) !important;
    background-color: rgba(52, 103, 138, 0.1);
    transform: translateY(-1px);
}

.navbar-nav .nav-link.active {
    color: var(--primary-color) !important;
    background-color: rgba(52, 103, 138, 0.15);
    font-weight: 600;
}



/* Estilos para el dropdown del primer menú en modo claro */
.navbar-dark .dropdown-menu {
    background-color: white !important;
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-lg);
}

.navbar-dark .dropdown-item {
    color: var(--text-primary) !important;
}

.navbar-dark .dropdown-item:hover {
    background-color: rgba(52, 103, 138, 0.1);
    color: var(--primary-color) !important;
}

/* Estilos para el buscador y toggle en el primer menú */
.navbar-dark .input-group {
    max-width: 350px;
}

.navbar-dark .form-control {
    background-color: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.2);
    color: white;
}

.navbar-dark .form-control::placeholder {
    color: rgba(255, 255, 255, 0.7);
}

.navbar-dark .form-control:focus {
    background-color: rgba(255, 255, 255, 0.15);
    border-color: var(--accent-color);
    color: white;
    box-shadow: 0 0 0 0.2rem rgba(136, 185, 215, 0.25);
}

.navbar-dark .btn-outline-light {
    border-color: rgba(255, 255, 255, 0.2);
    color: white;
}

.navbar-dark .btn-outline-light:hover {
    background-color: rgba(255, 255, 255, 0.1);
    border-color: var(--accent-color);
    color: white;
}

/* Estilos para el buscador en modo claro */
.navbar-light .input-group {
    max-width: 350px;
}

.navbar-light .form-control {
    background-color: white;
    border: 1px solid var(--text-primary);
    color: var(--text-primary);
}

.navbar-light .form-control::placeholder {
    color: var(--text-primary);
    opacity: 0.7;
}

.navbar-light .form-control:focus {
    background-color: white;
    border-color: var(--primary-color);
    color: var(--text-primary);
    box-shadow: 0 0 0 0.2rem rgba(13, 110, 253, 0.25);
}

.navbar-light .btn-outline-secondary {
    border-color: var(--text-primary);
    color: var(--text-primary);
}

.navbar-light .btn-outline-secondary:hover {
    background-color: var(--text-primary);
    border-color: var(--text-primary);
    color: white;
}

/* Estilos para btn-outline-dark en modo claro */
.navbar-light .btn-outline-dark {
    border-color: var(--text-primary);
    color: var(--text-primary);
}

.navbar-light .btn-outline-dark:hover {
    background-color: var(--text-primary);
    border-color: var(--text-primary);
    color: white;
}

/* Estilos para btn-outline-dark en modo oscuro */
.navbar-dark .btn-outline-dark {
    border-color: white;
    color: white;
}

.navbar-dark .btn-outline-dark:hover {
    background-color: white;
    border-color: white;
    color: var(--neutral-color);
}

/* Estilos para el dropdown en modo claro */
.navbar-light .dropdown-menu {
    background-color: white;
    border: 1px solid rgba(0, 0, 0, 0.15);
    box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.175);
}

.navbar-light .dropdown-item {
    color: #212529;
}

.navbar-light .dropdown-item:hover {
    background-color: #f8f9fa;
    color: #16181b;
}

.navbar-light .dropdown-item.text-danger {
    color: #dc3545 !important;
}

.navbar-light .dropdown-item.text-danger:hover {
    background-color: #dc3545;
    color: white !important;
}

.navbar-light .dropdown-divider {
    border-top: 1px solid #dee2e6;
}

/* Estilos para el botón del usuario en modo claro */
.navbar-light .btn-link {
    color: var(--text-primary);
    text-decoration: none;
}

.navbar-light .btn-link:hover {
    color: var(--primary-color);
}

.navbar-light .btn-link:focus {
    color: var(--primary-color);
    box-shadow: none;
}

/* Estilos para el nombre de usuario en modo claro */
.navbar-light .user-name {
    color: var(--text-primary);
}

/* Toggle flotante de modo oscuro/claro */
.theme-toggle-floating {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    z-index: 9999;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
}

.theme-toggle-floating:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.4);
}

.theme-toggle-floating:active {
    transform: translateY(0);
}

/* Responsive para móvil */
@media (max-width: 768px) {
    /* Layout móvil reorganizado */
    .navbar-dark .header-user-section {
        order: -1;
        width: 100%;
        margin-bottom: 1rem;
        flex-direction: column;
        align-items: stretch;
        padding: 0 1rem;
    }
    
    .navbar-dark .search-form {
        width: 100%;
        margin-right: 0;
        margin-bottom: 0.5rem;
    }
    
    .navbar-dark .input-group,
    .navbar-light .input-group {
        width: 100%;
        max-width: none;
        margin: 0;
    }
    
    .navbar-dark .form-control {
        font-size: 0.9rem;
        padding-left: 1rem;
    }
    
    .navbar-dark .user-dropdown {
        width: 100%;
        text-align: left;
    }
    
    .navbar-dark .user-dropdown .btn-link {
        width: 100%;
        justify-content: flex-start;
        padding: 0.5rem 1rem;
        margin-left: 0;
    }
    
    .navbar-dark .btn-outline-light,
    .navbar-light .btn-outline-dark {
        padding: 0.375rem 0.75rem;
        font-size: 0.9rem;
    }
    
    /* Estilos para modo claro en móvil */
    .navbar-light .header-user-section {
        order: -1;
        width: 100%;
        margin-bottom: 1rem;
        flex-direction: column;
        align-items: stretch;
        padding: 0 1rem;
    }
    
    .navbar-light .search-form {
        width: 100%;
        margin-right: 0;
        margin-bottom: 0.5rem;
    }
    
    .navbar-light .input-group {
        width: 100%;
        max-width: none;
    }
    
    .navbar-light .form-control {
        font-size: 0.9rem;
        padding-left: 1rem;
    }
    
    .navbar-light .user-dropdown {
        width: 100%;
        text-align: left;
    }
    
    .navbar-light .user-dropdown .btn-link {
        width: 100%;
        justify-content: flex-start;
        padding: 0.5rem 1rem;
        margin-left: 0;
    }
    
    /* Dropdown menu en móvil */
    .navbar-dark .dropdown-menu,
    .navbar-light .dropdown-menu {
        width: 100%;
        margin-top: 0.5rem;
        border-radius: 0;
        box-shadow: var(--shadow-lg);
    }
    
    .navbar-dark .dropdown-item,
    .navbar-light .dropdown-item {
        padding: 0.75rem 1rem;
        border-bottom: 1px solid var(--border-color);
    }
    
    .navbar-dark .dropdown-item:last-child,
    .navbar-light .dropdown-item:last-child {
        border-bottom: none;
    }
    
    .navbar-dark .dropdown-divider,
    .navbar-light .dropdown-divider {
        margin: 0.5rem 1rem;
    }
    
    .navbar-light .btn-outline-secondary {
        padding: 0.375rem 0.75rem;
        font-size: 0.9rem;
    }
    
    /* Toggle flotante en móvil */
    .theme-toggle-floating {
        bottom: 15px;
        right: 15px;
        width: 45px;
        height: 45px;
        font-size: 1.1rem;
    }
}

/* Alineación del header en desktop */
@media (min-width: 769px) {
    .navbar-dark .header-user-section {
        align-items: center;
    }
    
    .navbar-dark .search-form {
        margin-bottom: 0;
    }
    
    .navbar-dark .user-dropdown {
        margin-top: 0;
    }
    
    .navbar-dark .user-dropdown .btn-link {
        padding: 0.5rem 1rem;
        align-items: center;
    }
    
    /* Alineación del header en modo claro para desktop */
    .navbar-light .header-user-section {
        align-items: center;
    }
    
    .navbar-light .search-form {
        margin-bottom: 0;
    }
    
    .navbar-light .user-dropdown {
        margin-top: 0;
    }
    
    .navbar-light .user-dropdown .btn-link {
        padding: 0.5rem 1rem;
        align-items: center;
    }
}

/* Rango lg-only (992px-1199.98px): con navbar-expand-lg el navbar ya está
   expandido (sin hamburguesa) pero el .container todavía mide solo 960px.
   Con 3+ links de navegación + buscador + nombre de usuario largo, el
   .input-group puede partirse en dos líneas o el nombre puede desbordar
   el contenedor. Se ajusta el espaciado solo en esta franja angosta; no
   afecta el móvil (<992px, ya resuelto arriba) ni el desktop real (>=1200px). */
@media (min-width: 992px) and (max-width: 1199.98px) {
    .navbar-nav .nav-link {
        margin: 0 0.25rem;
        padding: 0.5rem 0.6rem !important;
    }

    .navbar-dark .input-group,
    .navbar-light .input-group {
        max-width: 150px;
    }

    .header-user-section .user-name {
        max-width: 130px;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
        display: inline-block;
    }
}



/* Cards */
.card {
    border: none;
    border-radius: var(--border-radius-lg);
    background: var(--bg-card);
    box-shadow: var(--shadow-sm);
    transition: all 0.3s ease;
    overflow: hidden;
}

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

.card-body {
    padding: 2rem;
}

.card-title {
    color: var(--text);
    font-weight: 700;
    margin-bottom: 1rem;
}

/* Hero Section */
.hero-section {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: white;
    padding: 6rem 0;
    position: relative;
    overflow: hidden;
    min-height: calc(100vh - 80px);
    display: flex;
    align-items: center;
}

.hero-section::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100"><defs><pattern id="grain" width="100" height="100" patternUnits="userSpaceOnUse"><circle cx="25" cy="25" r="1" fill="rgba(255,255,255,0.1)"/><circle cx="75" cy="75" r="1" fill="rgba(255,255,255,0.1)"/><circle cx="50" cy="10" r="0.5" fill="rgba(255,255,255,0.1)"/><circle cx="10" cy="60" r="0.5" fill="rgba(255,255,255,0.1)"/><circle cx="90" cy="40" r="0.5" fill="rgba(255,255,255,0.1)"/></pattern></defs><rect width="100" height="100" fill="url("#grain#grain")"/></svg>');
    opacity: 0.3;
}

.hero-content {
    position: relative;
    z-index: 2;
}

.hero-content-wrapper {
    min-height: 60vh;
    padding: 2rem 0;
}

/* Overlay + panel de copy: contraste sobre foto de ciudad */
.hero-section .hero-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.72);
    z-index: 1;
    pointer-events: none;
}

.hero-copy {
    max-width: 56rem;
    padding: 1.25rem 1.5rem;
    border-radius: 0.75rem;
    background: rgba(0, 0, 0, 0.4);
}

/* Flecha animada para scroll */
.hero-scroll-indicator {
    position: absolute;
    bottom: 2rem;
    left: 50%;
    transform: translateX(-50%);
    z-index: 3;
}

.scroll-arrow {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100px;
    height: 100px;
    background-color: rgba(255, 255, 255, 0.2);
    border: 2px solid rgba(255, 255, 255, 0.5);
    border-radius: 50%;
    color: white;
    text-decoration: none;
    transition: all 0.3s ease;
    animation: pulse-arrow 2s infinite;
}

.scroll-arrow:hover {
    background-color: rgba(255, 255, 255, 0.3);
    border-color: rgba(255, 255, 255, 0.8);
    color: white;
    transform: scale(1.1);
}

.scroll-arrow i {
    font-size: 2.4rem;
    animation: bounce-arrow 2s infinite;
}

/* Animación de latido para la flecha */
@keyframes pulse-arrow {
    0% {
        box-shadow: 0 0 0 0 rgba(255, 255, 255, 0.4);
    }
    70% {
        box-shadow: 0 0 0 10px rgba(255, 255, 255, 0);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(255, 255, 255, 0);
    }
}

/* Animación de rebote para el ícono */
@keyframes bounce-arrow {
    0%, 20%, 50%, 80%, 100% {
        transform: translateY(0);
    }
    40% {
        transform: translateY(-5px);
    }
    60% {
        transform: translateY(-3px);
    }
}

.hero-title {
    font-size: 3.5rem;
    font-weight: 900;
    margin-bottom: 1.5rem;
    background: linear-gradient(45deg, #ffffff, var(--accent-color));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.hero-subtitle {
    font-size: 1.25rem;
    margin-bottom: 2rem;
    color: #ffffff;
    opacity: 1;
    font-weight: 500;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.55), 0 2px 12px rgba(0, 0, 0, 0.45);
}

/* Hero: tarjetas de los dos caminos (Autogestión / Administración por Cocual) */
.hero-path-card {
    height: 100%;
    display: flex;
    flex-direction: column;
    padding: 1.25rem;
    background: rgba(0, 0, 0, 0.45);
    border: 1px solid rgba(255, 255, 255, 0.25);
    border-radius: 0.75rem;
}

.hero-path-title {
    font-size: 1.25rem;
    font-weight: 700;
    color: #ffffff;
    margin-bottom: 0.5rem;
}

.hero-path-text {
    color: rgba(255, 255, 255, 0.9);
    font-size: 1rem;
    line-height: 1.5;
    margin-bottom: 1rem;
}

.hero-path-actions {
    margin-top: auto;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.75rem;
}

/* Global .btn { border: none } would leave the outline CTA borderless */
.hero-path-actions .btn-outline-light {
    border: var(--bs-btn-border-width) solid var(--bs-btn-border-color);
}

.hero-path-link {
    color: #ffffff;
    font-weight: 600;
    text-decoration: underline;
    text-underline-offset: 3px;
}

.hero-path-link:hover,
.hero-path-link:focus {
    color: #ffffff;
    text-decoration-thickness: 2px;
}

/* Services Section */
.services-section {
    padding: 6rem 0;
    background: var(--bg-secondary);
}

.service-card {
    background: var(--bg-card);
    border-radius: var(--border-radius-lg);
    padding: 2.5rem;
    text-align: center;
    box-shadow: var(--shadow-sm);
    transition: all 0.3s ease;
    border: 1px solid var(--border-color);
}

.service-card:hover {
    transform: translateY(-8px);
    box-shadow: var(--shadow-lg);
    border-color: var(--accent-color);
}

.service-icon {
    width: 80px;
    height: 80px;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    border-radius: var(--border-radius);
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 1.5rem;
    color: white;
    font-size: 2rem;
}

/* Blog Section */
.blog-section {
    padding: 6rem 0;
}

.blog-card {
    border-radius: var(--border-radius-lg);
    overflow: hidden;
    transition: all 0.3s ease;
}

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

.blog-card .card-img-top {
    height: 200px;
    object-fit: cover;
}

/* Footer */
.site-footer,
footer {
    background: var(--bg-elev);
    color: var(--text-muted);
    padding: 3rem 0 1.5rem;
    margin-top: auto;
    border-top: 1px solid var(--border);
}

.site-footer-heading {
    font-family: var(--font-brand);
    font-weight: 700;
    font-size: 1rem;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--text);
}

.site-footer-copy {
    color: var(--text-muted);
    max-width: 28rem;
}

/* Franja newsletter a todo el ancho, arriba de las columnas */
.site-footer-newsletter {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    gap: 0.75rem 1.5rem;
    padding: 0 0 1rem;
    margin: 0 0 1.5rem;
    border-bottom: 1px solid var(--border);
}
.site-footer-newsletter-intro {
    flex: 1 1 40%;
    min-width: 0;
}
.site-footer-newsletter-title {
    font-family: var(--font-brand);
    font-weight: 700;
    font-size: 1rem;
    letter-spacing: 0.02em;
    color: var(--text);
    margin: 0 0 0.25rem;
    line-height: 1.25;
}
.site-footer-newsletter-copy {
    color: var(--text-muted);
    font-size: 0.875rem;
    line-height: 1.35;
    max-width: 28rem;
}
.site-footer-newsletter .newsletter-signup-footer {
    flex: 1 1 55%;
    min-width: 0;
}
@media (min-width: 992px) {
    .site-footer-newsletter {
        flex-wrap: nowrap;
        align-items: center;
        gap: 1.25rem 1.75rem;
        padding-bottom: 0.9rem;
        margin-bottom: 1.35rem;
    }
    .site-footer-newsletter-intro {
        flex: 0 0 40%;
        max-width: 40%;
    }
    .site-footer-newsletter .newsletter-signup-footer {
        flex: 0 0 calc(60% - 1.75rem);
        max-width: calc(60% - 1.75rem);
    }
}
@media (max-width: 991.98px) {
    .site-footer-newsletter {
        flex-direction: column;
        align-items: stretch;
    }
    .site-footer-newsletter-intro,
    .site-footer-newsletter .newsletter-signup-footer {
        flex: 1 1 auto;
        max-width: none;
        width: 100%;
    }
}

.site-footer-links li {
    margin-bottom: 0.55rem;
    color: var(--text-muted);
}

.site-footer-links a {
    color: var(--accent-soft);
    text-decoration: none;
}

.site-footer-links a:hover {
    color: var(--primary-light);
}

/* Tap targets ≥44×44 en móvil (enlaces de texto del footer) */
@media (max-width: 767.98px) {
    .site-footer-links li {
        margin-bottom: 0.15rem;
    }

    .site-footer-links a {
        display: flex;
        align-items: center;
        width: 100%;
        min-width: 44px;
        min-height: 44px;
        padding-top: 0.25rem;
        padding-bottom: 0.25rem;
    }
}

.site-footer-social {
    color: var(--text-muted);
}

.site-footer-social:hover {
    color: var(--primary-light);
}

.site-footer-rule {
    border-color: var(--border);
    opacity: 1;
    margin: 2rem 0 1.25rem;
}

.site-footer-legal {
    color: var(--text-dim);
    font-size: 0.9rem;
}

footer .social-links a,
.site-footer .social-links a {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 44px;
    min-height: 44px;
    margin-right: 0.15rem;
}

@media (max-width: 767.98px) {
    footer .social-links,
    .site-footer .social-links {
        margin-left: -0.625rem;
    }
}

/* Utilidades */
.text-primary {
    color: var(--accent-soft) !important;
}

.text-secondary {
    color: var(--secondary-color) !important;
}

.text-muted {
    color: var(--text-muted) !important;
}

.bg-primary {
    background-color: var(--primary-color) !important;
}

.bg-secondary {
    background-color: var(--secondary-color) !important;
}

.bg-accent {
    background-color: var(--accent-color) !important;
}

/* Badges */
.badge {
    font-weight: 600;
    padding: 0.5rem 0.75rem;
    border-radius: 0px;
}

.badge.bg-primary {
    background-color: var(--btn-primary-bg) !important;
    color: #fff !important;
}

.badge.bg-secondary,
.badge.text-bg-secondary {
    background-color: var(--btn-primary-bg) !important;
    color: #fff !important;
}

.badge.bg-accent {
    background-color: var(--accent-color) !important;
}

/* Imágenes responsivas */
.img-fluid {
    max-width: 100%;
    height: auto;
}

/* Text truncate utilities */
.text-truncate-2 {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.text-truncate-3 {
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* Estilos para el menú de usuario */
.dropdown-toggle::after {
    margin-left: 0.5rem;
}

.dropdown-menu {
    border: none;
    border-radius: 0px;
    box-shadow: var(--shadow-lg);
    background: var(--bg-card);
    padding: 0.5rem 0;
}

.dropdown-item {
    padding: 0.75rem 1.5rem;
    font-weight: 500;
    color: var(--text-primary);
    transition: all 0.3s ease;
}

.dropdown-item:hover {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: white;
    transform: translateX(5px);
}

.dropdown-item.text-danger:hover {
    background: linear-gradient(135deg, #dc3545, #c82333);
    color: white !important;
}

/* Estilos para la imagen de perfil */
.rounded-circle {
    object-fit: cover;
    border: 3px solid var(--text-primary);
    border-radius: 50% !important;
    box-shadow: var(--shadow-sm);
}

/* Asegurar que las imágenes de perfil sean redondas */
img.rounded-circle {
    border-radius: 50% !important;
}

/* En modo oscuro, mantener el borde azul claro */
body.dark-mode .rounded-circle {
    border-color: var(--accent-color);
}

/* Control de visibilidad del nombre de usuario según el modo */
.user-name {
    color: var(--text-primary);
    font-weight: 600;
    transition: all 0.3s ease;
}

/* En modo oscuro, mantener el nombre visible pero en blanco */
body.dark-mode .user-name {
    color: white;
}

/* Estilos para el botón de usuario */
.btn-link {
    color: var(--text-primary);
    padding: 0.5rem 1rem;
    border-radius: 0px;
    transition: all 0.3s ease;
}

.btn-link:hover {
    text-decoration: none;
    color: var(--primary-color);
    background-color: rgba(52, 103, 138, 0.1);
}

/* Animaciones */
.fade-in {
    animation: fadeIn 0.6s ease-out;
}

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

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

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

.btn, .dropdown-menu, .badge, .form-control, .form-select, .alert {
    border-radius: var(--radius-sm) !important;
}

.card {
    border-radius: var(--radius) !important;
}

/* Responsive */
@media (max-width: 768px) {
    .hero-section {
        /* Content (2-line H1 + panel + stacked CTAs) can exceed 60vh on short phones;
           overflow:hidden would clip the secondary CTA — let height follow content */
        min-height: auto;
        overflow: visible;
        /* fixed attachment janks / clips on iOS mobile */
        background-attachment: scroll !important;
        padding: 1.5rem 0 2.5rem;
    }

    .hero-content-wrapper {
        padding: 0.5rem 0;
    }
    
    .hero-scroll-indicator {
        display: none;
    }
    
    .hero-copy {
        max-width: 100%;
        width: 100%;
        padding: 1rem 1rem;
        box-sizing: border-box;
    }
    
    .hero-title {
        font-size: 2.25rem;
        overflow-wrap: break-word;
        word-break: normal;
        hyphens: none;
    }
    
    .hero-subtitle {
        overflow-wrap: break-word;
    }
    
    .hero-section .d-flex.flex-wrap {
        flex-direction: column;
        align-items: stretch;
        gap: 1rem !important;
    }
    
    /* Full-width CTAs: allow wrap so long labels (e.g. precios UYU) are not truncated */
    .hero-section .btn {
        width: 100%;
        font-size: 1.05rem;
        padding: 0.75rem 1rem;
        white-space: normal;
        overflow: visible;
        text-overflow: unset;
        line-height: 1.35;
        text-align: center;
    }
    
    .hero-section .container-fluid {
        padding-left: 1rem;
        padding-right: 1rem;
    }

    .hero-path-card {
        padding: 1rem;
    }

    .hero-path-text {
        font-size: 0.95rem;
        margin-bottom: 0.75rem;
    }

    .hero-path-actions {
        align-items: stretch;
        text-align: center;
    }
    
    .container {
        padding-left: 1rem;
        padding-right: 1rem;
    }
    
    .service-card {
        margin-bottom: 2rem;
    }
}


/* ===== MODO DARK (alineado a tokens Fase 1; main.js sigue añadiendo .dark-mode) ===== */
body.dark-mode {
    --bg-primary: var(--bg);
    --bg-secondary: var(--bg-elev);
    --bg-card: var(--surface);
    --bg-navbar: var(--bg-elev);
    --text-primary: var(--text);
    --text-secondary: var(--text-muted);
    --border-color: var(--border);
    background-color: var(--bg) !important;
    color: var(--text) !important;
}

body.dark-mode .navbar {
    background: linear-gradient(135deg, var(--bg-navbar), #1a1d21) !important;
    border-bottom: 1px solid var(--border-color) !important;
}

body.dark-mode .navbar .nav-link {
    color: var(--text-primary) !important;
}

body.dark-mode .navbar .nav-link:hover {
    color: var(--accent-color) !important;
    background-color: rgba(136, 185, 215, 0.1);
}

body.dark-mode .navbar .nav-link.active {
    color: var(--accent-color) !important;
    background-color: rgba(136, 185, 215, 0.15);
}

body.dark-mode .navbar-brand {
    color: var(--accent-color) !important;
}

body.dark-mode .dropdown-menu {
    background-color: var(--bg-card) !important;
    border-color: var(--border-color) !important;
}

body.dark-mode .dropdown-item {
    color: var(--text-primary) !important;
}

body.dark-mode .dropdown-item:hover {
    background: linear-gradient(135deg, var(--accent-color), var(--secondary-color));
    color: var(--bg-primary) !important;
}

body.dark-mode .card {
    background-color: var(--bg-card) !important;
    color: var(--text-primary) !important;
    border-color: var(--border-color) !important;
}

body.dark-mode .modal-content {
    background-color: var(--bg-card) !important;
    color: var(--text-primary) !important;
    border-color: var(--border-color) !important;
}

body.dark-mode .modal-header,
body.dark-mode .modal-footer {
    border-color: var(--border-color) !important;
}

body.dark-mode .modal-title {
    color: var(--text-primary) !important;
}

body.dark-mode .btn-close {
    filter: invert(1) grayscale(100%) brightness(200%);
}

body.dark-mode .list-group-item {
    background-color: var(--bg-card) !important;
    color: var(--text-primary) !important;
    border-color: var(--border-color) !important;
}

body.dark-mode .list-group-item-action:hover,
body.dark-mode .list-group-item-action:focus {
    background: linear-gradient(135deg, var(--accent-color), var(--secondary-color)) !important;
    color: var(--bg-primary) !important;
}

body.dark-mode .list-group-item.active {
    background: linear-gradient(135deg, var(--accent-color), var(--secondary-color)) !important;
    color: var(--bg-primary) !important;
    border-color: var(--accent-color) !important;
}

body.dark-mode .btn-link {
    color: var(--text-primary) !important;
}

body.dark-mode .btn-link:hover {
    color: var(--accent-color) !important;
    background-color: rgba(136, 185, 215, 0.1);
}

body.dark-mode .rounded-circle {
    border-color: var(--accent-color) !important;
}

body.dark-mode .text-muted {
    color: var(--text-muted) !important;
}

body.dark-mode .services-section {
    background-color: var(--bg-secondary) !important;
}

body.dark-mode .service-card {
    background-color: var(--bg-card) !important;
    border-color: var(--border-color) !important;
}

body.dark-mode .service-card:hover {
    border-color: var(--accent-color) !important;
}

body.dark-mode .hero-section {
    background: linear-gradient(135deg, var(--primary-dark), var(--secondary-dark));
}

body.dark-mode .hero-title {
    background: linear-gradient(45deg, #ffffff, var(--accent-light));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

body.dark-mode .btn,
body.dark-mode .card,
body.dark-mode .dropdown-menu,
body.dark-mode .badge,
body.dark-mode .form-control,
body.dark-mode .form-select,
body.dark-mode .alert {
    border-radius: var(--radius-sm) !important;
}

body.dark-mode .card {
    border-radius: var(--radius) !important;
}

/* Icono personalizado de X (Twitter) - Diseño oficial */
.x-icon {
    display: inline-block;
    width: 1em;
    height: 1em;
    position: relative;
    vertical-align: middle;
}

.x-icon::before,
.x-icon::after {
    content: '';
    position: absolute;
    background-color: currentColor;
    top: 50%;
    left: 50%;
    width: 0.85em;
    height: 0.12em;
    border-radius: 0.06em;
}

.x-icon::before {
    transform: translate(-50%, -50%) rotate(45deg);
    box-shadow: 0 0 0 0.02em currentColor;
}

.x-icon::after {
    transform: translate(-50%, -50%) rotate(-45deg);
    box-shadow: 0 0 0 0.02em currentColor;
}

/* Ajuste para el tamaño fa-lg */
.x-icon.fa-lg {
    font-size: 1.33333em;
}

/* Fuente Saira para COCUAL */
.cocual-brand {
    font-family: var(--font-brand);
    font-weight: 700;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    display: inline;
    color: var(--text);
}

/* Color específico para COCUAL en el footer */
footer .cocual-brand {
    color: inherit;
}

.cocual-brand-light {
    font-family: var(--font-brand);
    font-weight: 400;
    letter-spacing: 0.02em;
    text-transform: uppercase;
    display: inline;
}

.cocual-brand-bold {
    font-family: var(--font-brand);
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    display: inline;
}

/* Hero: dos líneas intencionales vía <br>; cada línea sin wrap en desktop */
@media (min-width: 992px) {
    .hero-title {
        white-space: normal;
        font-size: 2.8rem;
        line-height: 1.15;
        margin-bottom: 1.5rem;
        overflow: visible;
        word-wrap: normal;
    }
    
    .hero-subtitle {
        font-weight: 500;
        font-size: 1.25rem;
        line-height: 1.6;
        margin-bottom: 2rem;
    }
}

@media (min-width: 1200px) {
    .hero-title {
        font-size: 3.2rem;
    }
    
    .hero-subtitle {
        font-size: 1.35rem;
    }
}

@media (min-width: 1400px) {
    .hero-title {
        font-size: 3.5rem;
    }
}

/* Asegurar espacio suficiente para el título */
.hero-section .container-fluid {
    padding-left: 2rem;
    padding-right: 2rem;
}

@media (min-width: 992px) {
    .hero-section .container-fluid {
        padding-left: 3rem;
        padding-right: 3rem;
    }
}

@media (max-width: 991px) {
    .hero-title {
        font-size: 2.5rem;
        line-height: 1.2;
        white-space: normal;
        overflow-wrap: break-word;
    }
    
    .hero-subtitle {
        font-weight: 400;
        font-size: 1.1rem;
        line-height: 1.5;
        overflow-wrap: break-word;
    }
}

/* Phones: keep new hero H1/CTAs readable without truncation (after 991px rules) */
@media (max-width: 575.98px) {
    .hero-copy {
        /* Less horizontal padding so "Expensas que cierran." fits ~320px without mid-phrase wrap */
        padding: 0.85rem 0.75rem;
    }
    
    .hero-title {
        font-size: 1.7rem;
        line-height: 1.22;
        margin-bottom: 1rem !important;
    }
    
    .hero-subtitle {
        font-size: 1rem;
        line-height: 1.45;
        margin-bottom: 1.25rem !important;
    }
    
    .hero-section .btn {
        font-size: 0.95rem;
        padding: 0.75rem;
    }
    
    .hero-content-wrapper {
        min-height: auto;
        padding: 1rem 0 1.5rem;
    }
}

/* Very narrow phones (320px): keep intentional <br> lines from wrapping mid-phrase */
@media (max-width: 359.98px) {
    .hero-title {
        font-size: 1.5rem;
        line-height: 1.25;
    }
    
    .hero-section .container-fluid {
        padding-left: 0.75rem;
        padding-right: 0.75rem;
    }
    
    .hero-copy {
        padding: 0.75rem 0.6rem;
    }
}

/* Icono SVG de X (Twitter) - Oficial */
.x-svg-icon {
    display: inline-block;
    vertical-align: middle;
    width: 1.33333em;
    height: 1.33333em;
}

.x-svg-icon:hover {
    transform: scale(1.1);
    transition: transform 0.2s ease;
}

/* Estilos para el accordion de FAQ */
.accordion {
    background: linear-gradient(135deg, var(--neutral-color), var(--primary-dark));
    border-radius: var(--border-radius-lg);
    overflow: hidden;
    box-shadow: var(--shadow-lg);
}

.accordion-item {
    background: transparent;
    border: none;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.accordion-item:last-child {
    border-bottom: none;
}

.accordion-button {
    background: linear-gradient(135deg, var(--neutral-color), var(--primary-dark));
    color: white;
    border: none;
    font-weight: 600;
    padding: 1.5rem;
    transition: all 0.3s ease;
}

.accordion-button:hover {
    background: linear-gradient(135deg, var(--primary-dark), var(--neutral-color));
    color: white;
    transform: translateY(-1px);
}

.accordion-button:not(.collapsed) {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: white;
    box-shadow: none;
}

.accordion-button:focus {
    box-shadow: none;
    border-color: var(--accent-color);
}

.accordion-body {
    background: rgba(255, 255, 255, 0.05);
    color: rgba(255, 255, 255, 0.9);
    padding: 1.5rem;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.accordion-button::after {
    filter: brightness(0) invert(1);
}

/* Versión alternativa con líneas más gruesas */
.x-icon-alt {
    display: inline-block;
    width: 1em;
    height: 1em;
    position: relative;
    vertical-align: middle;
}

.x-icon-alt::before,
.x-icon-alt::after {
    content: '';
    position: absolute;
    background-color: currentColor;
    top: 50%;
    left: 50%;
    width: 0.9em;
    height: 0.15em;
    border-radius: 0.075em;
}

.x-icon-alt::before {
    transform: translate(-50%, -50%) rotate(45deg);
}

.x-icon-alt::after {
    transform: translate(-50%, -50%) rotate(-45deg);
}

.x-icon-alt.fa-lg {
    font-size: 1.33333em;
}

/* ===== ESTILOS CAPTCHA ===== */
.captcha-container {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
}

.captcha-container img {
    border: 1px solid #dee2e6;
    border-radius: 0.375rem;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.captcha-container input {
    max-width: 120px;
    font-size: 1.1rem;
    text-align: center;
    font-weight: 600;
    letter-spacing: 1px;
}

.captcha-container .captcha-refresh {
    background: none;
    border: none;
    color: var(--accent-color);
    font-size: 1.2rem;
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 0.375rem;
    transition: all 0.3s ease;
}

.captcha-container .captcha-refresh:hover {
    background-color: rgba(136, 185, 215, 0.1);
    transform: scale(1.1);
}

/* Dark mode para captcha */
body.dark-mode .captcha-container img {
    border-color: var(--border-color);
    background-color: var(--bg-card);
}

body.dark-mode .captcha-container input {
    background-color: var(--bg-card);
    border-color: var(--border-color);
    color: var(--text-primary);
}

body.dark-mode .captcha-container input:focus {
    background-color: var(--bg-card);
    border-color: var(--accent-color);
    color: var(--text-primary);
}

/* Estilos para el feedback del captcha */
#captcha-feedback {
    transition: all 0.3s ease;
}

.captcha-success {
    display: none;
    animation: fadeIn 0.3s ease;
}

.captcha-error {
    display: none;
    animation: fadeIn 0.3s ease;
}

.captcha-container input.is-valid {
    border-color: #198754 !important;
    box-shadow: 0 0 0 0.2rem rgba(25, 135, 84, 0.25) !important;
}

.captcha-container input.is-invalid {
    border-color: #dc3545 !important;
    box-shadow: 0 0 0 0.2rem rgba(220, 53, 69, 0.25) !important;
}

/* Dark mode para feedback del captcha */
body.dark-mode .captcha-container input.is-valid {
    border-color: #20c997 !important;
    box-shadow: 0 0 0 0.2rem rgba(32, 201, 151, 0.25) !important;
}

body.dark-mode .captcha-container input.is-invalid {
    border-color: #ff6b6b !important;
    box-shadow: 0 0 0 0.2rem rgba(255, 107, 107, 0.25) !important;
}

/* Estilos para el texto de ayuda del captcha */
#contactForm div.mb-3 .form-text {
    color: #6c757d !important;
    font-size: 0.875rem;
    margin-top: 0.25rem;
}

body.dark-mode #contactForm div.mb-3 .form-text {
    color: #adb5bd !important;
}

/* Estilos para avatares de usuario */
.user-avatar {
    border: 2px solid var(--border-color);
    transition: transform 0.2s ease-in-out;
}

.user-avatar:hover {
    transform: scale(1.05);
}

.user-avatar-initials {
    font-weight: 600;
    letter-spacing: 0.5px;
}

/* Estilos para modo oscuro */
body.dark-mode .user-avatar {
    border-color: var(--accent-color);
}

body.dark-mode .author-info {
    background-color: var(--bg-secondary) !important;
    border: 1px solid var(--border-color);
}

/* Estilos generales para .form-text en modo oscuro */
body.dark-mode .form-text {
    color: #adb5bd !important;
}

/* Responsive para captcha */
@media (max-width: 576px) {
    .captcha-container {
        flex-direction: column;
        align-items: stretch;
    }
    
    .captcha-container input {
        max-width: none;
    }
}

/* ===== ESTILOS BREADCRUMB ===== */
.breadcrumb {
    background: transparent;
    padding: 0.75rem 0;
}

.breadcrumb-item + .breadcrumb-item::before {
    color: var(--text-muted);
}

.breadcrumb-item a {
    color: var(--text-secondary);
    text-decoration: none;
    transition: color 0.3s ease;
}

.breadcrumb-item a:hover {
    color: var(--accent-color);
}

.breadcrumb-item.active {
    color: var(--text-primary);
}

/* Dark mode para breadcrumb */
body.dark-mode .breadcrumb-item {
    color: var(--text-secondary);
}

body.dark-mode .breadcrumb-item a {
    color: var(--text-secondary);
}

body.dark-mode .breadcrumb-item a:hover {
    color: var(--accent-color);
}

body.dark-mode .breadcrumb-item.active {
    color: var(--text-primary) !important;
}

body.dark-mode .breadcrumb-item + .breadcrumb-item::before {
    color: var(--text-muted);
}

/* ===== TAP TARGETS =====
   Los .btn y .btn-sm de Bootstrap miden 38px y 31px de alto: por debajo del
   mínimo táctil recomendado (44px). .btn-touch lo garantiza sólo en mobile,
   sin alterar la altura en desktop. */
@media (max-width: 767.98px) {
    .btn-touch {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        min-height: 44px;
    }

    .form-control:not(.form-control-sm),
    .form-select:not(.form-select-sm) {
        min-height: 44px;
    }
}

/* ===== WHATSAPP FLOTANTE =====
   Botón de partials/whatsapp_float.html, sólo en las páginas públicas de venta
   (ver WHATSAPP_PAGES en core_extras.py). z-index 1030: queda debajo del header
   público, del offcanvas y de los modales de Bootstrap.
   Paleta Cocual (no el verde de WhatsApp). */
.whatsapp-float {
    position: fixed;
    right: 20px;
    bottom: 20px;
    z-index: 1030;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background-color: var(--accent-dark, #057a7e);
    color: #fff;
    font-size: 30px;
    text-decoration: none;
    border: 2px solid rgba(255, 255, 255, 0.15);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.35);
    transition: transform 0.2s ease, box-shadow 0.2s ease, background-color 0.2s ease;
}

.whatsapp-float:hover,
.whatsapp-float:focus-visible,
.whatsapp-float:active {
    color: #fff;
    background-color: var(--btn-primary-hover, #046568);
    transform: scale(1.08);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.45);
}

.whatsapp-float:focus-visible {
    outline: 2px solid #88B9D7 !important;
    outline-offset: 3px !important;
}

@media (max-width: 767.98px) {
    .whatsapp-float {
        right: 12px;
        bottom: calc(16px + env(safe-area-inset-bottom, 0px));
        width: 48px;
        height: 48px;
        font-size: 26px;
    }

    /* Solo holgura vertical al final: el botón no tapa links del footer */
    body:has(> .whatsapp-float) > footer {
        padding-bottom: calc(48px + 16px + 1rem + env(safe-area-inset-bottom, 0px)) !important;
    }
}

@media (prefers-reduced-motion: reduce) {
    .whatsapp-float {
        transition: none;
    }

    .whatsapp-float:hover,
    .whatsapp-float:focus-visible {
        transform: none;
    }
}

@media print {
    .whatsapp-float {
        display: none;
    }
}

/* ===== Componentes Bootstrap en tema oscuro (páginas internas) ===== */
.bg-light,
.bg-white,
.table,
.table > :not(caption) > * > * {
    background-color: var(--surface) !important;
    color: var(--text) !important;
}

.bg-body,
.bg-body-tertiary,
.bg-body-secondary {
    background-color: var(--bg) !important;
    color: var(--text) !important;
}

.text-dark,
.text-body,
.text-black {
    color: var(--text) !important;
}

.text-muted,
.text-secondary,
.form-text {
    color: var(--text-muted) !important;
}

.card,
.list-group-item,
.modal-content,
.dropdown-menu,
.accordion-item,
.popover,
.offcanvas {
    background-color: var(--surface) !important;
    color: var(--text) !important;
    border-color: var(--border) !important;
}

.card-header,
.card-footer,
.modal-header,
.modal-footer,
.list-group-item {
    border-color: var(--border) !important;
}

.form-control,
.form-select,
.form-control:focus,
.form-select:focus,
textarea.form-control,
input.form-control,
.input-group-text {
    background-color: var(--bg) !important;
    color: var(--text) !important;
    border: 1px solid var(--border) !important;
    box-shadow: none;
}

.form-control::placeholder,
.form-control::-webkit-input-placeholder {
    color: var(--text-dim) !important;
    opacity: 1;
}

.form-control:focus,
.form-select:focus {
    border-color: var(--focus) !important;
    box-shadow: 0 0 0 0.15rem rgba(136, 185, 215, 0.25) !important;
}

.form-label,
label {
    color: var(--text);
}

.form-check-input {
    background-color: var(--bg);
    border-color: var(--border);
}

.form-check-input:checked {
    background-color: var(--btn-primary-bg);
    border-color: var(--btn-primary-bg);
}

.table {
    --bs-table-bg: var(--surface);
    --bs-table-color: var(--text);
    --bs-table-border-color: var(--border);
    --bs-table-striped-bg: var(--surface-2);
    --bs-table-striped-color: var(--text);
    --bs-table-hover-bg: var(--surface-2);
    --bs-table-hover-color: var(--text);
}

.table-bordered,
.table-bordered > :not(caption) > * > * {
    border-color: var(--border) !important;
}

.alert {
    border-radius: var(--radius-sm);
    border-width: 1px;
}

.alert-primary,
.alert-info {
    background-color: rgba(52, 103, 138, 0.25);
    color: var(--text);
    border-color: var(--primary);
}

.alert-success {
    background-color: rgba(5, 122, 126, 0.25);
    color: var(--text);
    border-color: var(--accent-dark);
}

.alert-warning {
    background-color: rgba(232, 196, 124, 0.18);
    color: var(--text);
    border-color: var(--promo);
}

.alert-danger {
    background-color: rgba(220, 53, 69, 0.22);
    color: #ffc9ce;
    border-color: #dc3545;
}

.alert-secondary,
.alert-light,
.alert-dark {
    background-color: var(--surface-2);
    color: var(--text);
    border-color: var(--border);
}

.badge.text-bg-light,
.badge.bg-light {
    background-color: var(--surface-2) !important;
    color: var(--text) !important;
}

.breadcrumb {
    --bs-breadcrumb-divider-color: var(--text-dim);
}

.hr,
hr {
    border-color: var(--border);
    opacity: 1;
}

.pagination .page-link {
    background-color: var(--surface);
    border-color: var(--border);
    color: var(--accent-soft);
}

.pagination .page-link:hover {
    background-color: var(--surface-2);
    color: var(--primary-light);
}

.pagination .page-item.active .page-link {
    background-color: var(--btn-primary-bg);
    border-color: var(--btn-primary-bg);
    color: #fff;
}

.pagination .page-item.disabled .page-link {
    background-color: var(--bg-elev);
    border-color: var(--border);
    color: var(--text-dim);
}

#contactForm div.mb-3 .form-text {
    color: var(--text-dim) !important;
}

/* Newsletter signup (footer y embeds) */
.newsletter-signup-form { position: relative; }
.newsletter-hp-wrap {
    position: absolute;
    left: -10000px;
    top: auto;
    width: 1px;
    height: 1px;
    overflow: hidden;
}
.newsletter-signup-copy {
    color: var(--text-muted);
    margin-bottom: 0.75rem;
    line-height: 1.5;
    font-size: 0.9rem;
}
.newsletter-consent { margin-bottom: 0.75rem; }
.newsletter-consent .form-check-input {
    width: 1.35rem;
    height: 1.35rem;
    margin-top: 0.15rem;
}
.newsletter-consent .form-check-label {
    color: var(--text-muted);
    font-size: 0.85rem;
    line-height: 1.4;
}
.newsletter-signup-fields {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    align-items: flex-end;
}
/* Desktop blog: el campo puede crecer en ancho (eje principal horizontal). */
.newsletter-signup-field { flex: 1 1 12rem; min-width: 0; }
.newsletter-signup-field .form-label {
    font-weight: 600;
    margin-bottom: 0.25rem;
    font-size: 0.85rem;
}
.newsletter-signup-submit { min-height: 44px; }
/* Sin halo azul de Bootstrap en el botón de alta (footer, blog, subscribe). */
.newsletter-signup-form .newsletter-signup-submit:focus,
.newsletter-signup-form .newsletter-signup-submit:focus-visible,
.btn-primary.newsletter-signup-submit:focus,
.btn-primary.newsletter-signup-submit:focus-visible {
    outline: 2px solid #88B9D7 !important;
    outline-offset: 3px !important;
    box-shadow: none !important;
}
/* Footer (desktop/tablet): input + botón en una fila; consentimiento debajo. */
.newsletter-signup-footer .newsletter-signup-fields {
    flex-direction: row;
    flex-wrap: nowrap;
    align-items: stretch;
    gap: 0.5rem;
}
.newsletter-signup-footer .newsletter-signup-field {
    flex: 1 1 auto;
    min-width: 0;
    width: auto;
}
.newsletter-signup-footer .newsletter-signup-submit {
    width: auto;
    flex: 0 0 auto;
    white-space: nowrap;
}
.newsletter-signup-footer .newsletter-consent {
    margin: 0.4rem 0 0;
}
.newsletter-signup-footer .newsletter-consent .form-check-input {
    width: 1.1rem;
    height: 1.1rem;
    margin-top: 0.1rem;
}
.newsletter-signup-footer .newsletter-consent .form-check-label {
    font-size: 0.75rem;
    line-height: 1.3;
}
.newsletter-signup-footer .newsletter-email-input,
.newsletter-signup-footer .form-control {
    min-height: 44px;
}
.newsletter-signup-footer .form-control:focus,
.newsletter-signup-footer .form-control:focus-visible,
.newsletter-signup-footer .newsletter-consent-check:focus,
.newsletter-signup-footer .newsletter-consent-check:focus-visible {
    outline: 2px solid #88B9D7 !important;
    outline-offset: 3px !important;
    box-shadow: none !important;
}
.newsletter-page .newsletter-panel {
    padding: 1.35rem 1.25rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface);
}
.newsletter-email-input,
.newsletter-signup-form .form-control {
    min-height: 44px;
    background: var(--bg-elev);
    border-color: var(--border);
    color: var(--text);
}
.newsletter-page .newsletter-inline-link {
    color: var(--accent-soft, #3FB6BB);
    font-weight: 600;
    text-decoration: underline;
    text-underline-offset: 3px;
}
.newsletter-page .newsletter-inline-link:hover,
.newsletter-page .newsletter-inline-link:focus-visible {
    color: var(--accent, #07969B);
}
.newsletter-page .newsletter-inline-link:focus-visible {
    outline: 2px solid #88B9D7 !important;
    outline-offset: 3px !important;
}
@media (max-width: 767.98px) {
    .newsletter-signup-fields {
        flex-direction: column;
        align-items: stretch;
        gap: 0.5rem;
    }
    /* Apilado: el flex-basis 12rem no debe aplicarse al eje vertical. */
    .newsletter-signup-field {
        flex: 0 1 auto;
        width: 100%;
    }
    .newsletter-signup-submit { width: 100%; }
    /* Footer móvil: apilado compacto, sin hueco extra entre input y botón. */
    .newsletter-signup-footer .newsletter-signup-fields {
        flex-direction: column;
        flex-wrap: wrap;
        align-items: stretch;
        gap: 0.5rem;
    }
    .newsletter-signup-footer .newsletter-signup-field {
        flex: 0 1 auto;
        width: 100%;
    }
    .newsletter-signup-footer .newsletter-signup-submit {
        width: 100%;
    }
}
