/* Navigator Modal Styles */
.modal-overlay {
    position: relative;
    width: 100%;
    height: 0;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    z-index: 1000;
    display: flex;
    flex-direction: column;
    border-radius: 20px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    border: 3px solid #667eea;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    overflow: hidden;
    margin: 0 auto 20px auto;
    max-width: 1200px;
    opacity: 0;
    visibility: hidden;
}

.modal-overlay.active {
    height: 80vh;
    opacity: 1;
    visibility: visible;
}

.modal-overlay.minimized {
    height: 60px;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 25px;
    background: linear-gradient(45deg, #667eea, #764ba2);
    color: white;
    border-radius: 17px 17px 0 0;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    border-bottom: 2px solid #5a67d8;
    min-height: 60px;
}

.modal-title {
    font-size: 18px;
    font-weight: 600;
    flex-grow: 1;
}

.modal-controls {
    display: flex;
    gap: 10px;
}

.modal-minimize,
.modal-close {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 16px;
    font-weight: bold;
    transition: all 0.2s ease;
}

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

.modal-refresh:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: scale(1.1);
}

.modal-refresh {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 16px;
    font-weight: bold;
    transition: all 0.2s ease;
}

.modal-content {
    flex: 1;
    position: relative;
    overflow: hidden;
    border-left: 3px solid #667eea;
    border-right: 3px solid #667eea;
    border-bottom: 3px solid #667eea;
    border-radius: 0 0 17px 17px;
    display: flex;
    flex-direction: column;
}

.modal-loading {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px;
    color: #666;
    font-size: 16px;
}

.loading-spinner {
    width: 40px;
    height: 40px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #667eea;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

#modalIframe {
    width: 100%;
    flex: 1;
    border: none;
    pointer-events: auto;
}

/* Modal footer with help text */
.modal-footer {
    padding: 8px 15px;
    background: rgba(255, 255, 255, 0.95);
    border-top: 1px solid rgba(102, 126, 234, 0.2);
    text-align: center;
    border-radius: 0 0 17px 17px;
}

.modal-help-text {
    font-size: 11px;
    color: #666;
    margin: 0;
}

.modal-help-link {
    color: #667eea;
    text-decoration: none;
    transition: color 0.2s ease;
}

.modal-help-link:hover {
    color: #5a67d8;
    text-decoration: underline;
}

/* Navigator container to position below hero subtitle */
.navigator-container {
    width: 100%;
    max-width: 1200px;
    margin: 20px auto;
    padding: 0 20px;
}

/* Main content adjustments when modal is active */
.main-content.modal-active {
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.main-content.modal-active.minimized {
    /* No special adjustments needed since we're using relative positioning */
}

/* App cards positioning when modal is active */
.app-grid.modal-active {
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(10px);
    padding: 20px;
    margin: 20px auto;
    border-radius: 20px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
    z-index: 900;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 20px;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    max-width: 1200px;
}

.app-grid.modal-active .app-card {
    margin: 0;
    background: rgba(255, 255, 255, 0.8);
    border: 2px solid transparent;
    transition: all 0.3s ease;
}

.app-grid.modal-active .app-card:hover {
    transform: translateY(-5px);
    border-color: #667eea;
}

.app-grid.modal-active .app-card.active {
    border-color: #667eea;
    background: rgba(255, 255, 255, 0.95);
    box-shadow: 0 5px 20px rgba(102, 126, 234, 0.3);
}

/* Hero section adjustments when modal is active */
.hero-section.modal-active {
    margin-bottom: 30px;
}

.hero-section.modal-active .hero-subtitle {
    display: none;
}

/* Mobile responsive */
@media (max-width: 768px) {
    .modal-overlay.active {
        height: 70vh;
    }
    
    .modal-header {
        padding: 12px 20px;
    }
    
    .modal-title {
        font-size: 16px;
    }
    
    .modal-controls button {
        width: 28px;
        height: 28px;
        font-size: 14px;
    }
    
    .modal-footer {
        padding: 6px 12px;
    }
    
    .modal-help-text {
        font-size: 10px;
    }
    
    .app-grid.modal-active {
        margin: 15px;
        padding: 15px;
        gap: 15px;
        grid-template-columns: 1fr;
    }
    
    .navigator-container {
        padding: 0 15px;
    }
}

@media (max-width: 480px) {
    .modal-overlay.active {
        height: 60vh;
    }
    
    .modal-header {
        padding: 10px 15px;
        min-height: 50px;
    }
    
    .modal-title {
        font-size: 14px;
    }
    
    .modal-footer {
        padding: 5px 10px;
    }
    
    .modal-help-text {
        font-size: 9px;
    }
    
    .app-grid.modal-active {
        margin: 10px;
        padding: 10px;
        gap: 10px;
    }
    
    .navigator-container {
        padding: 0 10px;
    }
}

/* Fix for navigation overlap when modal is active */
.main-header {
    z-index: 999 !important;
}

.modal-active .main-header {
    z-index: 500 !important;
}

/* Ensure proper stacking order */
.modal-overlay.active {
    z-index: 1000;
}

.app-grid.modal-active {
    z-index: 1001;
}