@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&family=Fira+Code:wght@400;500&display=swap');

:root {
    /* GLOBALES THEME (Immer DJ Blau) */
    --theme-main: #2b2c7c;
    --theme-accent: #4a4aff; 
    
    /* U-BAHN DATEN FARBE (Ändert sich durch JS) */
    --line-color: #e2001a; 
    
    --brand-light: #8a8aff; 
    --bg-darkest: #090a10;
    --bg-darker: #0d0f1a;
    
    --glass-bg: rgba(43, 44, 124, 0.08);
    --glass-border: rgba(43, 44, 124, 0.25);
    --glass-hover: rgba(74, 74, 255, 0.35);
    
    --text-main: #ffffff;
    --text-muted: #a0a4b8;
    --success-green: #10b981;
}

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

body {
    font-family: 'Inter', sans-serif;
    background: var(--bg-darkest);
    background-image: radial-gradient(circle at top right, #151633 0%, var(--bg-darkest) 50%);
    color: var(--text-main);
    display: flex;
    flex-direction: column;
    align-items: center;
    min-height: 100vh;
    padding: 20px 15px;
    overflow-x: hidden;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    -webkit-user-select: none; -moz-user-select: none; -ms-user-select: none; user-select: none; -webkit-touch-callout: none;
}

.selectable-text { -webkit-user-select: text; -moz-user-select: text; -ms-user-select: text; user-select: text; }

.bubble-anim {
    position: fixed; border-radius: 50%;
    background: radial-gradient(circle, rgba(74, 74, 255, 0.15) 0%, transparent 70%);
    animation: bubbleAnimation 15s linear infinite; pointer-events: none; z-index: 1;
}
@keyframes bubbleAnimation { 0% { transform: translateY(0) scale(1); opacity: 1; } 100% { transform: translateY(-110vh) scale(0.6); opacity: 0; } }

/* --- LOGO & U-CHECK TITEL --- */
.logo-container { margin-top: 30px; margin-bottom: 20px; display: flex; justify-content: center; z-index: 10; position: relative;}
.nav-logo { display: flex; align-items: center; justify-content: center; gap: 12px; text-decoration: none; transition: transform 0.3s ease; }
.nav-logo:hover { transform: scale(1.05); }
.nav-logo img { width: 40px; filter: drop-shadow(0 0 10px rgba(74, 74, 255, 0.4)); }
.app-title { 
    font-size: 1.4rem; font-weight: 800; letter-spacing: -0.5px; 
    background: linear-gradient(135deg, #ffffff 0%, var(--theme-accent) 100%); 
    -webkit-background-clip: text; -webkit-text-fill-color: transparent; 
}

/* --- PREMIUM BUTTONS --- */
.magnetic-btn {
    transition: transform 0.15s ease-out, background 0.3s, box-shadow 0.3s, border-color 0.3s !important;
    will-change: transform;
}
.btn {
    display: inline-flex; align-items: center; justify-content: center;
    padding: 10px 26px; 
    background: linear-gradient(135deg, var(--theme-accent), var(--theme-main)); 
    color: white; border-radius: 8px; font-weight: 500; font-size: 0.95rem;
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275); cursor: pointer; border: none;
    box-shadow: 0 4px 15px rgba(43, 44, 124, 0.4); min-height: 44px; font-family: inherit;
}
.btn:hover { 
    transform: translateY(-3px) scale(1.05); 
    box-shadow: 0 10px 25px rgba(74, 74, 255, 0.6); 
    background: linear-gradient(135deg, #5b5bff, var(--theme-main));
}

/* --- SUCHE --- */
.search-container { position: relative; width: 100%; max-width: 400px; margin: 0 auto 15px auto; z-index: 20; }
#searchInput { 
    width: 100%; background: var(--glass-bg); color: white; border: 1px solid var(--glass-border); 
    padding: 12px 20px; border-radius: 12px; outline: none; font-size: 1rem; 
    backdrop-filter: blur(10px); transition: border-color 0.3s, box-shadow 0.3s; font-family: inherit;
}
#searchInput:focus { border-color: var(--theme-accent); box-shadow: 0 0 10px rgba(74,74,255,0.2); }
.search-results { 
    position: absolute; top: 100%; left: 0; width: 100%; background: rgba(9,10,16,0.95); 
    border: 1px solid var(--glass-border); border-radius: 12px; margin-top: 5px; 
    max-height: 250px; overflow-y: auto; display: none; backdrop-filter: blur(15px); box-shadow: 0 10px 30px rgba(0,0,0,0.5); 
}
.search-item { padding: 12px 20px; cursor: pointer; border-bottom: 1px solid rgba(255,255,255,0.05); color: white; display: flex; gap: 10px; align-items: center; }
@media (hover: hover) and (pointer: fine) {
    .search-item:hover { background: var(--glass-bg); }
}

/* --- CONTROLS --- */
.controls { margin-bottom: 15px; width: 100%; display: flex; gap: 15px; justify-content: center; align-items: center; flex-wrap: wrap; z-index: 10; position: relative; }

.geo-btn {
    background: var(--glass-bg); border: 1px solid var(--glass-border); backdrop-filter: blur(10px);
    color: white; width: 45px; height: 45px; border-radius: 12px;
    display: flex; align-items: center; justify-content: center;
    font-size: 1.3rem; cursor: pointer; transition: all 0.3s ease; flex-shrink: 0;
}
@media (hover: hover) and (pointer: fine) {
    .geo-btn:hover { border-color: var(--theme-accent); box-shadow: 0 0 15px var(--glass-hover); }
}
.geo-btn.active { 
    background: rgba(16, 185, 129, 0.15); border-color: var(--success-green); 
    color: var(--success-green); animation: pulse-gps 1.5s infinite; text-shadow: 0 0 10px var(--success-green);
}
@keyframes pulse-gps { 0% { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.4); } 70% { box-shadow: 0 0 0 10px rgba(16, 185, 129, 0); } 100% { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0); } }

.controls select {
    background: var(--glass-bg); color: #ffffff !important; border: 1px solid var(--glass-border);
    backdrop-filter: blur(10px); padding: 12px 20px; font-size: 1rem; border-radius: 12px;
    outline: none; width: 180px; text-align: center; cursor: pointer;
    font-family: inherit; font-weight: 500; transition: border-color 0.3s ease, box-shadow 0.3s ease;
}
@media (hover: hover) and (pointer: fine) {
    .controls select:hover { border-color: var(--theme-accent); box-shadow: 0 0 15px var(--glass-hover); }
}
.controls select option { background-color: var(--bg-darkest); color: #ffffff !important; }

/* --- FAVORITEN --- */
.favorites-bar { display: flex; gap: 10px; margin-bottom: 20px; flex-wrap: wrap; justify-content: center; width: 100%; max-width: 680px; z-index: 10; position: relative; }
.fav-chip {
    background: var(--glass-bg); border: 1px solid var(--glass-border); padding: 6px 15px; 
    border-radius: 20px; font-size: 0.85rem; font-weight: 600; cursor: pointer; 
    transition: all 0.2s; color: var(--text-main); backdrop-filter: blur(10px); display:flex; align-items:center; gap: 5px;
}

/* --- 3D INTERACTIVE CARD --- */
.widget-box { width: 100%; max-width: 680px; margin: 0 auto; z-index: 1;}
.interactive-card {
    background: var(--glass-bg); border: 1px solid var(--glass-border); border-radius: 16px; 
    position: relative; overflow: hidden; backdrop-filter: blur(15px); -webkit-backdrop-filter: blur(15px);
    transition: transform 0.15s ease-out, box-shadow 0.3s ease, border-color 0.3s ease;
    transform-style: preserve-3d; will-change: transform; box-shadow: 0 15px 35px rgba(0, 0, 0, 0.4); 
}
.interactive-card::after {
    content: ''; position: absolute; top: var(--mouse-y, -100px); left: var(--mouse-x, -100px);
    width: 250px; height: 250px; background: radial-gradient(circle closest-side, rgba(74, 74, 255, 0.15), transparent);
    transform: translate(-50%, -50%) translateZ(-1px); pointer-events: none; opacity: 0; transition: opacity 0.3s; z-index: 0;
}
@media (hover: hover) and (pointer: fine) {
    .interactive-card:hover { border-color: var(--theme-accent); box-shadow: 0 20px 40px rgba(0,0,0,0.5); }
    .interactive-card:hover::after { opacity: 1; }
}
.card-content { position: relative; z-index: 1; padding: 35px 30px; width: 100%; transform: translateZ(20px);}

/* --- LIVE RADAR --- */
.radar-container { width: 100%; margin-bottom: 25px; }
.radar-box {
    background: rgba(15, 15, 25, 0.6); border: 1px solid var(--glass-border);
    padding: 15px 20px; border-radius: 12px; color: white; box-shadow: inset 0 0 20px rgba(0,0,0,0.5);
    animation: fadeIn 0.4s ease forwards;
}
@keyframes fadeIn { from { opacity: 0; transform: translateY(-10px); } to { opacity: 1; transform: translateY(0); } }

/* --- STERN & HEADER (Linien-Farbe!) --- */
.station-header-wrapper { 
    display: flex; align-items: center; justify-content: center; gap: 10px; margin-bottom: 25px; 
}
.station-header { 
    color: var(--line-color); font-weight: 800; letter-spacing: 1px; 
    text-transform: uppercase; font-size: 1.4rem; text-align: center; margin:0; line-height: 1; transition: color 0.5s ease;
}
.fav-star { 
    font-size: 1.8rem; cursor: pointer; line-height: 1; display: flex; align-items: center; 
    transition: transform 0.2s, color 0.5s ease, filter 0.5s ease; color: rgba(255,255,255,0.2);
}
.fav-star.active { color: var(--line-color); filter: drop-shadow(0 0 10px var(--line-color)); }
.fav-star:hover { transform: scale(1.2); }

.main-content { display: flex; flex-direction: row; gap: 30px; align-items: center; justify-content: center; margin-bottom: 25px; width: 100%; }

/* --- UHR (ANALOG / DIGITAL) --- */
.clock-container { display: flex; flex-direction: column; align-items: center; cursor: pointer;}
.digital-clock {
    font-family: 'Fira Code', monospace; font-size: 2.2rem; font-weight: 700; color: var(--text-main);
    text-shadow: 0 0 15px rgba(255,255,255,0.4); height: 160px; width: 160px;
    display: flex; align-items: center; justify-content: center; letter-spacing: 1px;
}

/* --- KUGELSICHERES LAYOUT FÜR DIE REIHEN (Linien-Farbe!) --- */
.text-display { display: flex; flex-direction: column; gap: 15px; flex: 1; min-width: 0; width: 100%;}
.row-container { display: flex; flex-direction: column; gap: 4px; width: 100%; min-width: 0; }

.row { 
    display: flex; flex-direction: row; align-items: center; justify-content: space-between;
    background: rgba(255, 255, 255, 0.03); border: 1px solid var(--glass-border); 
    border-left: 4px solid var(--line-color); /* HIER LINIENFARBE */
    padding: 15px 18px; border-radius: 12px; width: 100%; box-sizing: border-box; min-width: 0; overflow: hidden; 
    transition: border-left-color 0.5s ease, transform 0.2s ease, background 0.2s ease; cursor: pointer;
}
@media (hover: hover) and (pointer: fine) {
    .row:hover { background: rgba(255,255,255,0.08); transform: scale(1.02); }
}
.row:active { transform: scale(0.98); }

.gleis-box { flex-shrink: 0; margin-right: 15px; text-align: center; min-width: 45px; border-right: 1px solid var(--glass-border); padding-right: 15px; }
.gleis-text { font-size: 0.65rem; display: block; text-transform: uppercase; font-weight: 600; opacity: 0.7; color: var(--text-main); }
.gleis-num { font-size: 2.2rem; font-weight: 800; line-height: 1; color: var(--line-color); transition: color 0.5s ease;}

.line { flex-shrink: 0; font-weight: 800; font-size: 1.3rem; color: var(--text-main); margin-right: 10px;}

.target { 
    flex: 1 1 0; min-width: 0; text-transform: uppercase; font-family: 'Fira Code', monospace; 
    font-size: 1.1rem; font-weight: bold; color: var(--text-main); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; 
}

.countdown { 
    flex-shrink: 0; margin-left: 10px; min-width: 65px; text-align: right; 
    font-family: 'Fira Code', monospace; font-size: 1.4rem; font-weight: bold; color: var(--line-color); transition: color 0.5s ease;
}

.sub-line { 
    font-size: 0.7rem; font-weight: 600; text-transform: uppercase; text-align: center; 
    display: block; width: 100%; color: var(--text-muted); letter-spacing: 0px; white-space: nowrap; 
    overflow: hidden; text-overflow: ellipsis; box-sizing: border-box; margin-top: 4px;
}

.incident-box { width: 100%; height: 40px; overflow: hidden; display: flex; align-items: center; background: rgba(0,0,0,0.3); border: 1px solid var(--glass-border); border-radius: 10px; }
.ticker-text { white-space: nowrap; padding-left: 100%; display: inline-block; font-size: 0.95rem; font-family: 'Fira Code', monospace; animation: marquee 20s linear infinite; color: var(--text-main); }

.update-info { font-size: 0.75rem; margin-top: 15px; font-weight: 600; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.5px; text-align: center; cursor: pointer; transition: color 0.3s;}
@media (hover: hover) and (pointer: fine) {
    .update-info:hover { color: var(--text-main); }
}

.progress-container { width: 160px; height: 3px; background: rgba(255, 255, 255, 0.1); border-radius: 2px; margin: 15px auto 0px auto; overflow: hidden; }
.progress-bar { height: 100%; width: 100%; background-color: var(--line-color); transition: background-color 0.5s ease;}

/* --- NORMALE TOASTS (Leuchtender, blauer Verlauf!) --- */
.toast-container { position: fixed; bottom: 20px; right: 20px; z-index: 9999; display: flex; flex-direction: column; gap: 10px; pointer-events: none;}
.toast {
    background: rgba(9, 10, 16, 0.95); backdrop-filter: blur(15px); -webkit-backdrop-filter: blur(15px);
    border: 1px solid var(--glass-border); border-left: none; position: relative; overflow: hidden;
    color: white; padding: 15px 20px; border-radius: 12px; font-size: 0.95rem; font-weight: 500;
    box-shadow: 0 10px 30px rgba(0,0,0,0.5);
    max-width: 350px; line-height: 1.4; pointer-events: auto; animation: slideInRight 0.4s ease forwards, fadeOutToast 0.5s ease 3.5s forwards;
}
.toast::before {
    content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 4px;
    background: linear-gradient(to bottom, var(--theme-accent), var(--theme-main));
}
.toast strong { 
    background: linear-gradient(135deg, var(--theme-accent), #8a8aff);
    -webkit-background-clip: text; -webkit-text-fill-color: transparent; 
    display: block; margin-bottom: 5px; font-size: 1.05rem; font-weight: 800;
}

/* --- MODALS (Original von dejongste.at) --- */
.modal {
    display: none; position: fixed; z-index: 10000; left: 0; top: 0; width: 100%; height: 100%;
    background-color: rgba(0,0,0,0.8); backdrop-filter: blur(5px);
    align-items: center; justify-content: center;
}
.modal-content {
    background: var(--bg-darkest); padding: 40px; border-radius: 12px; border: 1px solid var(--theme-accent);
    max-width: 500px; width: 90%; position: relative; color: var(--text-muted);
    box-shadow: 0 20px 50px rgba(0,0,0,0.5); animation: dropIn 0.3s ease;
    -webkit-user-select: text; -moz-user-select: text; -ms-user-select: text; user-select: text;
}
.modal-content h2 { color: white; margin-bottom: 20px; font-size: 1.6rem;}
.modal-content p { margin-bottom: 10px; }
.close-modal { position: absolute; top: 15px; right: 20px; color: white; font-size: 2rem; cursor: pointer; transition: 0.3s;}
.close-modal:hover { color: var(--theme-accent); }

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

/* --- FOOTER & COOKIES (Original von dejongste.at) --- */
.site-footer {
    background: rgba(9, 10, 16, 0.85); backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
    border-top: 1px solid rgba(255,255,255,0.03); 
    padding: 30px 20px; margin-top: 50px;
    display: flex; flex-direction: column; align-items: center; gap: 15px; text-align: center;
    width: 100%;
}
.footer-links { display: flex; gap: 20px; flex-wrap: wrap; justify-content: center; align-items: center; }
.footer-links button { 
    background: none; border: none; color: var(--text-muted); 
    font-size: 0.9rem; cursor: pointer; transition: 0.3s; font-family: inherit; font-weight: 500;
}
.footer-links button:hover { color: var(--theme-accent); }
.footer-divider { color: var(--glass-border); }

.cookie-banner {
    position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%);
    background: rgba(15, 15, 25, 0.85); backdrop-filter: blur(15px); -webkit-backdrop-filter: blur(15px);
    border: 1px solid rgba(255,255,255,0.1); border-radius: 30px;
    padding: 10px 15px 10px 20px; color: white; display: flex; align-items: center; gap: 15px;
    z-index: 10000; box-shadow: 0 10px 30px rgba(0,0,0,0.4);
    animation: slideUpCookie 0.6s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
}
.cookie-text { font-size: 0.75rem; color: var(--text-muted); white-space: nowrap; line-height: 1.3;}
.cookie-text b { color: #fff; }

@keyframes slideUpCookie { from { transform: translate(-50%, 100px); opacity: 0; } to { transform: translate(-50%, 0); opacity: 1; } }
@keyframes slideDownCookie { from { transform: translate(-50%, 0); opacity: 1; } to { transform: translate(-50%, 100px); opacity: 0; } }
@keyframes marquee { 0% { transform: translate(0, 0); } 100% { transform: translate(-100%, 0); } }
@keyframes slideInRight { from { transform: translateX(120%); opacity: 0; } to { transform: translateX(0); opacity: 1; } }
@keyframes fadeOutToast { from { opacity: 1; transform: translateY(0); } to { opacity: 0; transform: translateY(-20px); } }
@keyframes shrinkBar { 0% { width: 100%; } 100% { width: 0%; } }
@keyframes starMove { 0% { transform: translateX(-4px); opacity: 0.5; } 50% { transform: translateX(4px); opacity: 1; } 100% { transform: translateX(-4px); opacity: 0.5; } }
.anim-star { display: inline-block; animation: starMove 0.8s ease-in-out infinite; font-size: 1.2em; color: var(--line-color); transition: color 0.5s ease;}

/* --- PERFEKT FÜR MOBILE --- */
@media screen and (max-width: 650px) {
    body { padding: 10px 0 0 0; }
    
    .logo-container, .search-container, .controls, .favorites-bar, .widget-box {
        padding-left: 10px; padding-right: 10px; width: 100%;
    }
    
    .logo-container { margin-top: 10px; margin-bottom: 10px; }
    
    .search-container { max-width: 100%; }
    .controls { margin-bottom: 10px; gap: 8px;}
    .controls select { font-size: 14px; padding: 10px; width: 38%; } 
    .geo-btn { width: 40px; height: 40px; font-size: 1.1rem;}
    
    .widget-box { padding: 0; max-width: 100%; border: none;}
    .interactive-card { border-radius: 12px; }
    .card-content { padding: 20px 10px; transform: translateZ(0px); } 
    
    .radar-container { margin-bottom: 15px; }
    
    .station-header-wrapper { margin-bottom: 15px; gap: 8px; } 
    .station-header { font-size: 1.2rem; padding: 0;}
    .fav-star { font-size: 1.4rem; }
    
    .main-content { flex-direction: column; gap: 20px; }
    #analogClock, .digital-clock { width: 120px !important; height: 120px !important; }
    .digital-clock { font-size: 1.7rem; }
    
    .row { padding: 10px 10px; }
    .gleis-box { margin-right: 8px; padding-right: 8px; min-width: auto;}
    .gleis-num { font-size: 1.6rem; }
    .gleis-text { font-size: 0.55rem; }
    .line { font-size: 1.1rem; margin-right: 6px; }
    
    .target { font-size: 0.85rem; white-space: normal; line-height: 1.1; }
    .countdown { font-size: 1.2rem; min-width: 50px; margin-left: 5px;}
    .sub-line { font-size: 0.65rem; letter-spacing: 0px; margin-top: 5px; text-align: center;}
    
    /* Mobile Toasts - Oben blauer Verlauf */
    .toast-container { bottom: 10px; right: 10px; left: 10px; align-items: center; width: auto; }
    .toast { width: 100%; max-width: 100%; text-align: center; border-radius: 12px;}
    .toast::before {
        width: 100%; height: 4px; left: 0; top: 0; bottom: auto;
        background: linear-gradient(to right, var(--theme-accent), var(--theme-main));
    }

    .cookie-banner {
        flex-direction: row; width: calc(100% - 30px); border-radius: 20px; padding: 12px; bottom: 15px;
    }
    .cookie-text { white-space: normal; font-size: 0.7rem;}
    .cookie-btn { padding: 8px 15px; width: auto; }
    .pwa-close { color: white; background: none; border: none; font-size: 1.5rem; }
}