/**
 * SIFRON - Estilos para modal interactivo de módulos
 * ID: BRO-MODAL-CSS-001
 */

/* Cursor pointer para iconos clickeables */
.module-icon {
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    position: relative;
}

.module-icon:hover {
    transform: scale(1.1);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.module-icon:active {
    transform: scale(0.95);
}

/* Overlay base */
.module-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(10px);
    z-index: 9998;
    opacity: 0;
    pointer-events: none;
}

.module-modal-overlay.active {
    opacity: 1;
    pointer-events: all;
}

/* Modal container */
.module-modal {
    position: fixed;
    background: linear-gradient(135deg, #ffffff 0%, #f5f8fa 100%);
    border-radius: 20px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.4);
    z-index: 9999;
    overflow: hidden;
    opacity: 0;
    transform-origin: var(--origin-x, center) var(--origin-y, center);
}

/* Animación de expansión */
.module-modal.expanding {
    animation: expandFromIcon 0.4s ease-out forwards;
}

@keyframes expandFromIcon {
    0% {
        left: var(--start-x);
        top: var(--start-y);
        width: var(--start-width);
        height: var(--start-height);
        opacity: 0;
        transform: scale(0.8);
        border-radius: 10px;
    }
    100% {
        left: 15px;
        top: 15px;
        width: calc(100vw - 30px);
        height: calc(100vh - 30px);
        transform: translate(0, 0) scale(1);
        opacity: 1;
        border-radius: 12px;
    }
}

/* Animación de contracción */
.module-modal.collapsing {
    animation: collapseToIcon 0.3s ease-in forwards;
}

@keyframes collapseToIcon {
    0% {
        left: 15px;
        top: 15px;
        width: calc(100vw - 30px);
        height: calc(100vh - 30px);
        transform: translate(0, 0) scale(1);
        opacity: 1;
        border-radius: 12px;
    }
    100% {
        left: var(--start-x);
        top: var(--start-y);
        width: var(--start-width);
        height: var(--start-height);
        opacity: 0;
        transform: scale(0.8);
        border-radius: 10px;
    }
}

/* Header del modal */
.module-modal-header {
    background: linear-gradient(135deg, var(--color-primary, #1a3a2e) 0%, var(--color-primary-light, #2d5a3d) 100%);
    color: #ffffff;
    padding: 20px 30px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 3px solid var(--color-accent, #3a6b4a);
}

.module-modal-header-left {
    display: flex;
    align-items: center;
    gap: 20px;
}

.module-modal-icon {
    width: 60px;
    height: 60px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.module-modal-icon svg {
    width: 36px;
    height: 36px;
    fill: #ffffff;
}

.module-modal-title-container h2 {
    font-size: 28px;
    font-weight: 700;
    margin: 0 0 5px 0;
    line-height: 1.2;
}

.module-modal-id {
    font-size: 11px;
    color: var(--color-text-muted, #a8d5ba);
    font-family: 'Courier New', monospace;
    user-select: all;
    cursor: pointer;
    padding: 2px 6px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
    display: inline-block;
}

.module-modal-id:hover {
    background: rgba(255, 255, 255, 0.2);
}

/* Botón cerrar */
.module-modal-close {
    width: 44px;
    height: 44px;
    background: rgba(255, 255, 255, 0.15);
    border: none;
    border-radius: 10px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.module-modal-close:hover {
    background: rgba(255, 255, 255, 0.25);
    transform: scale(1.1);
}

.module-modal-close:active {
    transform: scale(0.95);
}

.module-modal-close svg {
    width: 24px;
    height: 24px;
    stroke: #ffffff;
    stroke-width: 2;
    fill: none;
}

/* Contenido del modal */
.module-modal-content {
    padding: 0;
    overflow: hidden;
    height: calc(100vh - 109px);
    display: grid;
    grid-template-columns: 50% 50%;
    gap: 0;
}

/* Columna izquierda - Imagen */
.module-modal-image-container {
    background: linear-gradient(135deg, var(--color-primary-light, #2d5a3d) 0%, var(--color-primary, #1a3a2e) 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 30px;
    position: relative;
    overflow: hidden;
}

.module-modal-image {
    width: 100%;
    height: 100%;
    object-fit: contain;
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
}

/* Columna derecha - Contenido textual */
.module-modal-text {
    padding: 25px 30px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.module-modal-summary {
    font-size: 19px;
    color: #475569;
    line-height: 1.4;
    margin-bottom: 18px;
    padding: 12px 15px;
    background: #f0f4f8;
    border-left: 4px solid var(--color-accent, #3a6b4a);
    border-radius: 6px;
}

.module-modal-description {
    font-size: 17px;
    color: #0f172a;
    line-height: 1.4;
    margin-bottom: 18px;
}

.module-modal-section {
    margin-bottom: 18px;
}

.module-modal-section h3 {
    font-size: 20px;
    font-weight: 700;
    color: var(--color-primary, #1a3a2e);
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.module-modal-section h3::before {
    content: '';
    width: 3px;
    height: 16px;
    background: var(--color-accent, #3a6b4a);
    border-radius: 2px;
}

.module-modal-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 5px;
}

.module-modal-list li {
    padding: 5px 10px;
    background: #ffffff;
    border-left: 3px solid var(--color-accent, #3a6b4a);
    border-radius: 4px;
    font-size: 15px;
    color: #334155;
    line-height: 1.3;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
    transition: all 0.2s ease;
}

.module-modal-list li:hover {
    transform: translateX(4px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
    border-left-color: var(--color-primary-light, #2d5a3d);
}

.module-modal-list li::before {
    content: '✓';
    color: var(--color-accent, #3a6b4a);
    font-weight: 700;
    margin-right: 6px;
    font-size: 12px;
}


/* Prevenir scroll del body cuando modal está activo */
body.modal-open {
    overflow: hidden;
}

/* Responsive */
@media (max-width: 768px) {
    .module-modal-header {
        padding: 15px 20px;
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }

    .module-modal-header-left {
        width: 100%;
    }

    .module-modal-close {
        position: absolute;
        top: 10px;
        right: 10px;
    }

    .module-modal-content {
        grid-template-columns: 1fr;
        height: calc(100vh - 86px);
    }

    .module-modal-image-container {
        min-height: 250px;
        padding: 15px;
    }

    .module-modal-text {
        padding: 15px 20px;
    }

    .module-modal-list {
        grid-template-columns: 1fr;
    }

    @keyframes expandFromIcon {
        100% {
            left: 15px;
            top: 15px;
            width: calc(100vw - 30px);
            height: calc(100vh - 30px);
        }
    }
}

/* Indicadores de navegación minimalistas */
.module-modal-nav-arrow {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 32px;
    height: 32px;
    background: color-mix(in srgb, var(--color-accent, #3a6b4a) 30%, transparent);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 4px;
    cursor: pointer;
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    transition: all 0.2s ease;
    backdrop-filter: blur(4px);
}

.module-modal-nav-arrow:hover {
    background: color-mix(in srgb, var(--color-accent, #3a6b4a) 70%, transparent);
    border-color: rgba(255, 255, 255, 0.4);
    transform: translateY(-50%) scale(1.05);
}

.module-modal-nav-arrow.left {
    left: 5px;
}

.module-modal-nav-arrow.right {
    right: 5px;
}

.module-modal-nav-arrow svg {
    width: 18px;
    height: 18px;
    fill: rgba(255, 255, 255, 0.9);
}

.module-modal:hover .module-modal-nav-arrow {
    display: flex;
}

/* Print: ocultar modales */
@media print {
    .module-modal-overlay,
    .module-modal {
        display: none !important;
    }
}
