/* Variables pour le thème clair */
:root[data-theme="light"] {
    --text-color: #000000;
    --bg-color: #ffffff;
    --card-bg: #f0f0f0;
    --card-hover: #e5e5e5;
    --line-number-bg: #FFD700;
    --error-color: #ff4444;
    --header-color: #000000;
    --scrollbar-bg: #e0e0e0;
    --scrollbar-thumb: #999999;
    --scrollbar-thumb-hover: #666666;

    --footer: #f0f0f0;
}

/* Variables pour le thème sombre */
:root[data-theme="dark"] {
    --text-color: #ffffff;
    --bg-color: #000000;
    --card-bg: #1a1a1a;
    --card-hover: #252525;
    --line-number-bg: #FFD700;
    --error-color: #ff4444;
    --header-color: #ffffff;
    --scrollbar-bg: #1a1a1a;
    --scrollbar-thumb: #333333;
    --scrollbar-thumb-hover: #444444;

    --footer: #1a1a1a;
}

/* Styles de base */
body {
    background: var(--bg-color);
    color: var(--text-color);
    margin: 0;
    padding: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    display: flex;
    flex-direction: column;
    height: 100vh;
    overflow: hidden;
}

/* Container principal */
main {
    flex: 1;
    padding: 0 20px;
    overflow-y: auto;
}

/* Header */
.header {
    padding: 10px 20px;
    background-color: var(--bg-color);
    height: 120px;
    display: flex;
    align-items: center;
}

/* Barre de défilement */
::-webkit-scrollbar {
    width: 0;
    display: none;
}

/* Firefox scrollbar */
* {
    scrollbar-width: none;
    -ms-overflow-style: none;
}

/* En-tête */
h1 {
    font-size: 5rem;
    margin: 0 0 1rem;
    color: var(--header-color);
}

.clock {
    font-size: 6rem;
    font-weight: bold;
    margin: 1rem 0 2rem;
    color: var(--header-color);
}

/* Line indicator */
.line-indicator {
    background: #333333;  /* Gris clair */
    color: #ffffff;   /* Gris foncé pour le texte */
    padding: 0.5rem 2rem;
    border-radius: 2rem;
    font-size: 2rem;
    font-weight: bold;
    display: inline-block;
    margin-bottom: 1rem;
}

/* Départs */
/* Conteneur des départs avec espacement pour le footer */
.departures-container {
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding: 10px 0;
    height: calc(100vh - 200px); /* Hauteur totale moins header et footer */
}

.departure {
    background: var(--card-bg);
    border-radius: 8px;
    padding: 1.5rem;
    margin-bottom: 1rem;
    transition: all 0.5s cubic-bezier(0.4, 0, 0.2, 1);
    min-height: 120px;
    display: flex;
    align-items: center;
    opacity: 1;
    transform: translateX(0);
    animation: fadeSlideIn 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

.departure:hover {
    transform: translateX(4px) scale(1.01);
    background: var(--card-hover);
}

@keyframes fadeSlideIn {
    from {
        opacity: 0;
        transform: translateY(10px);
        filter: blur(2px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
        filter: blur(0);
    }
}

.departure-info {
    display: grid;
    grid-template-columns: auto auto minmax(0, 1fr) 20rem;
    align-items: center;
    gap: 2rem;
    width: 100%;
}

.line-number {
    background: var(--line-number-bg);
    color: #000;
    padding: 0.5rem 1.5rem;
    border-radius: 8px;
    font-size: 2.5rem;
    font-weight: bold;
    min-width: 5rem;
    text-align: center;
}

.scheduled-time {
    font-size: 2.5rem;
    font-weight: 500;
    color: var(--text-color);
}

.destination {
    font-size: 2.5rem;
    font-weight: bold;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    color: var(--text-color);
}

.minutes-left {
    font-size: 3rem;
    font-weight: bold;
    min-width: 20rem;
    text-align: right;
    color: var(--text-color);
    white-space: nowrap;
    overflow: visible;
    padding-right: 2rem;
    display: flex;
    justify-content: flex-end;
    align-items: center;
}

.time-info {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 0.5rem;
}

.time-info span {
    line-height: 1;
}

.time-info .delay {
    font-size: 2rem;
    margin: 0;
}

/* Responsive breakpoints pour le nombre de résultats */
@media (max-height: 768px) {
    #departures .departure:nth-child(n+4) {
        display: none !important;
    }
    
    .line-number {
        font-size: 2rem;
    }
    
    .scheduled-time,
    .destination {
        font-size: 2rem;
    }
    
    .minutes-left {
        font-size: 2.5rem;
    }
}

@media (max-height: 600px) {
    #departures .departure:nth-child(n+3) {
        display: none !important;
    }
    
    .line-number {
        font-size: 1.75rem;
    }
    
    .scheduled-time,
    .destination {
        font-size: 1.75rem;
    }
    
    .minutes-left {
        font-size: 2rem;
    }
}

@media (min-height: 1080px) {
    #departures .departure:nth-child(n+8) {
        display: none !important;
    }
}

@media (min-height: 1440px) {
    #departures .departure:nth-child(n+11) {
        display: none !important;
    }
}

/* États et messages */
.error, .no-departures {
    background: var(--card-bg);
    border-radius: 8px;
    padding: 2rem;
    text-align: center;
    font-size: 2rem;
}

.departures-warning {
    background: var(--card-bg);
    border-radius: 8px;
    padding: 0.75rem;
    text-align: center;
    font-size: 1rem;
    margin-bottom: 1rem;
    border-left: 4px solid #ffd700;
    color: var(--text-color);
    opacity: 0.8;
}

/* Indicateur de connectivité */
.connectivity-indicator {
    position: fixed;
    top: 10px;
    right: 10px;
    padding: 8px 12px;
    border-radius: 4px;
    font-size: 0.9rem;
    font-weight: bold;
    z-index: 1000;
    opacity: 0;
    transition: opacity 0.3s ease;
    display: flex;
    align-items: center;
    gap: 8px;
}

.connectivity-indicator.offline {
    opacity: 1;
    background-color: rgba(255, 68, 68, 0.9);
    color: white;
}

.loading {
    background: var(--card-bg);
    padding: 2rem;
    text-align: center;
    border-radius: 8px;
}

.loading-spinner {
    width: 50px;
    height: 50px;
    border: 5px solid var(--card-hover);
    border-top-color: var(--line-number-bg);
    border-radius: 50%;
    margin: 0 auto 1rem;
    animation: spin 1s linear infinite;
}

/* Retards et annulations */
.delay {
    color: var(--error-color);
    font-size: inherit;
    font-weight: 600;
    margin-left: 1rem;
    display: inline-block;
    white-space: nowrap;
    position: relative;
    padding: 0 0.25rem;
    animation: fadeIn 0.3s ease-out;
}

.delay-critical {
    animation: criticalDelay 2s ease-in-out infinite;
    font-weight: bold;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    background-color: rgba(255, 68, 68, 0.1);
}

@keyframes criticalDelay {
    0%, 100% {
        opacity: 1;
        background-color: rgba(255, 68, 68, 0.1);
    }
    50% {
        opacity: 0.8;
        background-color: rgba(255, 68, 68, 0.2);
    }
}
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.delay::after {
    content: '';
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    height: 2px;
    background-color: var(--error-color);
    animation: delayPulse 3s ease-in-out infinite;
}

@keyframes delayPulse {
    0% { opacity: 0.2; transform: scaleX(0.8); }
    50% { opacity: 1; transform: scaleX(1.1); }
    100% { opacity: 0.2; transform: scaleX(0.8); }
}

.cancelled {
    color: var(--error-color);
    font-weight: bold;
    text-transform: uppercase;
}

.departure.delayed {
    border-left: 4px solid var(--error-color);
    position: relative;
}

.departure.cancelled {
    border-left: 4px solid var(--error-color);
    opacity: 0.8;
    position: relative;
}

.departure.cancelled::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 100%;
    background: repeating-linear-gradient(
        45deg,
        rgba(255, 68, 68, 0.1),
        rgba(255, 68, 68, 0.1) 10px,
        transparent 10px,
        transparent 20px
    );
    border-radius: 8px;
    pointer-events: none;
}

.cancelled-text {
    color: var(--error-color);
    font-weight: bold;
    text-transform: uppercase;
    animation: flashWarning 2s ease-in-out infinite;
}

@keyframes flashWarning {
    0%, 100% { opacity: 0.7; }
    50% { opacity: 1; }
}
.departure.delayed::before {
    content: '';
    position: absolute;
    left: -4px;
    top: 0;
    bottom: 0;
    width: 4px;
    background-color: var(--error-color);
    animation: borderPulse 3s ease-in-out infinite;
}

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

.departure.approaching {
    border-left: 4px solid #4CAF50;
    position: relative;
    animation: approachingGlow 3s cubic-bezier(0.4, 0, 0.2, 1) infinite;
}

.departure.approaching.delayed {
    border-left: 4px solid var(--error-color);
}

@keyframes approachingGlow {
    0% {
        background: var(--card-bg);
        box-shadow: 0 0 0 rgba(76, 175, 80, 0);
    }
    50% {
        background: rgba(76, 175, 80, 0.1);
        box-shadow: 0 0 15px rgba(76, 175, 80, 0.2);
    }
    100% {
        background: var(--card-bg);
        box-shadow: 0 0 0 rgba(76, 175, 80, 0);
    }
}

.departure.approaching .minutes-left {
    color: #4CAF50;
    font-weight: 700;
    animation: textFloat 3s cubic-bezier(0.4, 0, 0.2, 1) infinite;
}

@keyframes textFloat {
    0% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(-2px);
    }
    100% {
        transform: translateY(0);
    }
}
/* Bouton de configuration */
.config-button {
    position: fixed;
    bottom: 20px;
    right: 20px;
    background: var(--card-bg);
    color: var(--text-color);
    padding: 15px;
    border-radius: 50%;
    box-shadow: 0 2px 10px rgba(0,0,0,0.3);
    transition: transform 0.2s, background-color 0.3s;
    z-index: 1000;
    width: 50px;
    height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.config-button svg {
    width: 30px;
    height: 30px;
}

.config-button:hover {
    transform: scale(1.1);
    background: var(--card-hover);
}

@keyframes spin {
    to { transform: rotate(360deg); }
}
/* Styles des conteneurs de logos 
#partnerLogo, #companyLogo {
    position: absolute;
    top: 0px;
    height: 600px;
}

/* Logo partenaire (rectangle rouge dans votre schéma) 
#partnerLogo {
    right: 420px; /* Position pour laisser de la place au logo entreprise 
    width: 300px;
}

#partnerLogo img,
#partnerLogo svg {
    width: 200%;
    height: 200%;
    object-fit: contain;
}

/* Logo entreprise (rectangle bleu dans votre schéma) 
#companyLogo {
    right: 20px;
    width: 350px; /* Plus large que le logo partenaire 
}

#companyLogo img,
#companyLogo svg {
    width: 200%;
    height: 200%;
    object-fit: contain;
}

/* Prévisualisation dans l'admin 
#partnerLogoPreview,
#companyLogoPreview {
    width: 100%;
    height: 100px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    overflow: hidden; 
}

#partnerLogoPreview img,
#partnerLogoPreview svg,
#companyLogoPreview img,
#companyLogoPreview svg {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
} */

.sleep-mode-message {
    background: var(--card-bg);
    padding: 2rem;
    text-align: center;
    border-radius: 8px;
    margin: 2rem 0;
    border: none;
    font-size: 24px;
    color: #666666;
}

.sleep-mode-message p {
    margin: 0;
}

.sleep-mode-message p:first-child {
    font-size: 1.5rem;
    font-weight: bold;
    margin-bottom: 0.5rem;
}

.sleep-mode-message .text-sm {
    font-size: 0.875rem;
    color: var(--text-color);
    opacity: 0.8;
}
/* Ajoutez ces styles à votre style.css */

/* Animation de transition */
body {
    transition: opacity 1s ease-in-out;
}

/* Mode obscur */
body.power-save-mode {
    opacity: 0;
    pointer-events: none;
}

/* Message d'économie d'énergie */
.power-save-message {
    display: none;
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(0, 0, 0, 0.8);
    color: #fff;
    padding: 20px;
    border-radius: 10px;
    font-size: 1.2rem;
    z-index: 9999;
    opacity: 0;
    transition: opacity 0.5s ease-in-out;
}

.power-save-mode .power-save-message {
    display: block;
    opacity: 1;
}



/* Footer styles */
.footer {
    background-color: var(--footer);
    padding: 10px 20px;
    height: 80px;
    border-top: 1px solid var(--border-color);
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    align-items: center;
}

.partners {
    display: flex;
    gap: 20px;
    align-items: center;
    height: 100%;
}

#partnerLogo, #companyLogo {
    height: 100%;
    display: flex;
    align-items: flex-start;
    justify-content: center;
}

#partnerLogo img, #companyLogo img {
    height: 40px;
    width: auto;
    object-fit: contain;
    margin-top: 10px;
}

#companyLogo {
    justify-content: flex-end;
    padding-right: 10px;
}

#companyLogo img {
    height: 60px;
    width: auto;
    object-fit: contain;
    margin-top: 5px;
}

.current-time {
    text-align: center;
    font-size: 4rem;
    font-weight: bold;
    color: var(--text-color);
    line-height: 1;
    margin: 5px 0 0;
    justify-self: center;
    width: 100%;
}

/* Ajuster l'espacement du contenu principal pour éviter le chevauchement avec le footer */
.departures-container {
    margin-bottom: 140px;
}

@keyframes scroll {
    0% { transform: translateX(100%); }
    100% { transform: translateX(-100%); }
}


/* Header styles */
.header {
    padding: 2vh;
    display: flex;
    align-items: center;
    gap: 2vw;
    height: 15vh;
}

.bus-icon {
    font-size: 5vh;
}

.stop-info {
    flex-grow: 1;
}

.stop-info h1 {
    font-size: 4vh;
    margin-bottom: 1vh;
}

.lines {
    font-size: 2.5vh;
    color: #99ccff;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* Indicateur de connexion */
.connectivity-indicator {
    position: fixed;
    top: 10px;
    right: 10px;
    padding: 8px 12px;
    border-radius: 4px;
    font-size: 0.9rem;
    font-weight: bold;
    z-index: 1000;
    opacity: 0;
    transition: opacity 0.3s ease;
    display: flex;
    align-items: center;
    gap: 8px;
}

.connectivity-indicator.offline {
    opacity: 1;
    background-color: rgba(255, 68, 68, 0.9);
    color: white;
}

.connectivity-indicator.cached {
    opacity: 1;
    background-color: rgba(255, 193, 7, 0.9);
    color: black;
}

body {
    margin: 0;
    font-family: Arial, sans-serif;
    height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Styles pour la page d'administration */
.station-result {
    transition: all 0.2s ease-in-out;
    cursor: pointer;
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--border-color);
}

.station-result:hover {
    background-color: rgba(59, 130, 246, 0.1);
}

.station-result:focus {
    outline: 2px solid #3b82f6;
    outline-offset: -2px;
}

#searchResults {
    border: 1px solid var(--border-color);
    border-radius: 0.375rem;
    margin-top: 0.5rem;
    background-color: white;
}

#searchResults:empty {
    display: none;
}

#searchResults > div {
    padding: 0.75rem 1rem;
}

#searchResults .text-red-500 {
    border-bottom: none;
}
.container.mx-auto {
    max-height: 100vh;
    overflow-y: auto;
    padding: 2vh 4vw;
    scrollbar-width: thin;
    scrollbar-color: var(--scrollbar-thumb) var(--scrollbar-bg);
}

.container.mx-auto::-webkit-scrollbar {
    width: 8px;
    display: block;
}

.container.mx-auto::-webkit-scrollbar-track {
    background: var(--scrollbar-bg);
}

.container.mx-auto::-webkit-scrollbar-thumb {
    background-color: var(--scrollbar-thumb);
    border-radius: 4px;
}

/* Responsive grid pour les sections de configuration */
.bg-white.rounded-lg.shadow-lg {
    margin-bottom: 2vh;
    padding: 2vh 3vw;
}

/* Ajustements responsifs pour les titres */
h1.text-3xl {
    font-size: clamp(1.5rem, 3vw, 2.5rem);
    margin-bottom: 2vh;
}

h2.text-xl {
    font-size: clamp(1.2rem, 2vw, 1.8rem);
    margin-bottom: 1.5vh;
}

/* Grid responsive pour les contrôles */
.grid.grid-cols-2 {
    display: grid;
    gap: 2vw;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
}

/* Ajustements pour les inputs et boutons */
input[type="text"],
input[type="time"],
input[type="number"],
select {
    width: 100%;
    padding: 1vh 1.5vw;
    font-size: clamp(0.9rem, 1.5vw, 1.1rem);
}

/* Responsive pour les boutons */
button {
    padding: 1vh 2vw;
    font-size: clamp(0.9rem, 1.5vw, 1.1rem);
}

/* Ajustements pour les résultats de recherche */
#searchResults {
    max-height: 40vh;
    overflow-y: auto;
}

/* Responsive pour les lignes et directions */
#availableLines,
#availableDirections,
#selectedLines,
#selectedDirections {
    display: flex;
    flex-wrap: wrap;
    gap: 1vh 1vw;
}

/* Media queries pour différentes tailles d'écran */
@media (max-width: 768px) {
    .container.mx-auto {
        padding: 1vh 2vw;
    }
    
    .bg-white.rounded-lg.shadow-lg {
        padding: 1.5vh 2vw;
    }
    
    .grid.grid-cols-2 {
        grid-template-columns: 1fr;
    }
    
    #searchResults {
        max-height: 30vh;
    }
}

@media (max-width: 480px) {
    .container.mx-auto {
        padding: 1vh 1vw;
    }
    
    button {
        width: 100%;
        margin-bottom: 1vh;
    }
    
    .flex.justify-end {
        flex-direction: column;
    }
    
    #saveConfigBtn {
        width: 100%;
        margin-top: 2vh;
    }
}