/* ===== ANIMACIONES ===== */

/* Fade in */
.fade-in {
    opacity: 0;
    transition: opacity 0.6s ease;
}

.fade-in.animated {
    opacity: 1;
}

/* Slide up */
.slide-up {
    opacity: 0;
    transform: translateY(30px);
    transition: all 0.6s ease;
}

.slide-up.animated {
    opacity: 1;
    transform: translateY(0);
}

/* ===== BOTÓN BACK TO TOP ===== */
.back-to-top {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    width: 50px;
    height: 50px;
    background-color: var(--color-primary);
    color: var(--color-white);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: var(--shadow-lg);
    cursor: pointer;
    opacity: 0;
    visibility: hidden;
    transform: translateY(20px);
    transition: all 0.3s ease;
    z-index: 999;
}

.back-to-top.visible {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.back-to-top:hover {
    background-color: var(--color-primary-dark);
    transform: translateY(-5px);
}

.back-to-top svg {
    width: 24px;
    height: 24px;
}

/* ===== FORMULARIOS ===== */
input.error,
textarea.error,
select.error {
    border-color: #dc3545;
    box-shadow: 0 0 0 0.2rem rgba(220, 53, 69, 0.25);
}

/* ===== ACORDEONES ===== */
.accordion {
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    margin-bottom: 1rem;
    overflow: hidden;
}

.accordion-header {
    padding: 1.25rem;
    background-color: var(--color-background-alt);
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-weight: 600;
    transition: background-color 0.3s ease;
}

.accordion-header:hover {
    background-color: var(--color-gray-200);
}

.accordion-header::after {
    content: '+';
    font-size: 1.5rem;
    transition: transform 0.3s ease;
}

.accordion.active .accordion-header::after {
    transform: rotate(45deg);
}

.accordion-content {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
}

.accordion-content-inner {
    padding: 1.25rem;
}

/* ===== TABS ===== */
.tabs-container {
    margin: 2rem 0;
}

.tabs-buttons {
    display: flex;
    gap: 0.5rem;
    border-bottom: 2px solid var(--color-border);
    margin-bottom: 1.5rem;
}

.tab-button {
    padding: 0.75rem 1.5rem;
    background-color: transparent;
    border: none;
    border-bottom: 3px solid transparent;
    font-weight: 500;
    color: var(--color-gray-600);
    cursor: pointer;
    transition: all 0.3s ease;
    margin-bottom: -2px;
}

.tab-button:hover {
    color: var(--color-primary);
}

.tab-button.active {
    color: var(--color-primary);
    border-bottom-color: var(--color-primary);
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ===== COUNTERS ===== */
.counter {
    font-size: var(--text-h2);
    font-weight: 700;
    color: var(--color-primary);
}

/* ===== RESPONSIVE - TABLET ===== */
@media (max-width: 992px) {
    :root {
        --container-padding: 1.25rem;
    }

    .header-main-content {
        gap: 1rem;
    }

    .primary-menu {
        gap: 1.5rem;
    }

    .tabs-buttons {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .tab-button {
        white-space: nowrap;
        padding: 0.75rem 1rem;
    }
}

/* ===== RESPONSIVE - MÓVIL ===== */
@media (max-width: 768px) {
    :root {
        --container-padding: 1rem;
        --text-h1: 2rem;
        --text-h2: 1.75rem;
        --text-h3: 1.5rem;
        --space-lg: 3rem;
        --space-xl: 4rem;
    }

    /* Header top más compacto en móvil */
    .header-top-content {
        font-size: 0.75rem;
    }

    .social-icons {
        gap: 0.5rem;
    }

    .social-icon {
        width: 28px;
        height: 28px;
    }

    /* Logo más pequeño */
    .site-logo img {
        height: 40px;
    }

    /* Back to top más pequeño */
    .back-to-top {
        width: 45px;
        height: 45px;
        bottom: 1.5rem;
        right: 1.5rem;
    }

    /* Acordeones más compactos */
    .accordion-header,
    .accordion-content-inner {
        padding: 1rem;
    }

    /* Tabs en columna en móvil */
    .tabs-buttons {
        flex-direction: column;
        border-bottom: none;
    }

    .tab-button {
        border-bottom: 1px solid var(--color-border);
        border-left: 3px solid transparent;
        text-align: left;
        margin-bottom: 0;
    }

    .tab-button.active {
        border-bottom-color: var(--color-border);
        border-left-color: var(--color-primary);
    }

    /* Footer más compacto */
    .site-footer {
        padding: 2rem 0 1rem;
    }

    .footer-widgets {
        gap: 1.5rem;
    }
}

/* ===== RESPONSIVE - MÓVIL PEQUEÑO ===== */
@media (max-width: 480px) {
    :root {
        --text-h1: 1.75rem;
        --text-h2: 1.5rem;
        --text-h3: 1.25rem;
    }

    .header-top {
        padding: 0.35rem 0;
    }

    .language-selector a,
    .language-selector span {
        font-size: 0.75rem;
        padding: 0.2rem 0.4rem;
    }

    .back-to-top {
        width: 40px;
        height: 40px;
        bottom: 1rem;
        right: 1rem;
    }

    .back-to-top svg {
        width: 20px;
        height: 20px;
    }
}

/* ===== IMPRESIÓN ===== */
@media print {
    .header-top,
    .mobile-menu-toggle,
    .mobile-menu-overlay,
    .back-to-top,
    .site-footer {
        display: none;
    }

    .site-header {
        position: static;
        box-shadow: none;
    }

    body {
        font-size: 12pt;
        line-height: 1.5;
    }

    a {
        text-decoration: underline;
    }

    a[href]:after {
        content: " (" attr(href) ")";
    }
}

/* ===== ACCESIBILIDAD ===== */

/* Foco visible para navegación por teclado */
a:focus-visible,
button:focus-visible,
input:focus-visible,
textarea:focus-visible,
select:focus-visible {
    outline: 2px solid var(--color-primary);
    outline-offset: 2px;
}

/* Reducir animaciones para usuarios que lo prefieren */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }

    .fade-in,
    .slide-up {
        opacity: 1;
        transform: none;
    }
}

/* Alto contraste para mejor legibilidad */
@media (prefers-contrast: high) {
    :root {
        --color-text: #000000;
        --color-background: #FFFFFF;
    }

    .btn-primary {
        border: 2px solid var(--color-primary-darkest);
    }
}