/* Variables de colores */
:root {
    --primary-color: #C20F2F;   /* #1e88e5; */
    --secondary-color: #0d47a1;
    --accent-color: #64b5f6;
    --background-light: #f8f9fa;
    --text-dark: #212121;
    --text-light: #ffffff;
}

/* Estilos generales */
body {
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    color: var(--text-dark);
    background-color: var(--background-light);
}

/* Estructura principal */
html, body {
    height: 100%;
    margin: 0;
    padding: 0;
}

body {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

/* Contenido principal */
.main-content {
    flex: 1 0 auto;
    min-height: calc(80vh - 128px); /* 128px = navbar (64px) + hero-section (64px) */
    display: flex;
    flex-direction: column;
    position: relative;
    z-index: 1;
}

/* Contenedor de asociaciones */
#associations-container {
    display: flex;
    flex-wrap: wrap;
    gap: 1.5rem;
    min-height: 400px; /* altura mínima inicial */
    height: auto; /* se expandirá según el contenido */
}

/* Navbar personalizada */
.custom-navbar {
    background: linear-gradient(135deg, 
        rgba(30, 136, 229, 0.95), 
        rgba(13, 71, 161, 0.95)
    ) !important;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    padding: 1rem 0;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    position: relative;
    z-index: 1030;
}

/* Hero section original */
.hero-section {
    background: linear-gradient(rgba(234, 237, 237, 0.8), rgba(213, 217, 217, 12, 47, 0.9)), url('../images/ontinyent-bg.jpg') center/cover;
    /* background: linear-gradient(rgba(210, 14, 53, 0.8), rgba(186, 12, 47, 0.9)), url('../images/ontinyent-bg.jpg') center/cover; */
    /* background: linear-gradient(rgba(30, 136, 229, 0.8), rgba(13, 71, 161, 0.9)), url('../images/ontinyent-bg.jpg') center/cover; */
    color: var(--text-light);
    position: relative;
    z-index: 1000;
}

.hero-section h1 {
    font-size: 3rem;
    font-weight: 700;
    margin-bottom: 1rem;
}

/* Tarjetas de filtro */
.filter-card {
    position: sticky;
    top: 1rem;
    margin-bottom: 1rem;
    background: white;
    border-radius: 10px;
    padding: 1.5rem;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

.filter-options {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.filter-btn {
    background: none;
    border: 1px solid var(--primary-color);
    color: var(--primary-color);
    padding: 0.5rem 1rem;
    border-radius: 25px;
    transition: all 0.3s ease;
}

.filter-btn:hover, .filter-btn.active {
    background: var(--primary-color);
    color: white;
}


.tipus-item {
    flex: 0 0 calc(24.5% - 0.75rem); /* 3 tarjetas por fila con gap */
    max-width: calc(24.5% - 0.75rem);
}

/* Tarjetas de asociaciones */
.association-item {
    flex: 0 0 calc(50% - 0.75rem); /* 2 tarjetas por fila con gap */
    max-width: calc(50% - 0.75rem);
}

/* Tarjetas de tipus d'associacions */
.tipus-card {
    height: 100%;
    padding: 1.5rem;
    display: flex;
    flex-direction: row;
    background: white;
    border-radius: 10px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

/* Tarjetas de asociaciones */
.association-card {
    height: 100%;
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    background: white;
    border-radius: 10px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.association-card h5, .tipus-card h5 {
    color: var(--primary-color);
    margin-bottom: 1rem;
}

/* Animación para las tarjetas */
.association-item, .tipus-item {
    opacity: 0;
    transform: translateY(20px);
    animation: fadeInUp 0.5s ease forwards;
}

.association-card:hover, .tipus-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
}

.association-info, .tipus-info {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

/* Footer personalizado */
.custom-footer {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: var(--text-light);
    padding: 3rem 0;
    margin-top: 4rem;
}

.social-links {
    display: flex;
    gap: 1rem;
}

.social-links a {
    color: var(--text-light);
    font-size: 1.5rem;
    transition: color 0.3s ease;
}

.social-links a:hover {
    color: var(--accent-color);
}


/* Añade estos estilos al final del archivo CSS existente */

.association-info p {
    margin-bottom: 0.5rem;
    color: #666;
}

.association-info i {
    color: var(--primary-color);
    width: 20px;
}

.no-results {
    min-height: 200px;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    color: #6c757d;
    font-style: italic;
    width: 100%;
}

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

/* Estilos para el select2 */
.select2-container--bootstrap-5 {
    width: 100% !important;
}

.select2-container--bootstrap-5 .select2-selection {
    border: 1px solid #dee2e6;
    border-radius: 0.5rem;
    padding: 0.5rem;
    transition: all 0.2s ease;
}

.select2-container--bootstrap-5 .select2-selection:hover {
    border-color: var(--primary-color);
}

.select2-container--bootstrap-5.select2-container--focus .select2-selection {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 0.25rem rgba(13, 110, 253, 0.25);
}

.select2-container--bootstrap-5 .select2-selection__rendered {
    color: var(--text-dark);
}

.select2-container--bootstrap-5 .select2-dropdown {
    border-radius: 0.5rem;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
    border: none;
}

.select2-container--bootstrap-5 .select2-results__option {
    padding: 0.75rem 1rem;
    transition: all 0.2s ease;
}

.select2-container--bootstrap-5 .select2-results__option--highlighted {
    background-color: var(--primary-color);
    color: white;
}

.select2-container--bootstrap-5 .select2-search__field {
    border-radius: 0.25rem;
    padding: 0.5rem;
    border: 1px solid #dee2e6;
}

.select2-container--bootstrap-5 .select2-search__field:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 0.25rem rgba(13, 110, 253, 0.25);
}

/* Animación para el icono del select */
.select2-container--bootstrap-5 .select2-selection__arrow {
    transition: transform 0.2s ease;
}

.select2-container--bootstrap-5.select2-container--open .select2-selection__arrow {
    transform: rotate(180deg);
}

/* Estilos para el logo y navbar */
.navbar-logo {
    height: 40px;
    width: auto;
    transition: transform 0.3s ease;
}

/* Efecto hover suave en el logo */
.navbar-logo:hover {
    transform: scale(1.05);
}

/* Mejora del gradiente del navbar para el logo */
.custom-navbar {
    background: linear-gradient(135deg,rgba(210, 14, 53, 0.8), rgba(186, 12, 47, 0.9)) !important;
    /* background: linear-gradient(135deg,
        rgba(30, 136, 229, 0.95),
        rgba(13, 71, 161, 0.95)
    ) !important; */
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}


/* Tarjetas de tipus *//* Estado de carga y sin resultados */
.no-results, 
.loading-container {
    width: 100%;
    min-height: 400px;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
}

/* Estilos del menú hero */
.hero-menu {
    width: 100%;
    display: flex;
    justify-content: center;
}

.menu-items {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    gap: 2rem;
    justify-content: center;
}

/* Estilos del menú moderno */
.modern-nav {
    width: 100%;
    padding: 1rem 0;
    position: relative;
    z-index: 1001;
}

.main-menu {
    display: flex;
    justify-content: space-around;
    list-style: none;
    margin: 0;
    padding: 0;
    flex-wrap: wrap;
    gap: 1rem;
}

.menu-item {
    position: relative;
    z-index: 1002;
}

.menu-title {
    color: var(--primary-color);
    text-decoration: none;
    padding: 0.8rem 1.5rem;
    display: flex;
    align-items: center;
    font-size: 1.1rem;
    border-radius: 8px;
    transition: all 0.3s ease;
    background: white;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.menu-title:hover {
    background: #f8f9fa;
    color: var(--secondary-color);
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.15);
}

.submenu {
    position: absolute;
    top: 100%;
    left: 0;
    z-index: 1003;
    min-width: 220px;
    background: white;
    border-radius: 8px;
    padding: 0.5rem;
    margin-top: 0.5rem;
    opacity: 0;
    visibility: hidden;
    transform: translateY(10px);
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

.menu-item:hover .submenu {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

.submenu li {
    list-style: none;
}

.submenu a {
    color: #333;
    text-decoration: none;
    padding: 0.8rem 1rem;
    display: flex;
    align-items: center;
    border-radius: 6px;
    transition: all 0.2s ease;
}

.submenu a:hover {
    background: #f0f8ff;
    color: var(--primary-color);
    transform: translateX(5px);
}

/* Animación del icono chevron */
.menu-title .fa-chevron-down {
    transition: transform 0.3s ease;
}

.menu-item:hover .fa-chevron-down {
    transform: rotate(180deg);
}

/* Efectos de hover y animaciones */
.menu-item {
    perspective: 1000px;
}

.submenu {
    transform-origin: top center;
}

.menu-title i:not(.fa-chevron-down) {
    transition: transform 0.3s ease;
}

.menu-title:hover i:not(.fa-chevron-down) {
    transform: scale(1.2);
}

/* Efecto de brillo en hover */
.menu-title::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(45deg, transparent, rgba(255,255,255,0.1), transparent);
    background-size: 200% 100%;
    animation: shine 1.5s infinite;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.menu-title:hover::after {
    opacity: 1;
}

@keyframes shine {
    to {
        background-position: 200% 0;
    }
}

/* Asegurar que los submenús son clickeables */
.submenu-filter {
    position: absolute;
    top: 100%;
    left: 0;
    z-index: 1003;
    background: white;
    border-radius: 8px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

.butgrad {
    background: linear-gradient(135deg, rgba(30, 136, 229, 0.1), rgba(13, 71, 161, 0.1));
    border: 1px solid rgba(30, 136, 229, 0.2);
    border-radius: 8px;
    padding: 10px 20px;
    color: var(--primary-color);
    font-size: 1.2rem;
    font-weight: 700;
    text-decoration: none;
}

.butgrad:hover i {
    transform: scale(1.2);
    transition: all 0.4s ease;
}

.butgrad:hover, #assocFiltre:hover {
    transform: translateY(-2px);
}

/* Estilos para el encabezado de asociaciones */
.associations-header {
    text-align: center;
    padding: 2rem 0;
    background: linear-gradient(135deg, rgba(30, 136, 229, 0.1), rgba(13, 71, 161, 0.1));
    border-radius: 15px;
    margin-top: 0.5rem;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    border: 1px solid rgba(30, 136, 229, 0.2);
}

.associations-title {
    color: var(--primary-color);
    font-size: 1.8rem;
    font-weight: 700;
    margin-bottom: 1rem;
    letter-spacing: 1px;
}

.associations-title i {
    color: var(--secondary-color);
    font-size: 1.8rem;
    vertical-align: middle;
}

.associations-subtitle {
    color: #666;
    font-size: 1.2rem;
    font-style: italic;
    display: flex;
    flex-direction: row;
    justify-content: center;
    align-items: center;    
    gap: 20px;
}

@media (max-width: 768px) {
    .main-content {
        min-height: calc(100vh - 112px); /* 112px = navbar (56px) + hero-section (56px) en móvil */
    }

    .main-menu {
        flex-direction: column;
        align-items: stretch;
        gap: 0.5rem;
    }

    .menu-title {
        justify-content: space-between;
    }

    .submenu {
        position: static;
        background: rgba(255, 255, 255, 0.95);
        margin-top: 0.2rem;
        transform: none;
        display: none;
        width: 100%;
        max-height: 80vh;
        overflow-y: auto;
    }

    .menu-item:hover .submenu {
        display: block;
        transform: none;
    }

    .navbar-logo {
        height: 32px;
    }
    
    .brand-text {
        font-size: 1.1rem;
    }

    .hero-section h1 {
        font-size: 2rem;
    }
    
    .filter-card {
        margin-bottom: 2rem;
    }

    .association-item, .tipus-item {
        flex: 0 0 100%;
        max-width: 100%;
    }

    .associations-title {
        font-size: 1.4rem;
    }
    
    .associations-subtitle {
        font-size: 1rem;
    }

}

@media (max-width: 576px) {
    .navbar-logo {
        height: 28px;
    }
    
    .brand-text {
        font-size: 1rem;
    }
}

body.navbar-open {
    overflow: hidden;
}
