/********** Template CSS Final Optimizado **********/
:root {
    --primary: #0e7774;
    --secondary: #FF6922;
    --light: #EFFDF5;
    --dark: #0E2E50;
    --transition: all 0.35s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    --shadow: 0 4px 12px rgba(14, 119, 116, 0.15);
    --font-primary: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

/* ===== ACCESIBILIDAD ===== */
:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 3px;
}

.sr-only {
    position: absolute;
    width: 1px; height: 1px;
    padding: 0; margin: -1px;
    overflow: hidden; clip: rect(0,0,0,0);
    white-space: nowrap; border: 0;
}

/* ===== OPTIMIZACIÓN DE RENDIMIENTO ===== */
* {
    will-change: transform, opacity;
}

@media (prefers-reduced-motion: reduce) {
    * {
        transition: none !important;
        animation-duration: 0s !important;
    }
}

/* ===== BOTÓN VOLVER ARRIBA ===== */
.back-to-top {
    position: fixed;
    right: 30px;
    bottom: 30px;
    z-index: 9999;
    display: none;
    transition: var(--transition);
    opacity: 0.9;
}

.back-to-top:hover {
    opacity: 1;
    transform: translateY(-4px);
}

/* ===== NAVEGACIÓN ===== */
.nav-bar {
    position: relative;
    margin-top: 45px;
    padding: 0 2rem;
    z-index: 9999;
    backdrop-filter: blur(10px);
    transition: var(--transition);
}

.nav-bar.sticky-top {
    position: sticky;
    top: 0;
    background: rgba(255, 255, 255, 0.95);
    box-shadow: var(--shadow);
    animation: slideDown 0.3s ease;
}

@keyframes slideDown {
    from { transform: translateY(-100%); }
    to { transform: translateY(0); }
}

.navbar-light .navbar-nav .nav-link {
    margin-right: 25px;
    padding: 25px 0;
    color: var(--dark);
    font-size: 15px;
    font-weight: 600;
    text-transform: uppercase;
    position: relative;
    transition: var(--transition);
}

.navbar-light .navbar-nav .nav-link::after {
    content: '';
    position: absolute;
    bottom: 20px; left: 0;
    width: 0; height: 2px;
    background: var(--primary);
    transition: var(--transition);
}

.navbar-light .navbar-nav .nav-link:hover,
.navbar-light .navbar-nav .nav-link.active {
    color: var(--primary);
}

.navbar-light .navbar-nav .nav-link:hover::after,
.navbar-light .navbar-nav .nav-link.active::after {
    width: 100%;
}

/* Dropdown mejorado */
@media (min-width: 992px) {
    .navbar .nav-item .dropdown-menu {
        display: block;
        top: 100%;
        margin-top: 0;
        transform: translateY(-10px);
        opacity: 0;
        visibility: hidden;
        transition: var(--transition);
        border: none;
        box-shadow: var(--shadow);
        border-radius: 8px;
    }

    .navbar .nav-item:hover .dropdown-menu {
        transform: translateY(0);
        visibility: visible;
        opacity: 1;
    }

    .dropdown-item {
        padding: 12px 20px;
        transition: var(--transition);
        border-bottom: 1px solid rgba(0, 0, 0, 0.05);
    }

    .dropdown-item:last-child { border-bottom: none; }

    .dropdown-item:hover {
        background: var(--primary);
        color: #fff;
        padding-left: 25px;
    }
}

/* ===== HEADER ===== */
@media (min-width: 992px) {
    .header { margin-top: -120px; }
}

.header-carousel .owl-nav {
    position: absolute;
    top: 50%;
    left: -20px;
    transform: translateY(-50%);
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.header-carousel .owl-nav .owl-prev,
.header-carousel .owl-nav .owl-next {
    width: 45px; height: 45px;
    display: flex; align-items: center; justify-content: center;
    color: #fff;
    background: var(--primary);
    border-radius: 50%;
    font-size: 18px;
    transition: var(--transition);
    border: 2px solid transparent;
}

.header-carousel .owl-nav .owl-prev:hover,
.header-carousel .owl-nav .owl-next:hover {
    background: var(--dark);
    transform: scale(1.1);
    border-color: white;
}

/* ===== CATEGORÍAS ===== */
.cat-item {
    text-decoration: none;
    color: inherit;
    display: block;
    height: 100%;
    transition: var(--transition);
    border-radius: 12px;
    overflow: hidden;
}

.cat-item div {
    background: #fff;
    border: 2px dashed rgba(14, 119, 116, 0.2);
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    position: relative;
    transition: var(--transition);
    overflow: hidden;
}

.cat-item div::before {
    content: '';
    position: absolute;
    top: 0; left: -100%;
    width: 100%; height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.4), transparent);
    transition: left 0.7s ease;
}

.cat-item:hover div::before { left: 100%; }

.cat-item:hover div {
    background: var(--primary);
    border-color: transparent;
    transform: translateY(-5px);
    box-shadow: var(--shadow);
}

.cat-item h6 {
    color: #232f40 !important;
    font-weight: 500;
    font-size: 1.1rem;
    margin-bottom: 0.5rem;
}

.cat-item span {
    color: var(--primary) !important;
    font-size: 0.9rem;
}

.cat-item:hover div * { color: #fff !important; }

.cat-item .icon {
    padding: 15px;
    display: inline-flex;
    align-items: center; justify-content: center;
    background: #fff !important;
    border-radius: 50%;
    border: 2px dashed var(--primary) !important;
    margin-bottom: 1rem;
    transition: var(--transition);
    width: 80px; height: 80px;
    margin-inline: auto;
}

.cat-item:hover .icon {
    background: rgba(255,255,255,0.1) !important;
    border-color: rgba(255,255,255,0.5) !important;
    transform: scale(1.05);
}

/* ===== TIPOGRAFÍA ===== */
body {
    font-family: var(--font-primary);
    background-color: var(--light);
    line-height: 1.6;
    color: #333;
    overflow-x: hidden;
}

h1, h2, h3, h4, h5, h6 {
    font-weight: 700;
    line-height: 1.2;
    margin-bottom: 1rem;
}

h4 {
    font-size: 1.5rem;
    color: var(--primary);
}

.display-5 {
    font-size: 2.5rem;
    font-weight: 700;
}

@media (max-width: 768px) {
    .display-5 { font-size: 2rem; }
}

/* ===== FOOTER ===== */
.footer {
    background: linear-gradient(135deg, var(--primary) 0%, #0a5a58 100%) !important;
    position: relative;
    color: #fff;
}

.footer::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--primary), var(--secondary), var(--primary));
}

.footer .btn.btn-link {
    display: block;
    margin-bottom: 8px;
    padding: 0;
    text-align: left;
    font-size: 15px;
    font-weight: 500;
    text-transform: capitalize;
    color: rgba(255,255,255,0.8);
    transition: var(--transition);
}

.footer .btn.btn-link:hover {
    color: #fff;
    padding-left: 8px;
}

.footer .copyright {
    padding: 25px 0;
    font-size: 14px;
    border-top: 1px solid rgba(255,255,255,0.1);
    background: rgba(0,0,0,0.1);
}

/* ===== RESPONSIVE ===== */
@media (max-width: 991.98px) {
    .nav-bar { margin: 0; padding: 0; }

    .navbar-light .navbar-nav .nav-link {
        margin-right: 0;
        padding: 12px 0;
        border-bottom: 1px solid rgba(0,0,0,0.1);
    }

    .navbar-light .navbar-nav .nav-link:last-child { border-bottom: none; }

    .navbar-light .navbar-nav .nav-link::after { display: none; }

    .header-carousel .owl-nav {
        left: 15px;
        flex-direction: row;
        top: auto;
        bottom: 20px;
        transform: none;
        gap: 10px;
    }
}

@media (max-width: 768px) {
    .cat-item { margin-bottom: 1.5rem; }
    .cat-item h6 { font-size: 1rem; }
    .cat-item span { font-size: 0.85rem; }
    section { padding: 60px 0; }
}

/* ===== ANIMACIONES Y EFECTOS ===== */
.fadeInUp {
    animation: fadeInUp 0.6s both;
}

@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(30px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ===== COLORES Y BOTONES ===== */
.text-primary { color: var(--primary) !important; }

.btn-primary {
    background: var(--primary);
    border-color: var(--primary);
    transition: var(--transition);
}

.btn-primary:hover {
    background: #0a5a58;
    border-color: #0a5a58;
    transform: translateY(-2px);
    box-shadow: var(--shadow);
}

/* ===== IMÁGENES ===== */
img { max-width: 100%; height: auto; transition: var(--transition); }

.img-fluid { border-radius: 8px; }

/* ===== FORMULARIOS ===== */
.form-control {
    border: 2px solid #e9ecef;
    transition: var(--transition);
}

.form-control:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 0.2rem rgba(14,119,116,0.25);
}

/* ===== LAYOUT ===== */
.container-xxl { padding-inline: 15px; }

.row.g-4 { margin-bottom: 2rem; }

main { min-height: 60vh; }

section { padding: 80px 0; }

/* ===== EFECTOS ===== */
.hover-lift {
    transition: var(--transition);
}

.hover-lift:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow);
}

/* ===== SPINNER ===== */
#spinner {
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.5s ease-out, visibility 0s linear 0.5s;
    z-index: 99999;
}

#spinner.show {
    visibility: visible;
    opacity: 1;
    transition-delay: 0s;
}

/* ===== MODO OSCURO OPCIONAL ===== */
@media (prefers-color-scheme: dark) {
    body {
        background-color: var(--light);
        color: #232f40;
    }
    .footer {
        background: linear-gradient(135deg, #0a5a58, #063c3b);
    }
    .navbar-light .navbar-nav .nav-link { color: var(--primary); }
    .navbar-light .navbar-nav .nav-link:hover { color: var(--secondary); }
}
