/*
 * MODAL-HOTSPOT.CSS - FIXED VERSION
 * Pathfinder Component for Genealogy Research Platform
 * 
 * Key Fix: Proper modal display/positioning for server environments
 */

/* ================================
   HOTSPOT COMPONENT
   ================================ */

.hotspot {
    background: linear-gradient(135deg, #e74c3c, #c0392b);
    color: white;
    border: none;
    padding: 4px 10px;
    border-radius: 15px;
    font-size: 11px;
    font-weight: 500;
    cursor: pointer;
    margin: 0 4px;
    transition: all 0.3s ease;
    box-shadow: 0 2px 6px rgba(231, 76, 60, 0.3);
    display: inline-flex;
    align-items: center;
    gap: 3px;
    vertical-align: middle;
}

.hotspot:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(231, 76, 60, 0.5);
    background: linear-gradient(135deg, #c0392b, #a93226);
}

.hotspot:focus {
    outline: 2px solid #f39c12;
    outline-offset: 2px;
}

/* Hotspot Variations for Different Content Types */
.hotspot-travel {
    background: linear-gradient(135deg, #3498db, #2980b9);
}

.hotspot-travel:hover {
    background: linear-gradient(135deg, #2980b9, #1f618d);
}

.hotspot-document {
    background: linear-gradient(135deg, #9b59b6, #8e44ad);
}

.hotspot-document:hover {
    background: linear-gradient(135deg, #8e44ad, #7d3c98);
}

.hotspot-medical {
    background: linear-gradient(135deg, #e67e22, #d35400);
}

.hotspot-medical:hover {
    background: linear-gradient(135deg, #d35400, #ba4a00);
}

.hotspot-location {
    background: linear-gradient(135deg, #27ae60, #229954);
}

.hotspot-location:hover {
    background: linear-gradient(135deg, #229954, #1e8449);
}

/* ================================
   MODAL SYSTEM - CRITICAL FIXES
   ================================ */

.context-modal {
    /* CRITICAL: Always use fixed positioning */
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    width: 100vw !important;
    height: 100vh !important;
    z-index: 10000 !important;
    
    /* CRITICAL: Overlay background */
    background: rgba(0, 0, 0, 0.6) !important;
    backdrop-filter: blur(5px);
    
    /* CRITICAL: Flexbox centering */
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    
    /* CRITICAL: Hidden by default */
    opacity: 0 !important;
    visibility: hidden !important;
    pointer-events: none !important;
    
    /* Smooth transition */
    transition: all 0.3s ease !important;
}

/* CRITICAL: Active state override */
.context-modal.active {
    opacity: 1 !important;
    visibility: visible !important;
    pointer-events: all !important;
}

.modal-content {
    background: white !important;
    border-radius: 15px !important;
    padding: 0 !important;
    max-width: 90vw !important;
    max-height: 85vh !important;
    width: 700px !important;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3) !important;
    overflow: hidden !important;
    
    /* Animation */
    transform: scale(0.9) !important;
    transition: transform 0.3s ease !important;
}

.context-modal.active .modal-content {
    transform: scale(1) !important;
}

/* ================================
   PATHFINDER MODAL STRUCTURE
   ================================ */

/* Modal Header - Provides Orientation */
.modal-header {
    background: linear-gradient(135deg, #3498db, #2980b9);
    color: white;
    padding: 20px 25px;
    position: relative;
}

.modal-orientation {
    font-size: 0.9em;
    opacity: 0.9;
    margin-bottom: 5px;
    /* Pathfinder principle: "Where am I?" */
}

.modal-title {
    font-size: 1.4em;
    font-weight: 600;
    margin: 0;
}

/* Modal Body - Progressive Disclosure Content */
.modal-body {
    padding: 25px;
    max-height: 60vh;
    overflow-y: auto;
    line-height: 1.7;
}

.modal-body p {
    margin-bottom: 15px;
}

.modal-body strong {
    color: #2c3e50;
}

.modal-body ul {
    margin: 10px 0 15px 20px;
}

.modal-body h3 {
    color: #2c3e50;
    margin: 20px 0 10px 0;
    font-size: 1.2em;
}

/* Modal Footer - Pathfinder Navigation */
.modal-footer {
    background: #f8f9fa;
    padding: 20px 25px;
    border-top: 1px solid #e9ecef;
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: center;
}

/* ================================
   PATHFINDER NAVIGATION BUTTONS
   ================================ */

.pathfinder-nav-btn {
    padding: 10px 16px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.3s ease;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-family: inherit;
}

/* Core Pathfinder States */
.btn-back {
    background: #95a5a6;
    color: white;
    /* Pathfinder principle: "Go back" */
}

.btn-explore {
    background: #3498db;
    color: white;
    /* Pathfinder principle: "More information" */
}

.btn-exit {
    background: #e74c3c;
    color: white;
    /* Pathfinder principle: "Exit gracefully" */
}

.pathfinder-nav-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.pathfinder-nav-btn:focus {
    outline: 2px solid #f39c12;
    outline-offset: 2px;
}

/* ================================
   RESPONSIVE DESIGN
   ================================ */

@media (max-width: 768px) {
    .modal-content {
        width: 95vw !important;
        max-height: 90vh !important;
        margin: 20px !important;
    }

    .modal-header {
        padding: 15px 20px;
    }

    .modal-body {
        padding: 20px;
        max-height: 50vh;
    }

    .modal-footer {
        padding: 15px 20px;
        flex-direction: column;
        align-items: stretch;
    }

    .pathfinder-nav-btn {
        justify-content: center;
        margin-bottom: 5px;
    }

    .hotspot {
        font-size: 10px;
        padding: 3px 8px;
    }
}

@media (max-width: 480px) {
    .modal-content {
        width: 98vw !important;
        max-height: 95vh !important;
    }

    .modal-title {
        font-size: 1.2em;
    }

    .modal-orientation {
        font-size: 0.8em;
    }
}

/* ================================
   ACCESSIBILITY ENHANCEMENTS
   ================================ */

/* Screen reader support */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .hotspot {
        border: 2px solid currentColor;
    }
    
    .modal-content {
        border: 3px solid #000;
    }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    .hotspot,
    .context-modal,
    .modal-content,
    .pathfinder-nav-btn {
        transition: none !important;
    }
    
    .hotspot:hover,
    .pathfinder-nav-btn:hover {
        transform: none !important;
    }
}

/* ================================
   DEBUG HELPERS (Remove in production)
   ================================ */

/* Uncomment these for debugging modal issues */
/*
.context-modal {
    border: 3px solid red !important;
}

.modal-content {
    border: 3px solid blue !important;
}

.context-modal.active {
    background: rgba(255, 0, 0, 0.3) !important;
}
*/