/* Route Briefing Modal Styles */

#route-briefing-modal {
    position: fixed;
    z-index: 2000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.7);
    animation: fadeIn 0.3s;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

#route-briefing-modal .modal-content {
    background-color: #ffffff;
    margin: 3% auto;
    padding: 0;
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    max-width: 1000px;
    max-height: 90vh;
    overflow: auto;
    animation: slideIn 0.3s;
    backdrop-filter: saturate(1.1) blur(2px);
}

#route-briefing-modal .modal-header {
    position: sticky;
    top: 0;
    z-index: 5;
    background: linear-gradient(135deg, #1e3c72 0%, #2a5298 100%);
    color: white;
    padding: 18px 22px;
    border-radius: 12px 12px 0 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.18);
    border-bottom: 1px solid rgba(255, 255, 255, 0.12);
}

#route-briefing-modal .modal-header h2 {
    margin: 0;
    font-size: 1.35em;
    font-weight: 700;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
    letter-spacing: 0.2px;
}

#route-briefing-modal .modal-header .header-left {
    display: flex;
    align-items: center;
    gap: 12px;
    flex: 1 1 auto;
    min-width: 0;
}

#route-briefing-modal .modal-header .route-icon {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, rgba(255,255,255,0.2), rgba(255,255,255,0.06));
    box-shadow: inset 0 1px 2px rgba(255,255,255,0.25), inset 0 -1px 2px rgba(0,0,0,0.08);
}

#route-briefing-modal .modal-header .route-subtitle {
    margin-top: 2px;
    color: rgba(255,255,255,0.9);
    font-size: 0.85em;
    font-weight: 400;
    opacity: 0.9;
}

#route-briefing-modal .modal-header .header-right {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 0 0 auto;
}

#route-briefing-modal .close {
    font-size: 28px;
    font-weight: 300;
    cursor: pointer;
    opacity: 0.9;
    transition: all 0.25s ease;
    background: rgba(255, 255, 255, 0.12);
    border-radius: 10px;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}

#route-briefing-modal .close:hover {
    opacity: 1;
    background: rgba(255, 255, 255, 0.22);
    transform: translateY(-1px);
}

/* Risk badge */
#route-briefing-modal .risk-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    gap: 4px;
    padding: 10px 12px;
    border-radius: 10px;
    font-weight: 700;
    font-size: 0.9em;
    letter-spacing: 0.3px;
    box-shadow: 0 6px 14px rgba(0,0,0,0.18);
    border: 1px solid rgba(255,255,255,0.18);
    color: #ffffff;
    min-width: 92px;
    text-align: center;
}

#route-briefing-modal .risk-badge .risk-level { opacity: 0.95; font-size: 1.05em; line-height: 1.1; }
#route-briefing-modal .risk-badge .risk-score { opacity: 0.9; font-weight: 600; font-size: 0.85em; line-height: 1.1; }

/* Risk themes */
#route-briefing-modal .risk-badge.risk-low { background: linear-gradient(135deg, #2ecc71, #27ae60); }
#route-briefing-modal .risk-badge.risk-medium { background: linear-gradient(135deg, #f39c12, #d35400); }
#route-briefing-modal .risk-badge.risk-high { background: linear-gradient(135deg, #e74c3c, #c0392b); }
#route-briefing-modal .risk-badge.risk-critical { background: linear-gradient(135deg, #9b59b6, #8e44ad); }
#route-briefing-modal .risk-badge.risk-unknown { background: linear-gradient(135deg, #95a5a6, #7f8c8d); }

#route-briefing-modal .modal-body {
    padding: 24px;
    background: #f8f9fa;
}

/* Route Briefing Content Styles */

.route-briefing {
    line-height: 1.6;
    color: #333;
    background: white;
    border-radius: 8px;
    overflow: hidden;
}

.briefing-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding: 18px 20px;
    background: linear-gradient(135deg, #f8f9fa 0%, #eef1f4 100%);
    border-radius: 10px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    border: 1px solid #e9ecef;
}

.route-info h3 {
    margin: 0 0 8px 0;
    color: #1e3c72;
    font-size: 1.5em;
    font-weight: 700;
}

.route-info p {
    margin: 0;
    color: #495057;
    font-size: 1em;
    font-weight: 500;
}

.risk-score {
    min-width: 140px;
    padding: 20px;
    text-align: center;
    border-radius: 12px;
    font-weight: bold;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    border: 2px solid rgba(255, 255, 255, 0.3);
}

.briefing-sections {
    padding: 0 25px 25px;
}

.briefing-sections > div {
    margin-bottom: 25px;
    background: white;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08);
}

.briefing-sections h4 {
    margin: 0;
    color: #1e3c72;
    font-size: 1.2em;
    font-weight: 600;
    padding: 15px 20px;
    background: #f8f9fa;
    border-bottom: 1px solid #e9ecef;
}

.primary-concern {
    border-left: 4px solid #ffc107;
}

.primary-concern p {
    background: linear-gradient(135deg, #fff3cd 0%, #ffeaa7 100%);
    padding: 20px;
    margin: 15px 20px 20px;
    border-radius: 8px;
    font-size: 1.05em;
    font-weight: 500;
    color: #856404;
    box-shadow: 0 2px 8px rgba(255, 193, 7, 0.2);
}

.route-threats {
    border-left: 4px solid #dc3545;
}

.route-threats ul {
    margin: 15px 20px 20px;
    padding: 0;
    list-style: none;
}

.route-threats li {
    background: #f8d7da;
    margin-bottom: 10px;
    padding: 12px 16px;
    border-radius: 6px;
    border-left: 3px solid #dc3545;
    color: #721c24;
    font-weight: 500;
    position: relative;
    padding-left: 35px;
}

.route-threats li::before {
    content: '⚠️';
    position: absolute;
    left: 12px;
    top: 12px;
}

.recommendations {
    border-left: 4px solid #28a745;
}

.recommendations ul {
    background: linear-gradient(135deg, #d4edda 0%, #c3e6cb 100%);
    padding: 20px 20px 20px 40px;
    margin: 15px 20px 20px;
    border-radius: 8px;
    list-style: none;
    box-shadow: 0 2px 8px rgba(40, 167, 69, 0.15);
}

.recommendations li {
    color: #155724;
    margin-bottom: 12px;
    font-weight: 500;
    position: relative;
    padding-left: 20px;
}

.recommendations li::before {
    content: '💡';
    position: absolute;
    left: -5px;
    top: 0;
}

.countries-analysis {
    border-left: 4px solid #17a2b8;
}

.countries-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 15px;
    padding: 20px;
    margin: 15px 20px 20px;
    background: #f8f9fa;
    border-radius: 8px;
}

.country-risk {
    padding: 15px;
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
    border: 1px solid #e9ecef;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

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

.country-risk strong {
    display: block;
    margin-bottom: 8px;
    color: #1e3c72;
    font-size: 1.1em;
    font-weight: 600;
}

.notams-briefing {
    border-left: 4px solid #fd7e14;
}

.airport-notams {
    margin-bottom: 20px;
}

.airport-notams h5 {
    color: #0066cc;
    margin: 0 0 10px 0;
    font-size: 1em;
    font-weight: 600;
    padding: 10px 20px;
    background: #e7f3ff;
    border-radius: 6px;
}

.enroute-notams h5 {
    color: #cc6600;
    margin: 0 0 10px 0;
    font-size: 1em;
    font-weight: 600;
    padding: 10px 20px;
    background: #fff5e6;
    border-radius: 6px;
}

.notam-height-high {
    background: #dc3545;
    color: white;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 0.85em;
    font-weight: 600;
    margin-left: 8px;
}

.notams-list {
    max-height: 350px;
    overflow-y: auto;
    margin: 15px 20px 20px;
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08);
}

.notam-item {
    border-bottom: 1px solid #f1f3f4;
    padding: 16px 20px;
    transition: all 0.2s ease;
    position: relative;
}

.notam-item:hover {
    background-color: #f8f9fa;
    border-left: 4px solid #fd7e14;
    padding-left: 16px;
}

.notam-item:last-child {
    border-bottom: none;
}

.notam-item strong {
    color: #1e3c72;
    font-weight: 600;
    font-size: 1.05em;
}

.notam-item .notam-meta {
    color: #6c757d;
    font-size: 0.9em;
    margin: 4px 0;
}

.notam-item .notam-height {
    background: #fff3cd;
    color: #856404;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 0.85em;
    font-weight: 600;
    margin-left: 8px;
}

.notam-item .notam-description {
    color: #495057;
    font-size: 0.95em;
    margin-top: 8px;
    line-height: 1.5;
    background: #f8f9fa;
    padding: 8px 12px;
    border-radius: 6px;
    border-left: 3px solid #fd7e14;
}

.briefing-meta {
    margin-top: 20px;
    padding-top: 15px;
    border-top: 1px solid #eee;
    text-align: center;
    color: #666;
    font-size: 0.85em;
}

.loading {
    text-align: center;
    padding: 60px 40px;
    color: #495057;
    font-size: 1.2em;
    background: white;
    border-radius: 8px;
    margin: 20px;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08);
}

.briefing-error {
    text-align: center;
    padding: 60px 40px;
    color: #dc3545;
    background: white;
    border-radius: 8px;
    margin: 20px;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08);
}

.briefing-meta {
    margin-top: 30px;
    padding: 20px;
    background: #e9ecef;
    border-radius: 8px;
    text-align: center;
    color: #6c757d;
    font-size: 0.9em;
    border-top: 3px solid #dee2e6;
}

/* Animations */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes slideIn {
    from { 
        opacity: 0;
        transform: translateY(-50px);
    }
    to { 
        opacity: 1;
        transform: translateY(0);
    }
}

/* Route Risk Cell Enhancements */
.route-risk-clickable {
    cursor: pointer !important;
    text-decoration: underline;
    transition: background-color 0.2s;
}

.route-risk-clickable:hover {
    background-color: rgba(0, 123, 255, 0.1);
}

/* New Accordion Styles for Geopolitical Section */
.country-risk-accordion details {
    border-bottom: 1px solid #dee2e6;
}

.country-risk-accordion details:last-child {
    border-bottom: none;
}

.country-risk-accordion summary {
    outline: none;
    list-style: none;
    transition: background-color 0.2s ease;
}

.country-risk-accordion summary:hover {
    background-color: #e9ecef !important;
}

.country-risk-accordion summary::-webkit-details-marker {
    display: none;
}

.country-risk-accordion summary::before {
    content: '▶';
    display: inline-block;
    width: 12px;
    margin-right: 8px;
    transition: transform 0.2s ease;
    color: #6c757d;
}

.country-risk-accordion details[open] summary::before {
    transform: rotate(90deg);
}

/* Enhanced Table Styles for NOTAM Phases */
.flight-phases-notams table {
    font-size: 0.9em;
}

.flight-phases-notams tbody tr:hover {
    background-color: #f8f9fa;
}

.flight-phases-notams tbody tr[onclick] {
    cursor: pointer;
}

.flight-phases-notams tbody tr[onclick]:hover td:first-child {
    border-left: 3px solid #007bff;
    padding-left: 9px;
}

/* Flight Phase Accordion Styles */
.flight-phase-section {
    border-bottom: 1px solid #dee2e6;
}

.flight-phase-section:last-child {
    border-bottom: none;
}

.flight-phase-section summary {
    transition: background-color 0.2s ease;
}

.flight-phase-section summary:hover {
    background-color: #e9ecef !important;
}

.flight-phase-section summary::-webkit-details-marker {
    display: none;
}

.flight-phase-section summary::before {
    content: '▶';
    display: inline-block;
    width: 12px;
    margin-right: 8px;
    transition: transform 0.2s ease;
    color: #6c757d;
}

.flight-phase-section[open] summary::before {
    transform: rotate(90deg);
}

/* Key Threats Summary Styling */
.key-threats-summary .threat-item {
    transition: all 0.2s ease;
}

.key-threats-summary .threat-item:hover {
    transform: translateX(3px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

/* Improved Risk Badge Colors */
.risk-badge.low {
    background: linear-gradient(135deg, #28a745, #20c997);
}

.risk-badge.medium {
    background: linear-gradient(135deg, #ffc107, #fd7e14);
}

.risk-badge.high {
    background: linear-gradient(135deg, #dc3545, #e74c3c);
}

.risk-badge.critical {
    background: linear-gradient(135deg, #6f42c1, #e83e8c);
}

/* Responsive design */
@media (max-width: 768px) {
    .modal-content {
        margin: 2% auto;
        max-width: 95%;
        max-height: 95vh;
    }
    
    .briefing-header {
        flex-direction: column;
        text-align: center;
        gap: 15px;
    }
    
    .countries-grid {
        grid-template-columns: 1fr;
    }
    
    .flight-phases-notams table {
        font-size: 0.8em;
    }
    
    .flight-phases-notams th,
    .flight-phases-notams td {
        padding: 6px 8px;
    }
}
