/* style.css - Final 2.0 (Mit Schriftart-Fix für Suche) */

/* --- 1. GRUNDDESIGN --- */
body { 
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background-color: #1a1a1a; 
    color: #f0f0f0; 
    margin: 0; 
    padding: 0; 
    padding-bottom: 50px;
    overflow-y: scroll; 
}

a { text-decoration: none; color: inherit; }

/* HEADER */
.app-header {
    background: rgba(30, 30, 30, 0.95);
    backdrop-filter: blur(10px);
    padding: 15px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky; top: 0; z-index: 1000;
    border-bottom: 1px solid #333;
    box-shadow: 0 4px 15px rgba(0,0,0,0.3);
}

.logo { font-size: 1.4rem; font-weight: 800; letter-spacing: 0.5px; color: #fff; }
.logo .highlight { color: #ff9e00; }
.admin-icon a { font-size: 1.2rem; opacity: 0.7; transition: opacity 0.2s; }
.admin-icon a:hover { opacity: 1; }

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

/* --- 2. SUCHE --- */
.search-wrapper { margin-bottom: 25px; position: relative; }
.search-icon { position: absolute; left: 15px; top: 50%; transform: translateY(-50%); opacity: 0.5; pointer-events: none; }

input#searchInput { 
    width: 100%; padding: 16px 16px 16px 45px; 
    border-radius: 12px; border: 1px solid #333; 
    background: #252525; color: white; font-size: 16px; 
    
    /* WICHTIG: Damit wird die Schriftart vom Body (Admin-Einstellung) übernommen */
    font-family: inherit; 
    font-weight: bold; /* Optional: Damit es gut lesbar ist */

    box-sizing: border-box; outline: none; transition: all 0.3s;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
}
input#searchInput:focus { border-color: #ff9e00; background: #2a2a2a; box-shadow: 0 4px 12px rgba(255, 158, 0, 0.15); }

#search-results { 
    background: #2a2a2a; border-radius: 12px; margin-top: 8px; 
    overflow-y: auto; max-height: 60vh; position: absolute; width: 100%; z-index: 100;
    box-shadow: 0 10px 25px rgba(0,0,0,0.5); border: 1px solid #333;
}
.search-item { padding: 15px; border-bottom: 1px solid #3a3a3a; cursor: pointer; transition: background 0.2s; }
.search-item:last-child { border-bottom: none; }
.search-item:hover { background: #ff9e00; color: #000; font-weight: bold; }

/* STATION HEADER */
.station-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 15px; border-bottom: 2px solid #333; padding-bottom: 10px; }
#station-title { margin: 0; font-size: 1.5rem; color: #e0e0e0; font-weight: 700; }
.live-indicator { background: #ff5555; color: white; font-size: 0.7rem; font-weight: bold; padding: 3px 8px; border-radius: 4px; animation: pulse-live 2s infinite; }
@keyframes pulse-live { 0% { opacity: 1; } 50% { opacity: 0.5; } 100% { opacity: 1; } }

/* --- 3. FILTER (Chips) --- */
#line-filter { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 20px; }

.filter-chip { 
    padding: 8px 14px; 
    border-radius: 20px; 
    background: #333; 
    color: white !important; 
    font-size: 1em; 
    cursor: pointer; 
    border: 2px solid transparent; 
    font-weight: 700; 
    transition: transform 0.2s;
    border-color: #fff !important; 
    transform: scale(1); 
}

.filter-chip.active { 
    border-color: #fff !important; 
    transform: scale(1); 
}

@keyframes hard-blink {
    0% { opacity: 1; border-color: #fff !important; box-shadow: 0 0 5px rgba(255, 255, 255, 0.5); }
    49% { opacity: 1; border-color: #fff !important; }
    50% { opacity: 0.3; border-color: transparent !important; box-shadow: none; }
    100% { opacity: 0.3; border-color: transparent !important; }
}

.filter-chip.has-immediate {
    animation: hard-blink 2s steps(1) infinite !important; 
    border: 2px solid transparent; 
}

/* --- 4. KARTEN --- */
.card { 
    background: #252525; margin-bottom: 12px; border-radius: 12px; 
    display: flex; align-items: center; padding: 15px 20px; 
    transition: transform 0.6s cubic-bezier(0.2, 0.8, 0.2, 1), opacity 0.4s ease, background-color 0.3s;
    transform-origin: center center;
    will-change: transform; 
    border-left: 4px solid transparent; position: relative; overflow: hidden;
    max-height: 150px; opacity: 1;
}

.card:hover { transform: translateY(-2px); background: #2a2a2a; }
.card.immediate-blink { border-left-color: #4caf50; background: linear-gradient(90deg, rgba(76,175,80,0.05) 0%, rgba(37,37,37,1) 30%); }
.card.departed-blink { opacity: 0.6; filter: grayscale(80%); border-left-color: #ff5555; transform: scale(0.98); }

@keyframes slide-out-left-anim {
    0% { transform: translateX(0); opacity: 0.6; max-height: 120px; margin-bottom: 12px; padding-top: 15px; padding-bottom: 15px; }
    40% { transform: translateX(-120%); opacity: 0; max-height: 120px; margin-bottom: 12px; }
    100% { transform: translateX(-120%); opacity: 0; max-height: 0; margin-bottom: 0; padding-top: 0; padding-bottom: 0; border: 0; }
}
.card.slide-out-left { animation: slide-out-left-anim 0.8s forwards ease-in-out; pointer-events: none; }

@keyframes card-enter-anim {
    from { opacity: 0; transform: scale(0.9) translateY(20px); }
    to { opacity: 1; transform: scale(1) translateY(0); }
}
.card.is-new { animation: card-enter-anim 0.5s ease-out forwards; }

.line-badge { 
    width: 50px; height: 50px; border-radius: 10px; 
    font-weight: 800; font-size: 1.8em; margin-right: 15px; 
    display: flex; justify-content: center; align-items: center;
    background-color: #333; color: white; box-shadow: 0 4px 8px rgba(0,0,0,0.2); flex-shrink: 0;
    -webkit-font-smoothing: antialiased;
}

.info { 
    flex-grow: 1; overflow: hidden; display: flex;
    flex-direction: column; justify-content: center; min-width: 0; 
}

.destination { 
    font-size: 2em; font-weight: 700; 
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis; 
    color: #fff;
}

.time-box { text-align: right; min-width: 100px; flex-shrink: 0; }
.main-time { font-size: 2em; font-weight: 700; color: #fff; line-height: 1.1; display: flex; justify-content: flex-end; align-items: center;}
.sub-time { font-size: 1.2em; color: #888; margin-top: 2px; }
.time-box .sub-time * { animation: none !important; }

/* 3-DOTS STYLE */
.three-dots { display: inline-flex; gap: 8px; justify-content: flex-end; align-items: center; height: 24px; }
.three-dots span {
    width: 18px; height: 18px; background-color: #4caf50; border-radius: 50%; display: inline-block;
    animation: wave-dots 1.4s infinite ease-in-out both;
}
.three-dots span:nth-child(1) { animation-delay: -0.32s; }
.three-dots span:nth-child(2) { animation-delay: -0.16s; }
.three-dots span:nth-child(3) { animation-delay: 0s; }

@keyframes wave-dots {
    0%, 80%, 100% { transform: scale(0.6); opacity: 0.5; }
    40% { transform: scale(1.1); opacity: 1; box-shadow: 0 0 10px rgba(76, 175, 80, 0.6); }
}

.soft-blink-text { color: #4caf50; text-shadow: 0 0 10px rgba(76,175,80,0.3); }

/* --- 5. STÖRUNGS-INFO (ALERT Ticker) --- */
.alert-box {
    background-color: #252525; display: flex; align-items: center;
    margin-top: 0px; width: 100%; overflow: hidden; 
    color: #ff9e00; font-size: 1.2em; font-weight: bold;
    white-space: nowrap; position: relative;
}

.alert-icon {
    font-size: 1.4em !important; min-width: 25px; flex-shrink: 0;
    animation: blink-warning 1s infinite alternate; 
    background-color: #252525 !important; position: relative; z-index: 2; display: inline-block; 
}

.alert-marquee {
    display: inline-block; white-space: nowrap;
    padding-left: 100%; will-change: transform; 
}

@keyframes marquee-scroll {
    0% { transform: translate3d(0, 0, 0); } 
    100% { transform: translate3d(-100%, 0, 0); } 
}

/* MOBILE OPTIMIERUNG */
@media (max-width: 600px) {
    .container { padding: 10px; }
    .card { padding: 12px; }
    .line-badge { width: 35px; height: 35px; font-size: 1.20em; border-radius: 6px; margin-right: 5px; }
    .destination { font-size: 1.20em; font-weight: 700;} 
    .main-time { font-size: 1.25em; font-weight: 700;}
    .sub-time { font-size: 1em; color: #888; margin-top: 2px; }
    .filter-chip { padding: 6px 10px; font-size: 0.85em; }
    .three-dots { gap: 5px; }
    .three-dots span { width: 14px; height: 14px; }
    .alert-box { font-size: 0.85em; }
}

/* Uhrzeit im Header */
.clock-display {
    position: absolute; left: 50%; transform: translateX(-50%);
    font-size: 1.8rem; font-weight: 900; letter-spacing: 0.5px;
    font-family: inherit; white-space: nowrap;
}
.clock-display .white-part { color: #ffffff; }
.clock-display .orange-part { color: #ff9e00; }

@media (max-width: 450px) {
    .clock-display { font-size: 1.5rem; }
    .logo { font-size: 1.1rem; }
}

/* Styling für ausgefallene Halte */
.is-cancelled .destination {
    text-decoration: line-through;
    color: #ff4444 !important;
}

.is-cancelled .alert-marquee {
    color: #ff4444;
    font-weight: bold;
}

/* Optional: Den Badge (Liniennummer) ausgrauen bei Ausfall */
.is-cancelled .line-badge {
    filter: grayscale(1);
    opacity: 0.7;
}

/* --- Feature: Ausgefallene Fahrten --- */
.card.is-cancelled {
    opacity: 0.6;
    background-color: rgba(50, 0, 0, 0.3); /* Leichter Rotstich optional */
}

.card.is-cancelled .destination,
.card.is-cancelled .main-time {
    text-decoration: line-through;
    color: #ff6b6b; /* Rötlicher Text */
}