/* ============================================================
   CASAS CACIQUE — Sistema de Modales
   Modal genérico reutilizable para Galería, Plano, Video, Detalles
   ============================================================ */

/* === OVERLAY === */
.cc-modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 9000;
    background: rgba(0, 0, 0, 0.88);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    align-items: center;
    justify-content: center;
    padding: 1rem;
    animation: modalOverlayIn 0.25s ease forwards;
}

.cc-modal-overlay.is-open {
    display: flex;
}

@keyframes modalOverlayIn {
    from { opacity: 0; }
    to   { opacity: 1; }
}

/* === CONTENEDOR === */
.cc-modal {
    position: relative;
    width: 100%;
    max-width: 960px;
    max-height: 92vh;
    display: flex;
    flex-direction: column;
    background: #1a1a1a;
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 32px 80px rgba(0,0,0,0.6), 0 0 0 1px rgba(255,255,255,0.08);
    animation: modalContentIn 0.3s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

@keyframes modalContentIn {
    from { opacity: 0; transform: scale(0.92) translateY(24px); }
    to   { opacity: 1; transform: scale(1)    translateY(0); }
}

/* === HEADER === */
.cc-modal__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1.25rem 1.5rem;
    background: #111;
    border-bottom: 1px solid rgba(255,255,255,0.07);
    flex-shrink: 0;
}

.cc-modal__header-info {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
}

.cc-modal__label {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: #8a9e6e;
    font-weight: 600;
    font-family: 'Inter', sans-serif;
}

.cc-modal__title {
    font-family: 'Playfair Display', serif;
    font-size: 1.1rem;
    font-weight: 600;
    color: #f5f0e8;
    margin: 0;
}

.cc-modal__close {
    width: 38px;
    height: 38px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255,255,255,0.06);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 50%;
    cursor: pointer;
    color: #ccc;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.cc-modal__close:hover {
    background: rgba(255,255,255,0.14);
    color: #fff;
    transform: scale(1.08);
}

.cc-modal__close svg {
    width: 16px;
    height: 16px;
    pointer-events: none;
}

/* === BODY === */
.cc-modal__body {
    overflow-y: auto;
    flex: 1;
    scrollbar-width: thin;
    scrollbar-color: #3a5a20 #111;
}

.cc-modal__body::-webkit-scrollbar { width: 5px; }
.cc-modal__body::-webkit-scrollbar-track { background: #111; }
.cc-modal__body::-webkit-scrollbar-thumb { background: #3a5a20; border-radius: 99px; }


/* ============================================================
   MODO GALERÍA
   ============================================================ */
.cc-modal--gallery .cc-modal__body {
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.cc-gallery {
    position: relative;
    width: 100%;
    height: 60vh;
    min-height: 340px;
    background: #000;
    overflow: hidden;
    flex-shrink: 0;
}

.cc-gallery__track {
    display: flex;
    height: 100%;
    transition: transform 0.45s cubic-bezier(0.25, 1, 0.5, 1);
    will-change: transform;
}

.cc-gallery__slide {
    min-width: 100%;
    height: 100%;
    position: relative;
    overflow: hidden;
}

.cc-gallery__slide img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.cc-gallery__slide-caption {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 1.25rem 1.5rem;
    background: linear-gradient(transparent, rgba(0,0,0,0.72));
    color: #f5f0e8;
    font-family: 'Inter', sans-serif;
    font-size: 0.85rem;
    font-weight: 500;
    letter-spacing: 0.03em;
}

/* Flechas de navegación */
.cc-gallery__btn {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 44px;
    height: 44px;
    background: rgba(0,0,0,0.55);
    border: 1px solid rgba(255,255,255,0.18);
    border-radius: 50%;
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 10;
    transition: all 0.2s ease;
    backdrop-filter: blur(4px);
}

.cc-gallery__btn:hover {
    background: rgba(45, 80, 22, 0.85);
    border-color: rgba(138, 158, 110, 0.5);
    transform: translateY(-50%) scale(1.08);
}

.cc-gallery__btn--prev { left: 1rem; }
.cc-gallery__btn--next { right: 1rem; }

.cc-gallery__btn svg { width: 18px; height: 18px; pointer-events: none; }

/* Contador y thumbnails */
.cc-gallery__footer {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1.5rem;
    padding: 0.9rem 1.5rem;
    background: #111;
    border-top: 1px solid rgba(255,255,255,0.06);
}

.cc-gallery__counter {
    font-family: 'Inter', sans-serif;
    font-size: 0.8rem;
    color: #8a9e6e;
    font-weight: 600;
    letter-spacing: 0.08em;
}

.cc-gallery__dots {
    display: flex;
    gap: 6px;
}

.cc-gallery__dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: rgba(255,255,255,0.22);
    border: none;
    cursor: pointer;
    transition: all 0.2s ease;
    padding: 0;
}

.cc-gallery__dot.is-active {
    background: #8a9e6e;
    transform: scale(1.3);
}


/* ============================================================
   MODO PLANO
   ============================================================ */
.cc-modal--plan .cc-modal__body {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
    background: #f8f6f0;
    min-height: 50vh;
}

.cc-plan__image {
    max-width: 100%;
    max-height: 72vh;
    border-radius: 8px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.2);
    cursor: zoom-in;
    transition: transform 0.3s ease;
}

.cc-plan__image.is-zoomed {
    transform: scale(1.6);
    cursor: zoom-out;
}

.cc-plan__hint {
    margin-top: 0.75rem;
    font-family: 'Inter', sans-serif;
    font-size: 0.75rem;
    color: #7a7a7a;
    text-align: center;
}


/* ============================================================
   MODO VIDEO
   ============================================================ */
.cc-modal--video .cc-modal__body {
    padding: 0;
    background: #000;
}

.cc-video__wrapper {
    position: relative;
    width: 100%;
    padding-bottom: 56.25%; /* 16:9 */
    height: 0;
    overflow: hidden;
}

.cc-video__wrapper iframe {
    position: absolute;
    top: 0; left: 0;
    width: 100%;
    height: 100%;
    border: none;
}


/* ============================================================
   MODO DETALLES TÉCNICOS
   ============================================================ */
.cc-modal--details .cc-modal__body {
    padding: 1.5rem;
    background: #0e0e0e;
}

/* Grid de fichas */
.cc-details__grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

@media (max-width: 640px) {
    .cc-details__grid {
        grid-template-columns: 1fr;
    }
}

/* Ficha individual */
.cc-details__card {
    background: #1a1a1a;
    border: 1px solid rgba(255,255,255,0.07);
    border-radius: 12px;
    overflow: hidden;
    transition: border-color 0.2s ease;
}

.cc-details__card:hover {
    border-color: rgba(138, 158, 110, 0.35);
}

.cc-details__card-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.9rem 1.1rem;
    background: #222;
    border-bottom: 1px solid rgba(255,255,255,0.06);
}

.cc-details__card-icon {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #2d5016, #3a6b1a);
    border-radius: 8px;
    flex-shrink: 0;
    color: #c8d9a0;
}

.cc-details__card-icon svg {
    width: 18px;
    height: 18px;
}

.cc-details__card-title {
    font-family: 'Inter', sans-serif;
    font-size: 0.82rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: #c8d9a0;
    margin: 0;
}

/* Items de la ficha */
.cc-details__items {
    list-style: none;
    margin: 0;
    padding: 0.6rem 0;
}

.cc-details__item {
    display: flex;
    align-items: flex-start;
    gap: 0.6rem;
    padding: 0.45rem 1.1rem;
    font-family: 'Inter', sans-serif;
    font-size: 0.8rem;
    color: #c0bdb4;
    line-height: 1.45;
    border-bottom: 1px solid rgba(255,255,255,0.04);
    transition: background 0.15s ease;
}

.cc-details__item:last-child {
    border-bottom: none;
}

.cc-details__item:hover {
    background: rgba(255,255,255,0.03);
}

.cc-details__item::before {
    content: '';
    width: 5px;
    height: 5px;
    background: #8a9e6e;
    border-radius: 50%;
    flex-shrink: 0;
    margin-top: 0.45em;
}


/* ============================================================
   BARRA DE ACCIONES DE TARJETA (model card)
   ============================================================ */
.model-card__action-bar {
    display: flex;
    gap: 0.5rem;
    margin: 1rem 0 0.75rem;
    padding: 0.75rem;
    background: rgba(45, 80, 22, 0.08);
    border-radius: 10px;
    border: 1px solid rgba(45, 80, 22, 0.15);
}

.model-card__action-btn {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.35rem;
    padding: 0.6rem 0.4rem;
    background: transparent;
    border: 1px solid rgba(45, 80, 22, 0.2);
    border-radius: 8px;
    cursor: pointer;
    color: #2d5016;
    font-family: 'Inter', sans-serif;
    font-size: 0.68rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    transition: all 0.22s ease;
    text-decoration: none;
}

.model-card__action-btn:hover {
    background: #2d5016;
    color: #fff;
    border-color: #2d5016;
    transform: translateY(-2px);
    box-shadow: 0 4px 16px rgba(45, 80, 22, 0.3);
}

.model-card__action-btn svg {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
}

/* Botón de detalles técnicos (outline, full-width) */
.model-card__details-btn {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.65rem 1rem;
    background: transparent;
    border: 1px solid rgba(45, 80, 22, 0.3);
    border-radius: 8px;
    cursor: pointer;
    color: #2d5016;
    font-family: 'Inter', sans-serif;
    font-size: 0.78rem;
    font-weight: 600;
    letter-spacing: 0.04em;
    transition: all 0.22s ease;
    margin-top: 0.5rem;
}

.model-card__details-btn:hover {
    background: rgba(45, 80, 22, 0.08);
    border-color: #2d5016;
    box-shadow: 0 0 0 2px rgba(45, 80, 22, 0.12);
}

.model-card__details-btn svg {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
}

/* Contenedor de acciones inferiores */
.model-card__bottom-actions {
    display: flex;
    gap: 0.75rem;
    align-items: stretch;
    margin-top: 0.75rem;
}

.model-card__bottom-actions .btn {
    flex: 1 1 auto;
}

.model-card__bottom-actions .model-card__details-btn {
    margin-top: 0;
    flex: 1 1 auto;
}


/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 768px) {
    .cc-modal-overlay {
        padding: 0;
        align-items: flex-end;
    }

    .cc-modal {
        max-width: 100%;
        max-height: 96vh;
        border-radius: 20px 20px 0 0;
    }

    .cc-gallery {
        height: 52vw;
        min-height: 240px;
    }

    .cc-details__grid {
        grid-template-columns: 1fr;
    }

    .model-card__action-bar {
        gap: 0.35rem;
    }

    .model-card__action-btn {
        font-size: 0.62rem;
        padding: 0.5rem 0.2rem;
    }

    .model-card__action-btn svg {
        width: 18px;
        height: 18px;
    }

    .model-card__bottom-actions {
        flex-direction: column;
    }
}
