/* ==============================================
   LOADING SCREEN
   ============================================== */
.loading-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #333382 0%, #1a1a2e 100%);
    z-index: 99999;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    opacity: 1;
    transition: opacity 0.8s ease;
}

.loading-screen.fade-out {
    opacity: 0;
    pointer-events: none;
}

.loading-logo {
    max-width: 400px;
    width: 80%;
    height: auto;
    opacity: 0;
    animation: fadeInLogo 2s ease forwards;
    filter: brightness(0) invert(1);
    margin-bottom: 3rem;
}

@keyframes fadeInLogo {
    0% {
        opacity: 0;
        transform: scale(0.8);
    }
    100% {
        opacity: 1;
        transform: scale(1);
    }
}

/* ==============================================
   DEPARTURE BOARD VINTAGE
   ============================================== */
.departure-board {
    opacity: 0;
    animation: fadeIn 1s ease forwards 1.2s;
    margin: 3rem 0;
    max-width: 900px;
    width: 90%;
}

.board-header {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1.5rem;
    margin-bottom: 2rem;
    font-size: 1.5rem;
    font-weight: 700;
    letter-spacing: 0.3em;
    color: var(--white);
}

/* Righe dei voli fittizi */
.board-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.8rem 1.5rem;
    margin: 0.3rem 0;
    background: rgba(26, 26, 26, 0.6);
    border-radius: 4px;
    font-family: 'Courier New', monospace;
    font-size: 0.9rem;
    color: #f0f0f0;
    gap: 1rem;
}

.board-row.blurred {
    filter: blur(1.5px);
    opacity: 0.5;
}

.board-flight {
    font-weight: 700;
    min-width: 70px;
}

.board-destination {
    flex: 1;
    font-weight: 600;
    letter-spacing: 0.1em;
}

.board-time {
    font-weight: 700;
    min-width: 60px;
    text-align: center;
}

.board-gate {
    min-width: 70px;
    text-align: center;
    opacity: 0.8;
}

.board-status {
    min-width: 90px;
    text-align: right;
    font-weight: 700;
    font-size: 0.85rem;
}

.status-ontime {
    color: #4ade80;
}

.status-boarding {
    color: #fbbf24;
}

.status-delayed {
    color: #f87171;
}

.board-icon {
    font-size: 2rem;
    animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 0.6; }
    50% { opacity: 1; }
}

.board-text {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 3px;
    flex-wrap: nowrap;
    padding: 0 1rem;
}

.board-text.main-message {
    margin: 1.2rem 0;
    padding: 1.5rem 2rem;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 8px;
}

/* Nascondi break su desktop */
.mobile-break {
    display: none;
}

.flip-letter {
    width: 26px;
    height: 38px;
    background: linear-gradient(180deg, #2a2a2a 0%, #1a1a1a 50%, #0a0a0a 100%);
    border: 2px solid #3a3a3a;
    border-radius: 3px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.4rem;
    font-weight: 300;
    color: #f0f0f0;
    font-family: 'Courier New', 'Courier', monospace;
    letter-spacing: -0.02em;
    position: relative;
    overflow: hidden;
    box-shadow: 
        0 2px 5px rgba(0, 0, 0, 0.5),
        inset 0 1px 0 rgba(255, 255, 255, 0.1);
    flex-shrink: 0;
}

.flip-letter::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 0;
    right: 0;
    height: 2px;
    background: #0a0a0a;
    z-index: 2;
}

/* Le lettere NON ruotano - solo il contenuto interno cambia */
.flip-letter::after {
    content: attr(data-letter);
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    transform-style: preserve-3d;
}

/* Delay progressivi per ogni lettera - animazione solo su ::after */
.flip-letter:nth-child(1)::after { animation: flipContent 2s ease-in-out 0.1s both; }
.flip-letter:nth-child(2)::after { animation: flipContent 2s ease-in-out 0.15s both; }
.flip-letter:nth-child(3)::after { animation: flipContent 2s ease-in-out 0.2s both; }
.flip-letter:nth-child(5)::after { animation: flipContent 2s ease-in-out 0.3s both; }
.flip-letter:nth-child(6)::after { animation: flipContent 2s ease-in-out 0.35s both; }
.flip-letter:nth-child(7)::after { animation: flipContent 2s ease-in-out 0.4s both; }
.flip-letter:nth-child(8)::after { animation: flipContent 2s ease-in-out 0.45s both; }
.flip-letter:nth-child(9)::after { animation: flipContent 2s ease-in-out 0.5s both; }
.flip-letter:nth-child(10)::after { animation: flipContent 2s ease-in-out 0.55s both; }
.flip-letter:nth-child(12)::after { animation: flipContent 2s ease-in-out 0.65s both; }
.flip-letter:nth-child(14)::after { animation: flipContent 2s ease-in-out 0.75s both; }
.flip-letter:nth-child(15)::after { animation: flipContent 2s ease-in-out 0.8s both; }
.flip-letter:nth-child(16)::after { animation: flipContent 2s ease-in-out 0.85s both; }
.flip-letter:nth-child(17)::after { animation: flipContent 2s ease-in-out 0.9s both; }
.flip-letter:nth-child(18)::after { animation: flipContent 2s ease-in-out 0.95s both; }
.flip-letter:nth-child(19)::after { animation: flipContent 2s ease-in-out 1s both; }
.flip-letter:nth-child(20)::after { animation: flipContent 2s ease-in-out 1.05s both; }
.flip-letter:nth-child(21)::after { animation: flipContent 2s ease-in-out 1.1s both; }

/* Animazione speciale per i puntini finali */
.flip-letter.dots {
    width: 26px;
}

.flip-letter.dots::before {
    display: none;
}

.flip-letter.dots::after {
    display: none;
}

/* Delay diversi per ogni puntino */
.flip-letter.dots:nth-of-type(1) {
    animation: pulseDots 1.5s ease-in-out 1.2s infinite;
}

.flip-letter.dots:nth-of-type(2) {
    animation: pulseDots 1.5s ease-in-out 1.4s infinite;
}

.flip-letter.dots:nth-of-type(3) {
    animation: pulseDots 1.5s ease-in-out 1.6s infinite;
}

@keyframes pulseDots {
    0%, 100% {
        opacity: 0.3;
    }
    50% {
        opacity: 1;
    }
}

/* Animazione: solo il CONTENUTO ruota, non il quadratino */
@keyframes flipContent {
    0% {
        transform: rotateX(0deg);
        opacity: 1;
    }
    8% {
        transform: rotateX(90deg);
        opacity: 0;
    }
    16% {
        transform: rotateX(90deg);
        opacity: 0;
    }
    24% {
        transform: rotateX(0deg);
        opacity: 1;
    }
    33% {
        transform: rotateX(90deg);
        opacity: 0;
    }
    41% {
        transform: rotateX(90deg);
        opacity: 0;
    }
    49% {
        transform: rotateX(0deg);
        opacity: 1;
    }
    58% {
        transform: rotateX(90deg);
        opacity: 0;
    }
    66% {
        transform: rotateX(90deg);
        opacity: 0;
    }
    74%, 100% {
        transform: rotateX(0deg);
        opacity: 1;
    }
}

.flip-letter-space {
    width: 12px;
    height: 38px;
    flex-shrink: 0;
}

.loading-progress {
    position: absolute;
    bottom: 3rem;
    left: 50%;
    transform: translateX(-50%);
    width: 300px;
    height: 40px;
    opacity: 0;
    animation: fadeIn 1s ease forwards 1.5s;
}

@keyframes fadeIn {
    to { opacity: 1; }
}

.flight-path {
    position: relative;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
}

.flight-trail {
    position: absolute;
    top: 50%;
    left: 0;
    width: 100%;
    height: 2px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 2px;
    overflow: hidden;
}

.flight-trail::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 0%;
    height: 100%;
    background: linear-gradient(90deg, 
        transparent 0%, 
        rgba(211, 228, 252, 0.6) 50%, 
        var(--accent) 100%
    );
    animation: flightTrail 2.5s ease-in-out forwards;
    box-shadow: 0 0 10px var(--accent);
}

.flight-icon {
    position: absolute;
    width: 32px;
    height: 32px;
    color: var(--accent);
    filter: drop-shadow(0 0 8px var(--accent));
    z-index: 2;
    animation: flyAcross 2.5s linear forwards;
    transform-origin: center;
    transform: rotate(90deg); /* Ruota per puntare a destra */
}

@keyframes flightTrail {
    0% { width: 0%; }
    100% { width: 100%; }
}

@keyframes flyAcross {
    0% {
        left: -40px;
        transform: rotate(90deg) translateY(-2px);
    }
    20% {
        transform: rotate(90deg) translateY(2px);
    }
    40% {
        transform: rotate(90deg) translateY(-1px);
    }
    60% {
        transform: rotate(90deg) translateY(1px);
    }
    80% {
        transform: rotate(90deg) translateY(-1px);
    }
    100% {
        left: calc(100% + 40px);
        transform: rotate(90deg) translateY(0px);
    }
}