/**
 * Balloon Flight Manager - Frontend Styles
 * File: assets/css/style.css
 */

/* ============================================
   Variables
   ============================================ */
:root {
    --bfm-primary: #FF5722;
    --bfm-primary-dark: #E64A19;
    --bfm-secondary: #2196F3;
    --bfm-success: #4CAF50;
    --bfm-warning: #FFC107;
    --bfm-danger: #F44336;
    --bfm-light: #F5F5F5;
    --bfm-dark: #333;
    --bfm-border: #DDD;
    --bfm-radius: 8px;
    --bfm-shadow: 0 2px 4px rgba(0,0,0,0.1);
    --bfm-shadow-hover: 0 4px 8px rgba(0,0,0,0.15);
}

/* ============================================
   Flight Cards
   ============================================ */
.bfm-flight-card {
    background: #fff;
    border: 1px solid var(--bfm-border);
    border-radius: var(--bfm-radius);
    padding: 20px;
    margin-bottom: 20px;
    box-shadow: var(--bfm-shadow);
    transition: all 0.3s ease;
}

.bfm-flight-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--bfm-shadow-hover);
}

.bfm-flight-card h3 {
    color: var(--bfm-primary);
    margin-top: 0;
    padding-bottom: 10px;
    border-bottom: 2px solid var(--bfm-primary);
    font-size: 1.3em;
}

.bfm-flight-details p {
    margin: 8px 0;
    line-height: 1.6;
}

.bfm-flight-details strong {
    color: var(--bfm-dark);
    font-weight: 600;
}

/* ============================================
   Live Tracking
   ============================================ */
.bfm-live-tracking {
    margin: 20px 0;
}

.bfm-live-tracking h2 {
    color: var(--bfm-primary);
    font-size: 2em;
    margin-bottom: 20px;
    text-align: center;
}

#live-map {
    border: 1px solid var(--bfm-border);
    border-radius: var(--bfm-radius);
    box-shadow: var(--bfm-shadow);
}

#active-flights-info {
    margin-top: 30px;
}

#active-flights-info h3 {
    color: var(--bfm-dark);
    font-size: 1.5em;
    margin-bottom: 15px;
}

.flight-card {
    border: 1px solid var(--bfm-border);
    padding: 15px;
    margin: 10px 0;
    border-radius: var(--bfm-radius);
    background: #fff;
    transition: all 0.3s ease;
    cursor: pointer;
}

.flight-card:hover {
    background-color: var(--bfm-light);
    transform: translateY(-2px);
    box-shadow: var(--bfm-shadow-hover);
}

.flight-card h4 {
    color: var(--bfm-primary);
    margin-top: 0;
    margin-bottom: 10px;
    font-size: 1.2em;
}

.flight-card p {
    margin: 5px 0;
}

/* ============================================
   Balloon Marker Animation
   ============================================ */
.balloon-marker {
    font-size: 32px;
    animation: float 3s ease-in-out infinite;
    cursor: pointer;
}

@keyframes float {
    0%, 100% {
        transform: translateY(0px);
    }
    50% {
        transform: translateY(-10px);
    }
}

.custom-balloon-icon {
    background: transparent !important;
    border: none !important;
}

/* ============================================
   Flight Popup
   ============================================ */
.flight-popup h4 {
    margin: 0 0 10px 0;
    color: var(--bfm-primary);
    font-size: 1.1em;
}

.flight-popup p {
    margin: 5px 0;
}

.flight-popup strong {
    font-weight: 600;
}

.flight-popup hr {
    border: none;
    border-top: 1px solid var(--bfm-border);
    margin: 10px 0;
}

/* ============================================
   My Flights History
   ============================================ */
.bfm-my-flights {
    margin: 20px 0;
}

.bfm-my-flights h2 {
    color: var(--bfm-primary);
    font-size: 2em;
    margin-bottom: 20px;
}

.bfm-my-flights h3 {
    color: var(--bfm-dark);
    font-size: 1.3em;
    margin: 20px 0 10px;
}

.filters {
    background: var(--bfm-light);
    padding: 20px;
    border-radius: var(--bfm-radius);
    margin: 20px 0;
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.filters label {
    font-weight: 600;
    color: var(--bfm-dark);
}

.filters input[type="date"] {
    padding: 8px 12px;
    border: 1px solid var(--bfm-border);
    border-radius: 4px;
    font-size: 14px;
}

.filters .button {
    padding: 8px 16px;
    background: var(--bfm-primary);
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    transition: background 0.3s ease;
}

.filters .button:hover {
    background: var(--bfm-primary-dark);
}

.filters .button-primary {
    background: var(--bfm-secondary);
}

.filters .button-primary:hover {
    background: #1976D2;
}

/* ============================================
   Maps
   ============================================ */
#flights-map,
#live-map,
#flights-overview-map {
    height: 500px;
    width: 100%;
    margin: 20px 0;
    border-radius: var(--bfm-radius);
    box-shadow: var(--bfm-shadow);
    overflow: hidden;
}

/* ============================================
   Tables
   ============================================ */
.wp-list-table {
    background: white;
    border: 1px solid var(--bfm-border);
    border-radius: var(--bfm-radius);
    overflow: hidden;
}

.wp-list-table th {
    background: var(--bfm-light);
    font-weight: 600;
    padding: 12px;
    text-align: left;
}

.wp-list-table td {
    padding: 12px;
    border-top: 1px solid var(--bfm-border);
}

.wp-list-table tr:hover {
    background: #FAFAFA;
}

/* ============================================
   Buttons
   ============================================ */
.button,
.view-map-btn {
    display: inline-block;
    padding: 8px 16px;
    background: var(--bfm-primary);
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    text-decoration: none;
    font-size: 14px;
    transition: all 0.3s ease;
}

.button:hover,
.view-map-btn:hover {
    background: var(--bfm-primary-dark);
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

.button-small {
    padding: 6px 12px;
    font-size: 12px;
}

/* ============================================
   Status Badges
   ============================================ */
.status-badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
}

.status-in-flight {
    background: #FFF3CD;
    color: #856404;
}

.status-completed {
    background: #D4EDDA;
    color: #155724;
}

.status-scheduled {
    background: #D1ECF1;
    color: #0C5460;
}

.status-cancelled {
    background: #F8D7DA;
    color: #721C24;
}

/* ============================================
   Empty States
   ============================================ */
.empty-state {
    background: var(--bfm-light);
    padding: 40px 20px;
    text-align: center;
    border-radius: var(--bfm-radius);
    border: 2px dashed var(--bfm-border);
}

.empty-state p {
    margin: 0;
    color: #666;
    font-size: 16px;
}

/* ============================================
   Loading States
   ============================================ */
.loading {
    text-align: center;
    padding: 40px;
    color: #666;
}

.loading::after {
    content: '...';
    animation: dots 1.5s steps(4, end) infinite;
}

@keyframes dots {
    0%, 20% {
        content: '.';
    }
    40% {
        content: '..';
    }
    60%, 100% {
        content: '...';
    }
}

/* ============================================
   Responsive
   ============================================ */
@media (max-width: 768px) {
    .bfm-flight-card {
        padding: 15px;
    }
    
    .filters {
        flex-direction: column;
        align-items: stretch;
    }
    
    .filters input,
    .filters .button {
        width: 100%;
    }
    
    #live-map,
    #flights-map,
    #flights-overview-map {
        height: 400px;
    }
    
    .wp-list-table {
        font-size: 14px;
    }
    
    .wp-list-table th,
    .wp-list-table td {
        padding: 8px;
    }
}

@media (max-width: 480px) {
    .bfm-live-tracking h2,
    .bfm-my-flights h2 {
        font-size: 1.5em;
    }
    
    #live-map,
    #flights-map,
    #flights-overview-map {
        height: 300px;
    }
}

/* ============================================
   Leaflet Custom Styles
   ============================================ */
.leaflet-popup-content-wrapper {
    border-radius: var(--bfm-radius);
}

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

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

/* Focus visible per accessibilità */
.button:focus-visible,
.flight-card:focus-visible {
    outline: 2px solid var(--bfm-primary);
    outline-offset: 2px;
}