/**
 * Terrall Cards Widget - Estilos
 */

/* Grid de cards */
.terrall-cards-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
    width: 100%;
}

/* Card individual */
.terrall-card {
    background-color: #ffffff;
    border-radius: 20px;
    overflow: hidden;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    display: flex;
    flex-direction: column;
}

/* Wrapper de imagen */
.terrall-card-image-wrapper {
    display: flex;
    justify-content: center;
    padding: 20px 20px 0 20px;
}

/* Imagen del card */
.terrall-card-image {
    width: 100%;
    height: 200px;
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
}

/* Imagen circular */
.terrall-card-image.circular {
    width: 150px;
    height: 150px;
    border-radius: 50%;
    flex-shrink: 0;
}

/* Título del card */
.terrall-card-title {
    font-size: 18px;
    font-weight: 600;
    color: #333333;
    margin: 15px 15px 10px 15px;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
    max-height: 2.8em;
}

/* Wrapper del acordeón */
.terrall-accordion-wrapper {
    padding: 0 15px;
    flex-grow: 1;
}

/* Scroll container */
.terrall-accordion-scroll {
    max-height: 250px;
    overflow-y: auto;
    padding-right: 5px;
}

/* Scrollbar personalizado */
.terrall-accordion-scroll::-webkit-scrollbar {
    width: 6px;
}

.terrall-accordion-scroll::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 3px;
}

.terrall-accordion-scroll::-webkit-scrollbar-thumb {
    background: #0073aa;
    border-radius: 3px;
}

.terrall-accordion-scroll::-webkit-scrollbar-thumb:hover {
    background: #005177;
}

/* Firefox scrollbar */
.terrall-accordion-scroll {
    scrollbar-width: thin;
    scrollbar-color: #0073aa #f1f1f1;
}

/* Item del acordeón */
.terrall-accordion-item {
    border-bottom: 1px solid #eee;
    margin-bottom: 5px;
}

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

/* Items ocultos */
.terrall-accordion-hidden {
    display: none;
}

/* Header del acordeón */
.terrall-accordion-header {
    display: flex;
    align-items: center;
    padding: 12px 0;
    cursor: pointer;
    transition: all 0.3s ease;
    gap: 10px;
}

.terrall-accordion-header:hover {
    opacity: 0.8;
}

/* Icono del acordeón - a la izquierda */
.terrall-accordion-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    color: #2C2A29;
    flex-shrink: 0;
    width: 16px;
    height: 16px;
}

.terrall-accordion-icon svg {
    width: 16px;
    height: 16px;
    transition: transform 0.3s ease;
}

/* Mostrar/ocultar iconos según estado */
/* Cerrado: angle-right | Abierto: angle-down */
.terrall-accordion-icon svg.terrall-icon-open {
    display: none;
}

.terrall-accordion-icon svg.terrall-icon-closed {
    display: block;
}

.terrall-accordion-item.active .terrall-accordion-icon svg.terrall-icon-closed {
    display: none;
}

.terrall-accordion-item.active .terrall-accordion-icon svg.terrall-icon-open {
    display: block;
}

/* Título del acordeón */
.terrall-accordion-title {
    font-size: 14px;
    font-weight: 500;
    color: #2C2A29;
    flex: 1;
}

/* Contenido del acordeón */
.terrall-accordion-content {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease, padding 0.3s ease;
    padding: 0;
}

.terrall-accordion-item.active .terrall-accordion-content {
    max-height: 500px;
    padding: 0 0 15px 0;
}

/* Descripción */
.terrall-accordion-description {
    font-size: 13px;
    color: #666666;
    line-height: 1.5;
    margin: 0 0 10px 0;
}

/* Lista de enlaces externos */
.terrall-external-links {
    list-style: none;
    padding: 0;
    margin: 10px 0 0 0;
    display: flex;
    flex-direction: column;
    gap: 8px;
    align-items: flex-start;
}


.terrall-link-item {
    margin: 0;
    padding: 0;
}

/* Enlace externo */
.terrall-accordion-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    color: #0073aa;
    text-decoration: none;
    font-weight: 500;
    transition: all 0.3s ease;
    padding: 6px 12px;
    border-radius: 4px;
}

.terrall-accordion-link:hover {
    color: #005177;
    background-color: rgba(0, 115, 170, 0.15);
    text-decoration: none;
}

.terrall-link-text {
    flex: 1;
}

/* Icono de enlace externo SVG */
.terrall-external-icon {
    flex-shrink: 0;
    width: 14px;
    height: 14px;
    transition: transform 0.3s ease;
}

.terrall-accordion-link:hover .terrall-external-icon {
    transform: translate(2px, -2px);
}

/* Wrapper del botón */
.terrall-load-more-wrapper {
    padding: 15px;
    text-align: center;
}

/* Botón cargar más */
.terrall-load-more-btn {
    display: inline-block;
    padding: 8px 20px;
    background-color: #0073aa;
    color: #ffffff;
    border: none;
    border-radius: 5px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
}

.terrall-load-more-btn:hover {
    background-color: #005177;
}

.terrall-load-more-btn:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(0, 115, 170, 0.3);
}

/* Estado expandido */
.terrall-accordion-wrapper.expanded .terrall-accordion-hidden {
    display: block;
}

/* Responsive */
@media (max-width: 768px) {
    .terrall-cards-grid {
        grid-template-columns: 1fr;
    }

    .terrall-card-title {
        font-size: 16px;
    }

    .terrall-accordion-title {
        font-size: 13px;
    }

    .terrall-accordion-description {
        font-size: 12px;
    }

    .terrall-accordion-link {
        font-size: 12px;
        padding: 5px 10px;
    }

    .terrall-external-icon {
        width: 12px;
        height: 12px;
    }

    .terrall-external-links {
        gap: 6px;
    }

    .terrall-card-image.circular {
        width: 120px;
        height: 120px;
        margin: 0 auto;
        border-radius: 50%;
    }

    .terrall-card-image-wrapper {
        padding: 15px 15px 0 15px;
    }
}
