/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    color: #333;
    line-height: 1.6;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px;
}

/* Header Styles */
header {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-radius: 15px;
    padding: 2rem;
    margin-bottom: 2rem;
    box-shadow: 0 8px 32px rgba(31, 38, 135, 0.37);
    border: 1px solid rgba(255, 255, 255, 0.18);
}

.header-content {
    text-align: center;
}

/* Enhanced Header Animations */
.animated-title {
    color: #2c3e50;
    font-size: 2.5rem;
    margin-bottom: 0.5rem;
    font-weight: 700;
    animation: fadeInUp 1s ease-out;
    display: flex;
    align-items: center;
    justify-content: center;
}

.plane-icon {
    color: #3498db;
    margin-right: 1rem;
    animation: flyIn 2s ease-out;
    transform-origin: center;
}

.title-text {
    animation: slideInRight 1s ease-out 0.5s both;
}

.animated-subtitle {
    color: #7f8c8d;
    font-size: 1.2rem;
    font-weight: 500;
    margin-bottom: 1.5rem;
    animation: fadeInUp 1s ease-out 0.8s both;
}

.feature-highlights {
    display: flex;
    justify-content: center;
    gap: 2rem;
    flex-wrap: wrap;
    margin-top: 1rem;
    animation: fadeInUp 1s ease-out 1.2s both;
}

.feature-item {
    color: #5a6c7d;
    font-size: 0.9rem;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    background: rgba(52, 152, 219, 0.1);
    border-radius: 25px;
    border: 1px solid rgba(52, 152, 219, 0.2);
    transition: all 0.3s ease;
}

.feature-item:hover {
    background: rgba(52, 152, 219, 0.2);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(52, 152, 219, 0.3);
}

.feature-item i {
    color: #3498db;
}

/* Keyframe Animations */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes slideInRight {
    from {
        opacity: 0;
        transform: translateX(50px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes flyIn {
    0% {
        opacity: 0;
        transform: translateX(-100px) rotate(-45deg);
    }
    50% {
        opacity: 0.7;
        transform: translateX(10px) rotate(5deg);
    }
    100% {
        opacity: 1;
        transform: translateX(0) rotate(0deg);
    }
}

/* Dashboard Layout */
.dashboard {
    display: grid;
    grid-template-columns: 400px 1fr;
    gap: 2rem;
    margin-bottom: 2rem;
}

/* Flight Form Section */
.flight-form-section {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-radius: 15px;
    padding: 2rem;
    box-shadow: 0 8px 32px rgba(31, 38, 135, 0.37);
    border: 1px solid rgba(255, 255, 255, 0.18);
    height: fit-content;
}

.flight-form-section h2 {
    color: #2c3e50;
    margin-bottom: 1.5rem;
    font-size: 1.4rem;
}

.flight-form-section h2 i {
    color: #27ae60;
    margin-right: 0.5rem;
}

.flight-form {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

.form-group {
    display: flex;
    flex-direction: column;
    position: relative;
}

.form-group label {
    margin-bottom: 0.5rem;
    font-weight: 600;
    color: #34495e;
}

.form-group input,
.form-group select,
.form-group textarea {
    padding: 0.75rem;
    border: 2px solid #e9ecef;
    border-radius: 8px;
    font-size: 1rem;
    transition: border-color 0.3s ease;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: #3498db;
}

.form-group textarea {
    resize: vertical;
    min-height: 80px;
}

/* Airport Dropdown Styles */
.airport-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: white;
    border: 2px solid #3498db;
    border-top: none;
    border-radius: 0 0 8px 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    max-height: 300px;
    overflow-y: auto;
    z-index: 1000;
    animation: slideDown 0.2s ease;
}

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

.airport-option {
    display: flex;
    align-items: center;
    padding: 12px 16px;
    cursor: pointer;
    transition: background-color 0.2s ease;
    border-bottom: 1px solid #f1f3f4;
}

.airport-option:last-child {
    border-bottom: none;
}

.airport-option:hover,
.airport-option.highlighted {
    background-color: #f8f9fa;
}

.airport-code {
    font-family: 'Courier New', monospace;
    font-weight: bold;
    color: #2c3e50;
    font-size: 1rem;
    margin-right: 16px;
    min-width: 50px;
}

.airport-details {
    flex: 1;
}

.airport-name {
    font-weight: 600;
    color: #34495e;
    font-size: 0.95rem;
    margin-bottom: 2px;
}

.airport-city {
    color: #7f8c8d;
    font-size: 0.85rem;
}

/* Main Content Area */
.main-content {
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

/* Statistics Section */
.stats-section {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-radius: 15px;
    padding: 1.5rem;
    box-shadow: 0 8px 32px rgba(31, 38, 135, 0.37);
    border: 1px solid rgba(255, 255, 255, 0.18);
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
}

.stat-card {
    display: flex;
    align-items: center;
    padding: 1rem;
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    border-radius: 10px;
    border: 1px solid #dee2e6;
}

.stat-icon {
    width: 50px;
    height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    margin-right: 1rem;
}

.stat-card:nth-child(1) .stat-icon {
    background: linear-gradient(135deg, #3498db, #2980b9);
    color: white;
}

.stat-card:nth-child(2) .stat-icon {
    background: linear-gradient(135deg, #27ae60, #229954);
    color: white;
}

.stat-card:nth-child(3) .stat-icon {
    background: linear-gradient(135deg, #e74c3c, #c0392b);
    color: white;
}

.stat-content h3 {
    font-size: 1.8rem;
    font-weight: 700;
    color: #2c3e50;
    margin-bottom: 0.2rem;
}

.stat-content p {
    color: #7f8c8d;
    font-size: 0.9rem;
}

/* Map Section */
.map-section {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-radius: 15px;
    padding: 1.5rem;
    box-shadow: 0 8px 32px rgba(31, 38, 135, 0.37);
    border: 1px solid rgba(255, 255, 255, 0.18);
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.section-header h2 {
    color: #2c3e50;
    font-size: 1.4rem;
}

.section-header h2 i {
    color: #3498db;
    margin-right: 0.5rem;
}

.map-controls {
    display: flex;
    gap: 0.5rem;
}

.map-container {
    height: 400px;
    border-radius: 10px;
    overflow: hidden;
    border: 2px solid #e9ecef;
}

/* Flight Log Section */
.flight-log-section {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-radius: 15px;
    padding: 2rem;
    box-shadow: 0 8px 32px rgba(31, 38, 135, 0.37);
    border: 1px solid rgba(255, 255, 255, 0.18);
}

.log-controls {
    display: flex;
    gap: 0.5rem;
}

/* Filters */
.filters {
    display: flex;
    gap: 1rem;
    margin-bottom: 1.5rem;
    padding: 1rem;
    background: #f8f9fa;
    border-radius: 10px;
    border: 1px solid #dee2e6;
    flex-wrap: wrap;
    align-items: end;
}

.filter-group {
    display: flex;
    flex-direction: column;
    min-width: 150px;
}

.filter-group label {
    margin-bottom: 0.5rem;
    font-weight: 600;
    color: #34495e;
    font-size: 0.9rem;
}

.filter-group input,
.filter-group select {
    padding: 0.5rem;
    border: 1px solid #dee2e6;
    border-radius: 5px;
    font-size: 0.9rem;
}

/* Table Styles */
.table-container {
    overflow-x: auto;
    border-radius: 10px;
    border: 1px solid #dee2e6;
}

/* Enhanced Interactive Table */
.interactive-table {
    width: 100%;
    border-collapse: collapse;
    background: white;
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
}

.interactive-table th,
.interactive-table td {
    padding: 1rem;
    text-align: left;
    border-bottom: 1px solid #dee2e6;
}

.interactive-table th {
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    font-weight: 600;
    color: #2c3e50;
    position: sticky;
    top: 0;
    z-index: 10;
}

.interactive-table th.sortable {
    cursor: pointer;
    user-select: none;
    transition: background-color 0.2s ease;
}

.interactive-table th.sortable:hover {
    background: linear-gradient(135deg, #e9ecef 0%, #dee2e6 100%);
}

.sort-icon {
    margin-left: 0.5rem;
    opacity: 0.5;
    transition: all 0.2s ease;
}

.sort-icon.active {
    opacity: 1;
    color: #3498db;
}

.flight-row {
    transition: all 0.2s ease;
    cursor: pointer;
}

.flight-row:hover {
    background: linear-gradient(135deg, #f8f9fa 0%, #e3f2fd 100%);
    transform: translateX(2px);
}

.flight-row.highlighted {
    background: linear-gradient(135deg, #e3f2fd 0%, #bbdefb 100%);
    border-left: 4px solid #3498db;
    transform: translateX(4px);
    box-shadow: 0 2px 8px rgba(52, 152, 219, 0.2);
}

.interactive-table tbody tr:last-child td {
    border-bottom: none;
}

.route-cell {
    font-family: 'Courier New', monospace;
}

.route-info {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.airport-code {
    font-weight: 600;
    color: #2c3e50;
    background: rgba(52, 152, 219, 0.1);
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
    font-size: 0.9rem;
}

.route-arrow {
    color: #3498db;
    font-size: 0.8rem;
}

.flight-type-badge {
    display: inline-block;
    padding: 0.3rem 0.8rem;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.flight-type-badge.training {
    background: linear-gradient(135deg, #f39c12, #e67e22);
    color: white;
}

.flight-type-badge.commercial {
    background: linear-gradient(135deg, #3498db, #2980b9);
    color: white;
}

.flight-type-badge.personal {
    background: linear-gradient(135deg, #27ae60, #229954);
    color: white;
}

.flight-type-badge.cross-country {
    background: linear-gradient(135deg, #e74c3c, #c0392b);
    color: white;
}

.duration-value {
    font-weight: 600;
    color: #2c3e50;
    background: rgba(46, 204, 113, 0.1);
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
    font-family: 'Courier New', monospace;
}

.notes-cell {
    max-width: 200px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: #7f8c8d;
    font-style: italic;
}

/* Button Styles */
.btn-primary,
.btn-secondary,
.btn-danger {
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    text-decoration: none;
}

.btn-primary {
    background: linear-gradient(135deg, #3498db, #2980b9);
    color: white;
}

.btn-primary:hover {
    background: linear-gradient(135deg, #2980b9, #1f5f8b);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(52, 152, 219, 0.4);
}

.btn-secondary {
    background: linear-gradient(135deg, #95a5a6, #7f8c8d);
    color: white;
}

.btn-secondary:hover {
    background: linear-gradient(135deg, #7f8c8d, #6c7b7d);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(149, 165, 166, 0.4);
}

.btn-danger {
    background: linear-gradient(135deg, #e74c3c, #c0392b);
    color: white;
}

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

.btn-info {
    background: linear-gradient(135deg, #17a2b8, #138496);
    color: white;
}

.btn-info:hover {
    background: linear-gradient(135deg, #138496, #117a8b);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(23, 162, 184, 0.4);
}

.btn-small {
    padding: 0.5rem 1rem;
    font-size: 0.9rem;
}

/* Action Buttons */
.action-buttons {
    display: flex;
    gap: 0.5rem;
}

/* Modal Styles */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(5px);
}

.modal-content {
    background: white;
    margin: 5% auto;
    padding: 2rem;
    border-radius: 15px;
    width: 90%;
    max-width: 600px;
    position: relative;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

.close {
    color: #aaa;
    float: right;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    position: absolute;
    right: 1rem;
    top: 1rem;
}

.close:hover {
    color: #000;
}

/* Empty State (removed duplicate - keeping the enhanced version below) */

/* Loading State */
.loading {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 2rem;
}

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

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

/* Empty State Enhancement */
.empty-state {
    text-align: center;
    padding: 3rem 2rem;
    color: #7f8c8d;
}

.empty-state i {
    font-size: 3rem;
    color: #bdc3c7;
    margin-bottom: 1rem;
    display: block;
}

.empty-state p {
    font-size: 1.1rem;
    margin: 0;
}

/* Message styles enhancement */
.message.info {
    background: #d1ecf1;
    color: #0c5460;
    border: 1px solid #bee5eb;
    border-radius: 8px;
    padding: 1rem;
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.message.info::before {
    content: '\f05a';
    font-family: 'Font Awesome 5 Free';
    font-weight: 900;
    color: #17a2b8;
}

/* Responsive Design */
@media (max-width: 1200px) {
    .dashboard {
        grid-template-columns: 350px 1fr;
    }
}

@media (max-width: 992px) {
    .dashboard {
        grid-template-columns: 1fr;
    }
    
    .stats-grid {
        grid-template-columns: repeat(3, 1fr);
    }
    
    .filters {
        flex-direction: column;
        align-items: stretch;
    }
    
    .filter-group {
        min-width: auto;
    }
}

@media (max-width: 768px) {
    .container {
        padding: 1rem;
    }
    
    header {
        padding: 1.5rem;
    }
    
    .animated-title {
        font-size: 2rem;
        flex-direction: column;
        text-align: center;
    }
    
    .feature-highlights {
        flex-direction: column;
        gap: 1rem;
    }
    
    .feature-item {
        justify-content: center;
    }
    
    .form-row {
        grid-template-columns: 1fr;
    }
    
    .stats-grid {
        grid-template-columns: 1fr;
    }
    
    .section-header {
        flex-direction: column;
        gap: 1rem;
        align-items: stretch;
    }
    
    .map-controls,
    .log-controls {
        display: flex;
        gap: 0.5rem;
        justify-content: center;
    }
    
    .map-container {
        height: 300px;
    }
    
    .action-buttons {
        flex-direction: column;
    }
    
    .modal-content {
        width: 95%;
        margin: 10% auto;
        padding: 1.5rem;
    }
    
    .interactive-table {
        font-size: 0.9rem;
    }
    
    .interactive-table th,
    .interactive-table td {
        padding: 0.75rem 0.5rem;
    }
    
    .airport-dropdown {
        max-height: 200px;
    }
    
    .footer-content {
        grid-template-columns: 1fr;
        text-align: center;
    }
}

@media (max-width: 480px) {
    .flight-form-section,
    .flight-log-section {
        padding: 1.5rem;
    }
    
    .animated-title {
        font-size: 1.5rem;
    }
    
    .animated-subtitle {
        font-size: 1rem;
    }
    
    .btn-primary,
    .btn-secondary,
    .btn-danger,
    .btn-info {
        padding: 0.75rem 1rem;
        font-size: 0.9rem;
    }
    
    .route-info {
        flex-direction: column;
        gap: 0.2rem;
        align-items: flex-start;
    }
    
    .airport-code {
        font-size: 0.8rem;
    }
    
    .flight-type-badge {
        font-size: 0.7rem;
        padding: 0.2rem 0.6rem;
    }
}

/* Custom Leaflet Popup Styles */
.leaflet-popup-content-wrapper {
    border-radius: 10px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.leaflet-popup-content {
    margin: 15px;
    line-height: 1.4;
}

.popup-route {
    font-weight: bold;
    color: #2c3e50;
    margin-bottom: 5px;
}

.popup-details {
    font-size: 0.9rem;
    color: #7f8c8d;
}

/* Flight path styles */
.flight-path {
    stroke-width: 3;
    stroke-opacity: 0.8;
    stroke-dasharray: 5,10;
    animation: dash 20s linear infinite;
}

@keyframes dash {
    to {
        stroke-dashoffset: -35;
    }
}

/* Success/Error Messages */
.message {
    padding: 1rem;
    border-radius: 8px;
    margin: 1rem 0;
    position: relative;
}

.message.success {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.message.error {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

.message.warning {
    background: #fff3cd;
    color: #856404;
    border: 1px solid #ffeaa7;
}

/* Footer Styles */
.footer {
    background: linear-gradient(135deg, #2c3e50 0%, #34495e 100%);
    color: white;
    margin-top: 4rem;
    padding: 3rem 0 1rem 0;
    border-radius: 15px;
    box-shadow: 0 -5px 20px rgba(0, 0, 0, 0.1);
}

.footer-content {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 2rem;
    margin-bottom: 2rem;
    padding: 0 2rem;
}

.footer-section h3 {
    color: #3498db;
    margin-bottom: 1rem;
    font-size: 1.4rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.footer-section h4 {
    color: #ecf0f1;
    margin-bottom: 1rem;
    font-size: 1.1rem;
    border-bottom: 2px solid #3498db;
    padding-bottom: 0.5rem;
}

.footer-section p {
    color: #bdc3c7;
    line-height: 1.6;
    margin-bottom: 1rem;
}

.footer-section ul {
    list-style: none;
    padding: 0;
}

.footer-section ul li {
    color: #bdc3c7;
    margin-bottom: 0.5rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    transition: color 0.3s ease;
}

.footer-section ul li:hover {
    color: #3498db;
}

.footer-section ul li i {
    color: #27ae60;
    width: 16px;
}

.footer-bottom {
    text-align: center;
    padding: 1rem 2rem;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    color: #95a5a6;
    font-size: 0.9rem;
}