﻿/* ============================================
   MODAL.CSS - HOLOGRAPHIC MODAL SYSTEM
   "I Am Everywhere" - Alicia Mae Foundation
   Halo/Cortana inspired modal dialogs
   ============================================ */

/* ===== MODAL OVERLAY ===== */
.holo-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(10, 14, 39, 0.95);
    backdrop-filter: blur(10px);
    z-index: 100000;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.4s ease, visibility 0.4s ease;
    padding: 20px;
}

    .holo-modal-overlay.active {
        opacity: 1;
        visibility: visible;
    }

    /* Particle background */
    .holo-modal-overlay::before {
        content: '';
        position: absolute;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        background: radial-gradient(2px 2px at 15% 25%, var(--holo-pink-bright), transparent), radial-gradient(1px 1px at 65% 75%, var(--holo-cyan), transparent), radial-gradient(1px 1px at 45% 45%, var(--holo-purple), transparent), radial-gradient(2px 2px at 85% 15%, var(--holo-pink-mid), transparent), radial-gradient(1px 1px at 25% 85%, var(--holo-cyan), transparent);
        background-size: 200% 200%;
        animation: modal-particles-drift 30s linear infinite;
        opacity: 0.3;
        pointer-events: none;
    }

@keyframes modal-particles-drift {
    0%, 100% {
        background-position: 0% 0%, 0% 0%, 0% 0%, 0% 0%, 0% 0%;
    }

    50% {
        background-position: 100% 100%, 50% 50%, 25% 75%, 75% 25%, 90% 10%;
    }
}

/* ===== MODAL CONTAINER ===== */
.holo-modal-container {
    position: relative;
    max-width: 600px;
    width: 100%;
    /* UPDATED: Height Constraint & Layout */
    max-height: 85vh; /* Never exceed 85% of screen height */
    display: flex; /* Use flexbox to stack children */
    flex-direction: column; /* Stack vertically */

    background: rgba(26, 31, 58, 0.85);
    backdrop-filter: blur(20px);
    border: 2px solid var(--holo-pink-mid);
    border-radius: 20px;
    box-shadow: 0 0 40px var(--holo-pink-glow), inset 0 0 40px rgba(255, 110, 199, 0.1), 0 20px 60px rgba(0, 0, 0, 0.6);
    padding: 40px;
    overflow: hidden; /* Keeps the scanlines inside */
    transform: scale(0.8);
    opacity: 0;
    transition: transform 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275), opacity 0.4s ease;
}

.holo-modal-overlay.active .holo-modal-container {
    transform: scale(1);
    opacity: 1;
}

/* Glow pulse effect */
.holo-modal-container::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient( circle, var(--holo-pink-glow) 0%, transparent 60% );
    animation: modal-glow-pulse 6s ease-in-out infinite;
    pointer-events: none;
    z-index: 0;
}

@keyframes modal-glow-pulse {
    0%, 100% {
        opacity: 0.2;
        transform: translate(0, 0) rotate(0deg);
    }

    50% {
        opacity: 0.4;
        transform: translate(15%, 15%) rotate(180deg);
    }
}

/* ===== HUD CORNER BRACKETS ===== */
.hud-bracket {
    position: absolute;
    width: 50px;
    height: 50px;
    z-index: 20; /* Ensure brackets stay on top of scrollbars */
    pointer-events: none; /* Let clicks pass through */
}

.hud-bracket-tl {
    top: 15px;
    left: 15px;
    border-top: 3px solid var(--holo-pink-bright);
    border-left: 3px solid var(--holo-pink-bright);
    box-shadow: 0 0 10px var(--holo-pink-glow);
    animation: hud-bracket-flicker 3s ease-in-out infinite;
}

.hud-bracket-tr {
    top: 15px;
    right: 15px;
    border-top: 3px solid var(--holo-pink-bright);
    border-right: 3px solid var(--holo-pink-bright);
    box-shadow: 0 0 10px var(--holo-pink-glow);
    animation: hud-bracket-flicker 3s ease-in-out infinite 0.75s;
}

.hud-bracket-bl {
    bottom: 15px;
    left: 15px;
    border-bottom: 3px solid var(--holo-pink-bright);
    border-left: 3px solid var(--holo-pink-bright);
    box-shadow: 0 0 10px var(--holo-pink-glow);
    animation: hud-bracket-flicker 3s ease-in-out infinite 1.5s;
}

.hud-bracket-br {
    bottom: 15px;
    right: 15px;
    border-bottom: 3px solid var(--holo-pink-bright);
    border-right: 3px solid var(--holo-pink-bright);
    box-shadow: 0 0 10px var(--holo-pink-glow);
    animation: hud-bracket-flicker 3s ease-in-out infinite 2.25s;
}

@keyframes hud-bracket-flicker {
    0%, 100% {
        opacity: 1;
    }

    50% {
        opacity: 0.7;
    }
}

/* ===== SCAN LINES ===== */
.holo-modal-scanlines {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: repeating-linear-gradient( 0deg, transparent 0px, rgba(255, 110, 199, 0.05) 1px, transparent 2px, transparent 4px );
    animation: modal-scanlines 8s linear infinite;
    pointer-events: none;
    z-index: 1;
    opacity: 0.4;
}

@keyframes modal-scanlines {
    0% {
        transform: translateY(0);
    }

    100% {
        transform: translateY(4px);
    }
}

/* ===== CLOSE BUTTON ===== */
.holo-modal-close {
    position: absolute;
    top: 20px;
    right: 20px;
    width: 40px;
    height: 40px;
    background: rgba(26, 31, 58, 0.8);
    backdrop-filter: blur(10px);
    border: 2px solid var(--holo-pink-mid);
    border-radius: 50%;
    color: var(--holo-pink-soft);
    font-size: 28px;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 30; /* Keep above everything */
    transition: all 0.3s ease;
    box-shadow: 0 0 15px var(--holo-pink-glow);
}

    .holo-modal-close:hover {
        background: rgba(26, 31, 58, 0.95);
        border-color: var(--holo-pink-bright);
        transform: rotate(90deg) scale(1.1);
        box-shadow: 0 0 25px var(--holo-pink-glow);
    }

    .holo-modal-close span {
        text-shadow: 0 0 10px var(--holo-pink-glow);
    }

/* ===== MODAL HEADER ===== */
.holo-modal-header {
    text-align: center;
    margin-bottom: 20px; /* Reduced margin */
    position: relative;
    z-index: 2;
    flex-shrink: 0; /* Prevents header from shrinking when content is long */
}

.holo-modal-icon {
    font-size: 60px;
    margin-bottom: 15px;
    animation: icon-float 3s ease-in-out infinite;
    display: flex;
    justify-content: center;
    align-items: center;
}

    .holo-modal-icon img {
        animation: icon-float 3s ease-in-out infinite;
    }

.icon-glow {
    display: inline-block;
    filter: drop-shadow(0 0 20px var(--holo-pink-glow));
}

@keyframes icon-float {
    0%, 100% {
        transform: translateY(0);
    }

    50% {
        transform: translateY(-10px);
    }
}

.holo-modal-title {
    font-size: 36px;
    color: var(--holo-pink-soft);
    margin-bottom: 5px;
    font-family: 'Georgia', serif;
    text-shadow: 0 0 20px var(--holo-pink-glow);
    letter-spacing: 2px;
}

.title-glitch {
    position: relative;
    display: inline-block;
}

.holo-modal-subtitle {
    font-size: 18px;
    color: var(--holo-cyan);
    font-style: italic;
    text-shadow: 0 0 10px rgba(125, 211, 252, 0.5);
}

/* ===== MODAL BODY (UPDATED) ===== */
.holo-modal-body {
    position: relative;
    z-index: 2;
    margin-bottom: 20px;
    /* UPDATED: Scroll Logic */
    flex: 1; /* Takes up remaining space */
    overflow-y: auto; /* Enables vertical scroll */
    padding-right: 15px; /* Spacing for scrollbar */
    /* Firefox scrollbar */
    scrollbar-width: thin;
    scrollbar-color: var(--holo-pink-mid) rgba(26, 31, 58, 0.3);
}

    /* Custom Scrollbar Webkit (Chrome/Edge/Safari) */
    .holo-modal-body::-webkit-scrollbar {
        width: 6px;
    }

    .holo-modal-body::-webkit-scrollbar-track {
        background: rgba(26, 31, 58, 0.3);
        border-radius: 4px;
    }

    .holo-modal-body::-webkit-scrollbar-thumb {
        background: var(--holo-pink-mid);
        border-radius: 4px;
        box-shadow: 0 0 10px var(--holo-pink-glow);
    }

        .holo-modal-body::-webkit-scrollbar-thumb:hover {
            background: var(--holo-pink-bright);
        }

.holo-modal-content {
    color: var(--holo-pink-soft);
    font-size: 16px;
    line-height: 1.8;
    text-align: center;
}

    .holo-modal-content p {
        margin-bottom: 15px;
        text-shadow: 0 0 5px rgba(255, 110, 199, 0.2);
    }

        .holo-modal-content p:last-child {
            margin-bottom: 0;
        }

    .holo-modal-content strong {
        color: var(--holo-pink-bright);
        text-shadow: 0 0 10px var(--holo-pink-glow);
    }

/* ===== MODAL FOOTER ===== */
.holo-modal-footer {
    display: flex;
    justify-content: center;
    gap: 15px;
    position: relative;
    z-index: 2;
    flex-shrink: 0; /* Keeps footer fixed at bottom */
    padding-top: 10px;
}

/* ===== AUDIO PLAYER ===== */
.holo-modal-audio {
    margin-top: 25px;
    text-align: center;
}

.holo-audio-control {
    background: rgba(26, 31, 58, 0.6);
    border: 2px solid var(--holo-cyan);
    color: var(--holo-cyan);
    padding: 12px 30px;
    font-size: 16px;
    border-radius: 25px;
    cursor: pointer;
    font-family: 'Georgia', serif;
    letter-spacing: 1px;
    transition: all 0.3s ease;
    box-shadow: 0 0 15px rgba(125, 211, 252, 0.4);
    display: inline-flex;
    align-items: center;
    gap: 8px;
    position: relative;
    overflow: hidden;
}

    .holo-audio-control::before {
        content: '';
        position: absolute;
        top: -50%;
        left: -50%;
        width: 200%;
        height: 200%;
        background: radial-gradient( circle, rgba(125, 211, 252, 0.2) 0%, transparent 70% );
        opacity: 0;
        transition: opacity 0.3s ease;
    }

    .holo-audio-control:hover::before {
        opacity: 1;
        animation: audio-btn-pulse 1.5s ease-in-out infinite;
    }

@keyframes audio-btn-pulse {
    0%, 100% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.2);
    }
}

.holo-audio-control:hover {
    transform: translateY(-2px);
    border-color: var(--holo-pink-bright);
    color: var(--holo-pink-soft);
    box-shadow: 0 0 25px var(--holo-pink-glow), 0 0 50px rgba(255, 110, 199, 0.4);
}

.holo-audio-control.playing {
    border-color: var(--holo-pink-bright);
    color: var(--holo-pink-soft);
    box-shadow: 0 0 25px var(--holo-pink-glow);
    animation: audio-playing-pulse 2s ease-in-out infinite;
}

@keyframes audio-playing-pulse {
    0%, 100% {
        box-shadow: 0 0 25px var(--holo-pink-glow);
    }

    50% {
        box-shadow: 0 0 35px var(--holo-pink-glow), 0 0 50px rgba(255, 110, 199, 0.5);
    }
}

.audio-icon {
    font-size: 18px;
}

.audio-text {
    position: relative;
    z-index: 1;
}

.btn-holo-primary {
    background: var(--gradient-holo);
    color: white;
    border: 2px solid var(--holo-pink-bright);
    padding: 12px 30px;
    font-size: 16px;
    border-radius: 25px;
    cursor: pointer;
    font-family: 'Georgia', serif;
    letter-spacing: 1px;
    transition: all 0.3s ease;
    box-shadow: 0 0 15px var(--holo-pink-glow);
    display: inline-flex;
    align-items: center;
    gap: 8px;
    position: relative;
    overflow: hidden;
}

    .btn-holo-primary::before {
        content: '';
        position: absolute;
        top: -50%;
        left: -50%;
        width: 200%;
        height: 200%;
        background: radial-gradient( circle, rgba(255, 255, 255, 0.3) 0%, transparent 70% );
        opacity: 0;
        transition: opacity 0.3s ease;
    }

    .btn-holo-primary:hover::before {
        opacity: 1;
        animation: btn-pulse 1.5s ease-in-out infinite;
    }

@keyframes btn-pulse {
    0%, 100% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.2);
    }
}

.btn-holo-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 0 25px var(--holo-pink-glow), 0 0 50px rgba(255, 110, 199, 0.4);
}

.btn-icon {
    font-size: 18px;
}

.btn-text {
    position: relative;
    z-index: 1;
}

/* ===== DATA STREAM EFFECT ===== */
.holo-data-stream {
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient( 90deg, transparent, var(--holo-pink-glow), transparent );
    animation: modal-data-stream 4s ease-in-out infinite;
    pointer-events: none;
    z-index: 1;
}

@keyframes modal-data-stream {
    0% {
        left: -100%;
    }

    50%, 100% {
        left: 100%;
    }
}

/* ===== RESPONSIVE DESIGN ===== */
@media (max-width: 768px) {
    .holo-modal-container {
        padding: 30px 25px;
        margin: 20px;
        max-height: 80vh; /* Slightly smaller on mobile */
    }

    .holo-modal-title {
        font-size: 28px;
    }

    .holo-modal-icon {
        font-size: 50px;
    }

    .holo-modal-subtitle {
        font-size: 16px;
    }

    .holo-modal-content {
        font-size: 15px;
    }

    .btn-holo-primary {
        padding: 10px 25px;
        font-size: 15px;
    }

    .hud-bracket {
        width: 35px;
        height: 35px;
    }
}

@media (max-width: 480px) {
    .holo-modal-container {
        padding: 25px 20px;
    }

    .holo-modal-title {
        font-size: 24px;
    }

    .holo-modal-icon {
        font-size: 45px;
    }

    .holo-modal-close {
        width: 35px;
        height: 35px;
        font-size: 24px;
    }
}

/* ===== ACCESSIBILITY ===== */
.holo-modal-close:focus-visible,
.btn-holo-primary:focus-visible {
    outline: 3px solid var(--holo-pink-bright);
    outline-offset: 4px;
}

/* ===== REDUCED MOTION ===== */
@media (prefers-reduced-motion: reduce) {
    .holo-modal-container::before,
    .holo-modal-scanlines,
    .holo-data-stream,
    .holo-modal-icon,
    .btn-holo-primary::before,
    .holo-modal-overlay::before {
        animation: none !important;
    }

    .hud-bracket {
        animation: none !important;
        opacity: 1;
    }
}

/* ===== PRINT ===== */
@media print {
    .holo-modal-overlay {
        display: none !important;
    }
}
