/* Main Navigation System Styles */

/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    margin: 0;
    padding: 0;
    color: var(--text-color);
    min-height: 100vh;
    overflow-x: hidden;
    overflow-y: auto;
}

/* Light theme variables */
:root {
    --bg: #ffffff;
    --surface: #f8f9fb;
    --muted-surface: #f1f3f5;
    --text-color: #213547;
    --muted-text: #6b7280;
    --heading-color: #0f1724;
    --primary: #0b74de;
    --primary-700: #095fb4;
    --border: #e6e9ef;
    --muted-border: #dee2e6;
    --glass-bg: rgba(255,255,255,0.6);
    --glass-border: rgba(15,23,36,0.06);
    --glass-shadow: 0 6px 20px rgba(16,24,40,0.06);
    --animation-smooth: 0.18s cubic-bezier(.2,.9,.2,1);
    --border-radius: 12px;
    --border-radius-small: 8px;
}

/* Layout Containers */
.container {
    height: 100vh;
    display: flex;
    flex-direction: column;
}

.header-container {
    width: 100%;
}

.main-content {
    display: flex;
    flex: 1;
    height: calc(100vh - 80px);
}

.left-sidebar {
    width: 400px;
    border-right: 1px solid #dee2e6;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
}

.right-pane {
    flex: 1;
    display: flex;
    flex-direction: column;
}

/* Fallback Header Styles */
.header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 20px;
    text-align: center;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 60px;
}

.header h1 {
    margin: 0;
    font-size: 2em;
    font-weight: 300;
}
.header {
    background: linear-gradient(135deg, rgba(11,116,222,0.12) 0%, rgba(11,116,222,0.08) 100%);
    color: var(--heading-color);
    padding: 20px;
    text-align: center;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 60px;
}

.header h1 {
    margin: 0;
    font-size: 2em;
    font-weight: 600;
    color: var(--heading-color);
}

/* Navigation Panel */
.navigation-panel {
    padding: 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.2);
}

.selection-row {
    display: flex;
    flex-direction: column;
    gap: 15px;
    margin-bottom: 15px;
}

.selection-group {
    display: flex;
    flex-direction: column;
}

.selection-label {
    font-weight: 600;
    color: white;
    margin-bottom: 8px;
    font-size: 14px;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.3);
}

.selection-dropdown {
    padding: 10px 15px;
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 6px;
    font-size: 14px;
    color: white;
    cursor: pointer;
    transition: border-color 0.3s;
    width: 100%;
}
.selection-label {
    font-weight: 600;
    color: var(--muted-text);
    margin-bottom: 8px;
    font-size: 14px;
}

.selection-dropdown:hover {
    border-color: rgba(255, 255, 255, 0.6);
}

.selection-dropdown:focus {
    outline: none;
    border-color: rgba(255, 255, 255, 0.8);
    box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.25);
}

/* Breadcrumb Navigation */
.breadcrumb {
    padding: 10px 20px;
    font-size: 12px;
    color: white;
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}
.selection-dropdown {
    padding: 10px 15px;
    border: 1px solid var(--muted-border);
    border-radius: 6px;
    font-size: 14px;
    color: var(--text-color);
    background: var(--surface);
    cursor: pointer;
    transition: border-color 0.3s, box-shadow 0.18s;
    width: 100%;
}

.breadcrumb-separator {
    color: rgba(255, 255, 255, 0.7);
}
.breadcrumb {
    padding: 10px 20px;
    font-size: 12px;
    color: var(--muted-text);
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}
.breadcrumb-separator {
    color: rgba(33,53,71,0.12);
}

/* File Selection Area */
.current-selection {
    padding: 20px;
    flex: 1;
    overflow-y: auto;
    display: none;
}

.current-selection.active {
    display: block;
}

.selection-title {
    font-size: 16px;
    font-weight: 600;
    color: white;
    margin-bottom: 15px;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.3);
}

.file-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.file-item {
    padding: 10px 12px;
    border: 1px solid #dee2e6;
    border-radius: 6px;
    margin-bottom: 6px;
    background: #f8f9fa;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.file-item:hover {
    background: #e9ecef;
    border-color: #007bff;
    transform: translateX(3px);
}
.file-item {
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: 6px;
    margin-bottom: 6px;
    background: var(--surface);
    cursor: pointer;
    transition: transform 0.18s ease, box-shadow 0.18s ease;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.file-item-content {
    flex: 1;
}

.file-item-buttons {
    display: flex;
    gap: 5px;
    margin-left: 10px;
}

.file-open-btn {
    background: #007bff;
    color: white;
    border: none;
    padding: 4px 8px;
    border-radius: 3px;
    cursor: pointer;
    font-size: 10px;
    white-space: nowrap;
    transition: background-color 0.2s;
}

.file-open-btn:hover {
    background: #0056b3;
}
.file-open-btn {
    background: var(--primary);
    color: white;
    border: none;
    padding: 6px 10px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 12px;
    white-space: nowrap;
    transition: background-color 0.18s;
}
.file-open-btn:hover {
    background: var(--primary-700);
}

.file-name {
    font-weight: 500;
    color: #007bff;
    font-size: 14px;
}

.file-path {
    font-size: 11px;
    color: #6c757d;
    font-family: monospace;
    margin-top: 4px;
}
.file-name {
    font-weight: 600;
    color: var(--heading-color);
    font-size: 14px;
}
.file-path {
    font-size: 11px;
    color: var(--muted-text);
    font-family: monospace;
    margin-top: 4px;
}

/* Content Viewer */
.iframe-container {
    flex: 1;
    display: none;
    flex-direction: column;
    background: white;
    height: 100%;
}

.iframe-content-wrapper {
    position: relative;
    flex: 1;
}

.iframe-content-wrapper iframe {
    opacity: 0;
    transition: opacity 0.3s;
}

.iframe-content-wrapper iframe.loaded {
    opacity: 1;
}
.iframe-container {
    flex: 1;
    display: none;
    flex-direction: column;
    background: var(--bg);
    height: 100%;
}

.iframe-header {
    background: #f8f9fa;
    padding: 15px 20px;
    border-bottom: 1px solid #dee2e6;
    font-weight: 600;
    color: #495057;
    display: flex;
    justify-content: space-between;
    align-items: center;
    min-height: 50px;
}

.iframe-header-buttons {
    display: flex;
    gap: 10px;
    align-items: center;
}
.iframe-header {
    background: var(--surface);
    padding: 15px 20px;
    border-bottom: 1px solid var(--muted-border);
    font-weight: 600;
    color: var(--heading-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
    min-height: 50px;
}

.open-new-tab-btn {
    background: #007bff;
    color: white;
    border: none;
    padding: 8px 12px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
    display: flex;
    align-items: center;
    gap: 5px;
    transition: background-color 0.2s;
}

.open-new-tab-btn:hover {
    background: #0056b3;
}

.close-viewer {
    background: #dc3545;
    color: white;
    border: none;
    padding: 8px 12px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
}

.close-viewer:hover {
    background: #c82333;
}

iframe {
    width: 100%;
    height: 100%;
    border: none;
    flex: 1;
}

/* Welcome Message */
.welcome-message {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    flex: 1;
    padding: 40px;
    text-align: center;
    color: #6c757d;
}

.welcome-message h2 {
    margin-bottom: 10px;
    color: #495057;
}

/* Resizer */
.resizer {
    width: 5px;
    background: #dee2e6;
    cursor: col-resize;
    transition: background-color 0.2s;
}

.resizer:hover {
    background: #007bff;
}

/* Loading Animation */
.loading-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.9);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 10;
}

.loading-spinner {
    width: 40px;
    height: 40px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #007bff;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}
.loading-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.9);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 10;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Fallback Footer */
.fallback-footer {
    background: #2c3e50;
    color: white;
    padding: 20px;
    text-align: center;
    margin-top: auto;
}

/* Footer placeholder positioning */
#footer-placeholder {
    margin-top: auto;
}

/* Viewer Title Styles */
.viewer-filename {
    font-size: 0.8em;
    opacity: 0.7;
}

/* Enhanced responsive design */
@media (max-width: 768px) {
    body {
        overflow: auto;
    }
    
    .container {
        height: auto;
        min-height: 100vh;
    }
    
    .main-content {
        flex-direction: column;
        height: auto;
        min-height: calc(100vh - 80px);
    }
    
    .left-sidebar {
        width: 100%;
        border-right: none;
        border-bottom: 1px solid #dee2e6;
        padding: 1rem;
        box-sizing: border-box;
    }
    
    .resizer {
        display: none;
    }
    
    /* Navigation panel mobile improvements */
    .navigation-panel {
        padding: 1rem;
    }
    
    .selection-row {
        gap: 1rem;
    }
    
    .selection-dropdown {
        font-size: 16px; /* Prevents zoom on iOS */
        padding: 12px 15px;
    }
    
    /* Breadcrumb mobile improvements */
    .breadcrumb {
        flex-wrap: wrap;
        padding: 0.75rem 1rem;
        font-size: 0.8rem;
    }
    
    .breadcrumb-separator {
        margin: 0 0.25rem;
    }
    
    /* File list mobile improvements */
    .file-item {
        padding: 12px;
        margin-bottom: 8px;
        border-radius: 8px;
    }
    
    .file-name {
        font-size: 0.9rem;
    }
    
    .file-path {
        font-size: 0.75rem;
        word-break: break-all;
    }
    
    /* Welcome message mobile improvements */
    .welcome-message {
        padding: 2rem 1rem;
        text-align: center;
    }
    
    .welcome-message h2 {
        font-size: 1.5rem;
        margin-bottom: 1rem;
    }
    
    .welcome-message p {
        font-size: 0.9rem;
        line-height: 1.5;
    }
    
    /* Iframe mobile improvements */
    .iframe-container {
        margin: 0.5rem;
        border-radius: 8px;
    }
    
    .iframe-header {
        padding: 10px 15px;
        font-size: 0.9rem;
        flex-direction: column;
        gap: 0.5rem;
        align-items: stretch;
    }
    
    .close-viewer {
        align-self: flex-end;
        padding: 6px 10px;
        font-size: 0.8rem;
    }
    
    /* Mobile improvements for new tab buttons */
    .iframe-header-buttons {
        gap: 8px;
        flex-wrap: wrap;
    }
    
    .open-new-tab-btn,
    .close-viewer {
        min-height: 44px;
        padding: 10px 12px;
        font-size: 14px;
        touch-action: manipulation;
    }
    
    .file-item-buttons {
        gap: 6px;
        margin-left: 8px;
    }
    
    .file-open-btn {
        min-height: 36px;
        padding: 6px 8px;
        font-size: 11px;
        touch-action: manipulation;
    }
    
    /* Smaller screens adjustments */
    @media (max-width: 480px) {
        .selection-row {
            gap: 0.75rem;
        }
        
        .selection-label {
            font-size: 0.9rem;
        }
        
        .selection-dropdown {
            padding: 10px 12px;
            font-size: 14px;
        }
        
        .breadcrumb {
            font-size: 0.75rem;
            padding: 0.5rem;
        }
        
        .welcome-message {
            padding: 1.5rem 0.75rem;
        }
        
        .welcome-message h2 {
            font-size: 1.25rem;
        }
        
        .file-item {
            padding: 10px;
        }
        
        .iframe-header {
            padding: 10px 12px;
            flex-wrap: wrap;
            gap: 6px;
        }
        
        .iframe-header-buttons {
            gap: 4px;
        }
        
        .open-new-tab-btn,
        .close-viewer {
            font-size: 12px;
            padding: 8px 10px;
        }
        
        .file-open-btn {
            font-size: 10px;
            padding: 4px 6px;
            min-height: 32px;
        }
    }
}
