/* Reset et styles de base */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: var(--font-family-secondary);
    background: var(--color-background);
    padding: 0;
    min-height: 100vh;
    color: var(--color-text-primary);
    position: relative;
    overflow: hidden;
}

/* Fond animé avec lumières vertes */
body::before {
    content: '';
    position: fixed;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background:
        radial-gradient(circle at 20% 50%, rgba(2, 70, 58, 0.288) 0%, transparent 35%),
        radial-gradient(circle at 80% 80%, rgba(2, 70, 57, 0.227) 0%, transparent 30%),
        radial-gradient(circle at 40% 20%, rgba(2, 70, 57, 0.344) 0%, transparent 25%);
    animation: lightMovement 20s ease-in-out infinite;
    z-index: var(--z-index-background);
}

body::after {
    content: '';
    position: fixed;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background:
        radial-gradient(circle at 60% 70%, rgba(2, 70, 56, 0.1) 0%, transparent 30%),
        radial-gradient(circle at 90% 30%, rgba(2, 70, 56, 0.07) 0%, transparent 28%);
    animation: lightMovement2 25s ease-in-out infinite;
    z-index: var(--z-index-background);
}

@keyframes lightMovement {
    0%, 100% {
        transform: translate(0, 0);
        opacity: 1;
    }
    25% {
        transform: translate(3%, -3%);
        opacity: 0.9;
    }
    50% {
        transform: translate(-2%, 4%);
        opacity: 1;
    }
    75% {
        transform: translate(-3%, -2%);
        opacity: 0.95;
    }
}

@keyframes lightMovement2 {
    0%, 100% {
        transform: translate(0, 0);
        opacity: 0.9;
    }
    33% {
        transform: translate(-4%, 3%);
        opacity: 1;
    }
    66% {
        transform: translate(3%, -3%);
        opacity: 0.85;
    }
}

/* Header toujours visible */
header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    padding: var(--header-padding);
    border-bottom: var(--border-width) solid var(--border-color-primary);
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--color-background);
    z-index: var(--z-index-header);
}

/* Container principal */
.container {
    max-width: 100%;
    margin: 0 auto;
    height: 100vh;
    padding-top: var(--header-height); /* Espace pour le header fixe */
    display: flex;
    flex-direction: column;
    position: relative;
    z-index: var(--z-index-content);
}

/* Widget météo/heure */
.weather-widget {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: var(--gap-weather);
}

.weather-widget #currentTime,
.weather-widget #temperature {
    color: var(--color-primary);
    font-size: var(--font-size-time);
    font-weight: 500;
    letter-spacing: var(--letter-spacing-wide);
    font-family: var(--font-family-primary);
}

.weather-widget .separator {
    color: var(--color-primary-dark);
    font-size: var(--font-size-separator);
    font-weight: 300;
}

.weather-widget .condition {
    font-size: var(--font-size-condition);
    font-weight: 300;
    font-style: italic;
    color: var(--color-text-secondary);
    letter-spacing: var(--letter-spacing-normal);
}

.logo-container {
    width: var(--logo-width);
    height: auto;
    opacity: 0;
    animation: logoFadeIn var(--animation-duration-slow) ease forwards;
    animation-delay: var(--animation-delay-logo);
}

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

.logo-container img {
    width: 100%;
    height: auto;
    filter: brightness(1.1);
}

h1 {
    color: var(--color-primary);
    font-size: var(--font-size-title-main);
    font-weight: 300;
    letter-spacing: var(--letter-spacing-wider);
    text-transform: uppercase;
    margin: 0;
}

.subtitle {
    color: var(--color-text-tertiary);
    font-size: var(--font-size-subtitle);
    font-weight: 300;
    letter-spacing: var(--letter-spacing-normal);
    margin: 0;
}

.update-time {
    color: var(--color-text-dim);
    font-weight: 300;
    font-size: 0.7em;
    letter-spacing: var(--letter-spacing-tight);
    text-align: right;
}

/* Loading */
.loading {
    text-align: center;
    padding: 50px;
    color: white;
    font-size: 1.5em;
}

.spinner {
    border: var(--border-width-thick) solid var(--border-color-card);
    border-top: var(--border-width-thick) solid var(--color-primary);
    width: 40px;
    height: 40px;
    animation: spin var(--animation-duration-slow) linear infinite;
    margin: 20px auto;
}

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

/* Conteneur des véhicules */
.vehicles-container {
    flex: 1;
    overflow-y: auto;
    padding: 0;
    max-height: calc(100vh - 200px); /* Hauteur viewport moins header et footer approximatifs */
}

.arrivals-title {
    color: var(--color-primary);
    font-size: var(--font-size-arrivals-title);
    font-weight: 400;
    text-align: center;
    text-transform: uppercase;
    letter-spacing: var(--letter-spacing-widest);
    padding: var(--arrivals-title-padding);
    margin: 0;
    font-family: var(--font-family-primary);
}

.vehicles-grid {
    display: flex;
    flex-direction: column;
    gap: 0;
}

/* Cartes de véhicules */
.vehicle-card {
    border: var(--border-width) solid var(--border-color-secondary);
    border-bottom: var(--border-width) solid var(--border-color-primary);
    padding: var(--card-padding);
    transition: all var(--animation-duration-fast) ease;
    position: relative;
    overflow: hidden;
    box-shadow: var(--shadow-card);
}

.vehicle-card::after {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 10px;
    background: var(--status-color);
    transition: width var(--animation-duration-fast) ease;
}

.vehicle-card:hover::after {
    width: 12px;
}

.vehicle-card.coming-soon {
    --status-color: var(--color-error);
}

.vehicle-card.coming-soon::after {
    animation: pulseBlink 3s ease-in-out infinite;
}

@keyframes pulseBlink {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.4;
    }
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes slideInFromLeft {
    from {
        opacity: 0;
        transform: translateX(-100%);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes slideOutToRight {
    from {
        opacity: 1;
        transform: translateX(0);
    }
    to {
        opacity: 0;
        transform: translateX(100%);
    }
}

.vehicle-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-bottom: 20px;
    border-bottom: var(--border-width) solid var(--border-color-card);
}

.vehicle-name {
    color: var(--color-text-primary);
    font-size: var(--font-size-vehicle-main);
    font-weight: 500;
    text-align: left;
    text-transform: uppercase;
    letter-spacing: var(--letter-spacing-wider);
    font-family: var(--font-family-primary);
    display: flex;
    flex-direction: column;
    gap: 5px;
    flex: 1;
    min-width: 0;
    margin-right: 40px;
}

.vehicle-main {
    font-weight: 700;
    color: var(--color-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.vehicle-specs {
    font-weight: 200;
    font-size: var(--font-size-vehicle-specs);
    color: rgba(255, 255, 255, 0.9);
    letter-spacing: var(--letter-spacing-wide);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.vehicle-info-bar {
    display: flex;
    justify-content: flex-start;
    align-items: center;
    gap: 40px;
}

.info-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    width: 150px;
}

.info-label {
    color: var(--color-text-muted);
    font-size: var(--font-size-info-label);
    font-weight: 400;
    text-transform: uppercase;
    letter-spacing: var(--letter-spacing-medium);
    text-align: center;
}

.info-value {
    color: var(--color-text-primary);
    font-weight: 400;
    font-size: var(--font-size-info-value);
    letter-spacing: var(--letter-spacing-tight);
}

.price-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    width: 120px;
}

.price-label {
    color: var(--color-text-muted);
    font-size: var(--font-size-info-label);
    font-weight: 400;
    text-transform: uppercase;
    letter-spacing: var(--letter-spacing-medium);
}

.price-value {
    color: var(--color-primary);
    font-weight: 500;
    font-size: var(--font-size-price);
    letter-spacing: var(--letter-spacing-normal);
}

/* Messages */
.no-vehicles {
    text-align: center;
    padding: 80px 40px;
    background: var(--color-background-card);
}

.no-vehicles h2 {
    color: var(--color-primary);
    font-size: 1.3em;
    margin-bottom: 15px;
    text-transform: uppercase;
    font-weight: 300;
    letter-spacing: var(--letter-spacing-wide);
}

.no-vehicles p {
    color: var(--color-text-tertiary);
    font-size: 0.9em;
    letter-spacing: var(--letter-spacing-tight);
}

.error {
    background: var(--color-error-bg);
    color: #ff6b6b;
    padding: 20px;
    margin: 20px;
    text-align: center;
    border: var(--border-width) solid rgba(255, 0, 0, 0.3);
}

/* Scrollbar personnalisée */
.vehicles-container::-webkit-scrollbar {
    width: var(--scrollbar-width);
}

.vehicles-container::-webkit-scrollbar-track {
    background: var(--color-background);
}

.vehicles-container::-webkit-scrollbar-thumb {
    background: var(--scrollbar-thumb-color);
}

.vehicles-container::-webkit-scrollbar-thumb:hover {
    background: var(--scrollbar-thumb-hover-color);
}

/* Lecteur vidéo plein écran */
.video-container {
    position: fixed;
    top: var(--header-height); /* Commence après le header */
    left: 0;
    width: 100%;
    height: calc(100vh - var(--header-height)); /* Hauteur viewport moins le header */
    z-index: var(--z-index-video);
    background: var(--color-background);
    display: none;
    opacity: 0;
    transition: opacity var(--animation-duration-normal) ease;
}

.video-container.active {
    display: flex;
    align-items: center;
    justify-content: center;
}

.video-container.visible {
    opacity: 1;
}

.video-container video {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

/* Animations de transition */
.container.fade-out {
    animation: fadeOut var(--animation-duration-normal) ease forwards;
}

.container.fade-in {
    animation: fadeIn var(--animation-duration-normal) ease forwards;
}

@keyframes fadeOut {
    from {
        opacity: 1;
    }
    to {
        opacity: 0;
    }
}

/* Écran de transition QR Code */
.qr-transition {
    position: fixed;
    top: var(--header-height); /* Commence après le header */
    left: 0;
    width: 100%;
    height: calc(100% - var(--header-height)); /* Hauteur moins le header */
    z-index: var(--z-index-qr);
    background: transparent;
    display: none;
    opacity: 0;
    transition: opacity var(--animation-duration-normal) ease;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 40px;
}

.qr-transition.active {
    display: flex;
}

.qr-transition.visible {
    opacity: 1;
}

.qr-transition-title {
    color: var(--color-primary);
    font-size: var(--font-size-qr-title);
    font-weight: 700;
    text-align: center;
    text-transform: uppercase;
    letter-spacing: var(--letter-spacing-widest);
    font-family: var(--font-family-primary);
    animation: pulse 2s ease-in-out infinite;
}

.qr-transition-subtitle {
    color: rgba(255, 255, 255, 0.8);
    font-size: var(--font-size-qr-subtitle);
    font-weight: 300;
    text-align: center;
    letter-spacing: var(--letter-spacing-wide);
    margin-top: -20px;
}

.qr-code-container {
    background: rgba(206, 189, 132, 0.1);
    padding: 30px;
    border-radius: var(--border-radius);
    border: var(--border-width-thick) solid var(--color-primary);
    box-shadow: var(--shadow-qr);
    animation: qrGlow 3s ease-in-out infinite;
}

#qrcode {
    display: flex;
    justify-content: center;
    align-items: center;
}

.qr-transition-url {
    color: var(--color-primary);
    font-size: var(--font-size-qr-url);
    font-weight: 500;
    letter-spacing: var(--letter-spacing-wider);
    text-align: center;
}

@keyframes pulse {
    0%, 100% {
        transform: scale(1);
        opacity: 1;
    }
    50% {
        transform: scale(1.05);
        opacity: 0.9;
    }
}

@keyframes qrGlow {
    0%, 100% {
        box-shadow: var(--shadow-qr);
    }
    50% {
        box-shadow: var(--shadow-qr-glow);
    }
}

/* Footer */
footer {
    padding: 20px;
    border-top: var(--border-width) solid var(--border-color-primary);
    text-align: center;
    position: relative;
}

.update-time-footer {
    position: absolute;
    top: 10px;
    right: 20px;
    color: rgba(255, 255, 255, 0.3);
    font-size: 0.65em;
    font-weight: 300;
    letter-spacing: var(--letter-spacing-tight);
}

.footer-text {
    color: var(--color-text-tertiary);
    font-size: 0.85em;
    font-weight: 300;
    letter-spacing: var(--letter-spacing-normal);
}

.footer-url {
    color: var(--color-primary);
    font-weight: 400;
    letter-spacing: var(--letter-spacing-medium);
    text-decoration: none;
}

.footer-url:hover {
    color: var(--color-text-primary);
}

/* Responsive */
@media (max-width: 968px) {
    header {
        flex-direction: column-reverse;
        gap: var(--gap-header-mobile);
        text-align: center;
        padding: var(--header-padding-mobile);
    }

    .container {
        padding-top: var(--header-height-mobile); /* Ajusté pour le nouveau header plus compact */
    }

    .video-container {
        top: var(--header-height-mobile);
        height: calc(100vh - var(--header-height-mobile));
    }

    .qr-transition {
        top: var(--header-height-mobile);
        height: calc(100% - var(--header-height-mobile));
    }

    .weather-widget {
        gap: var(--gap-weather-mobile);
    }

    .weather-widget #currentTime,
    .weather-widget #temperature {
        font-size: var(--font-size-time-mobile);
    }

    .weather-widget .separator {
        font-size: var(--font-size-separator-mobile);
    }

    .weather-widget .condition {
        font-size: var(--font-size-condition-mobile);
    }

    .logo-container {
        width: var(--logo-width-mobile);
    }

    .arrivals-title {
        font-size: var(--font-size-arrivals-title-mobile);
        letter-spacing: var(--letter-spacing-wide);
        padding: var(--arrivals-title-padding-mobile);
    }

    .vehicle-card {
        padding: var(--card-padding-mobile);
    }

    .vehicle-header {
        flex-direction: column;
        gap: 20px;
        align-items: flex-start;
    }

    .vehicle-name {
        font-size: var(--font-size-vehicle-main-mobile);
        margin-right: 20px;
    }

    .vehicle-info-bar {
        gap: 20px;
    }

    .info-value {
        font-size: var(--font-size-info-value-mobile);
    }

    .price-value {
        font-size: var(--font-size-price-mobile);
    }
}
