/* Page specific overrides */
.header-green {
}

/* Header actions row */
.header-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    position: absolute;
    top: 2rem;
    right: 1.5rem;
}

.favorite-button {
    background: none;
    border: none;
    font-size: 28px;
    cursor: pointer;
    line-height: 1;
    transition: transform 0.2s;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 4px;
}

.favorite-button:active {
    transform: scale(0.9);
}

.favorite-button.favorited {
    color: var(--color-gold);
}

.favorite-button:not(.favorited) {
    color: rgba(255, 255, 255, 0.5);
}

.passage-card {
    background: var(--color-white);
    box-shadow: var(--shadow-card-alt);
    border-radius: var(--radius-lg);
}

.passage-info { min-width: 0; }
.passage-time-column { display: flex; flex-direction: column; align-items: flex-end; gap: 7px; margin-left: 8px; }
.passage-vehicle-info { display: flex; align-items: center; gap: 6px; margin-top: 5px; color: var(--color-primary-green); font-size: 12px; font-weight: 700; }
.passage-vehicle-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--color-primary-green); box-shadow: 0 0 0 4px rgba(0,158,97,.14); flex: 0 0 auto; }

.time-badge {
    font-family: var(--font-secondary);
    font-weight: 700;
    font-size: 18px;
    color: var(--color-primary-green);
}

.time-badge.scheduled {
    color: var(--color-text-dark);
}

.real-time-indicator {
    background-color: var(--color-primary-green);
    border-radius: var(--radius-round);
    animation: pulse 2s infinite;
}

.parent-wrapper {
}
#filter-container {
    /* z-index: 99; */
    /* position: sticky; */

    /* Gestione Scorrimento */
    overflow-x: auto;                   /* Abilita lo scroll orizzontale */
    overflow-y: hidden;                 /* Evita scroll verticale indesiderato */
    padding: 4px 2px;                   /* spazio per pulse/box-shadow delle chip */
    scroll-behavior: smooth;
    /*white-space: nowrap;              /* Impedisce agli elementi di andare a capo */
    
    /* Miglioramenti UX */
    -webkit-overflow-scrolling: touch;  /* Scroll fluido su iOS */
    scrollbar-width: none;              /* Nasconde la scrollbar su Firefox */
}

/* Nasconde la scrollbar su Chrome/Safari/Edge */
#filter-container::-webkit-scrollbar {
    display: none;
}
/* Assicurati che i filtri (i bottoni) non si restringano */
#filter-container > div, 
#filter-container > button {
}
/* 
.parent-wrapper {
    position: relative;
    width: 100%;
    overflow: hidden;
}

.parent-wrapper::after {
    content: "";
    position: absolute;
    top: 0; right: 0;
    width: 50px;
    height: 100%;
    background: linear-gradient(to right, transparent, white);
    pointer-events: none;
} */

.filter-box {
    border-radius: var(--radius-lg);
    font-weight: 900;
    background: var(--color-white);
    box-shadow: var(--shadow-card-alt);
    font-family: var(--font-primary);
}
[data-theme="dark"] .filter-box {
    background: var(--color-white);
    filter: brightness(95%) contrast(90%);
}

.filter-box.box-red:not(.selected) {
    border: 3px solid var(--color-primary-red);
    color: var(--color-primary-red);
}
.filter-box.box-blue:not(.selected) {
    border: 3px solid var(--color-primary-blue);
    color: var(--color-primary-blue);
}
.filter-box.box-night:not(.selected) {
    border: 3px solid var(--color-night-blue);
    color: var(--color-night-blue);
}

.filter-box.selected.box-red {
    border: 3px solid var(--color-primary-red);
    background: var(--color-primary-red);
    color: var(--color-white);
}
.filter-box.selected.box-blue {
    border: 3px solid var(--color-primary-blue);
    background: var(--color-primary-blue);
    color: var(--color-white);
}
.filter-box.selected.box-night {
    border: 3px solid var(--color-night-blue);
    background: var(--color-night-blue);
    color: var(--color-white);
}

/* Chip filtro per stopId: stile neutro per distinguerle dalle linee */
.filter-box.box-stop:not(.selected) {
    border: 3px solid var(--color-light-gray);
    color: var(--color-text-muted);
}
.filter-box.selected.box-stop {
    border: 3px solid var(--color-light-gray);
    background: var(--color-light-gray);
    color: var(--color-white);
}

.filter-separator {
    align-self: center;
    width: 1px;
    height: 24px;
    background: var(--color-light-gray);
    margin-right: 10px;
}

[data-theme="dark"] .filter-box.selected {
    color: var(--color-black);
}

@keyframes pulse {
    0% {
        transform: scale(0.95);
        box-shadow: 0 0 0 0 rgba(0, 158, 97, 0.7);
    }

    70% {
        transform: scale(1);
        box-shadow: 0 0 0 10px rgba(0, 158, 97, 0);
    }

    100% {
        transform: scale(0.95);
        box-shadow: 0 0 0 0 rgba(0, 158, 97, 0);
    }
}

/* Notification Button */
.notify-button {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    line-height: 1;
    color: rgba(255, 255, 255, 0.6);
    transition: all 0.2s ease;
    padding: 4px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.notify-button.notify-active {
    color: var(--color-gold);
    animation: bellRing 0.5s ease;
}

@keyframes bellRing {
    0%, 100% { transform: rotate(0); }
    25% { transform: rotate(15deg); }
    50% { transform: rotate(-15deg); }
    75% { transform: rotate(10deg); }
}

/* Notification Settings Panel */
.notification-panel {
    background: var(--color-white);
    margin: 0 1.5rem;
    border-radius: 12px;
    box-shadow: var(--shadow-card);
    overflow: hidden;
    animation: slideDown 0.2s ease;
}

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

.notif-panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    background: var(--color-primary-green);
    color: var(--color-white);
    font-family: 'SF Pro', sans-serif;
    font-weight: 600;
    font-size: 14px;
}

.notif-panel-close {
    background: none;
    border: none;
    color: var(--color-white);
    font-size: 20px;
    cursor: pointer;
    padding: 0 4px;
}

.notif-panel-body {
    padding: 16px;
}

.notif-setting label {
    font-family: 'SF Pro', sans-serif;
    font-size: 13px;
    color: var(--color-text-gray);
    display: block;
    margin-bottom: 8px;
}

.threshold-selector {
    display: flex;
    gap: 8px;
}

.threshold-btn {
    flex: 1;
    padding: 8px 4px;
    border: 2px solid var(--color-border-gray);
    border-radius: 8px;
    background: var(--color-white);
    font-family: 'SF Pro', sans-serif;
    font-weight: 600;
    font-size: 13px;
    color: var(--color-text-dark);
    cursor: pointer;
    transition: all 0.2s ease;
}

.threshold-btn.active {
    border-color: var(--color-primary-green);
    background: var(--color-primary-green);
    color: var(--color-white);
}

.notif-info {
    font-family: 'SF Pro', sans-serif;
    font-size: 12px;
    color: var(--color-text-muted);
    margin-top: 12px;
    margin-bottom: 0;
    line-height: 1.4;
}

/* Tab Navigation */
.stop-tabs {
    display: flex;
    background: var(--color-white);
    border-bottom: 2px solid var(--color-lighter-gray);
    padding: 0 1.5rem;
    position: sticky;
    top: 0;
    z-index: 10;
}

.stop-tab {
    flex: 1;
    padding: 12px 8px;
    border: none;
    background: none;
    font-family: 'SF Pro', sans-serif;
    font-weight: 600;
    font-size: 14px;
    color: var(--color-text-gray);
    cursor: pointer;
    border-bottom: 3px solid transparent;
    transition: all 0.2s ease;
}

.stop-tab.active {
    color: var(--color-primary-green);
    border-bottom-color: var(--color-primary-green);
}

/* Tab Content */
.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

/* Lines & Timetable */
.line-card {
    background: var(--color-white);
    border-radius: 12px;
    box-shadow: var(--shadow-card);
    margin-bottom: 12px;
    overflow: hidden;
}

.line-card-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 16px;
    border-bottom: 1px solid var(--color-lighter-gray);
}

.line-card-header .line-badge {
    font-size: 16px;
    padding: 6px 14px;
}

.line-card-name {
    font-family: 'SF Pro', sans-serif;
    font-size: 13px;
    color: var(--color-text-gray);
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.line-departures {
    padding: 8px 16px 12px;
}

.departures-header {
    display: flex;
    justify-content: space-between;
    font-family: 'SF Pro', sans-serif;
    font-size: 11px;
    color: var(--color-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding-bottom: 6px;
    border-bottom: 1px solid var(--color-lighter-gray);
    margin-bottom: 4px;
}

.line-departure {
    display: flex;
    align-items: center;
    padding: 6px 0;
    border-bottom: 1px solid var(--color-bg-gray);
}

.line-departure:last-child {
    border-bottom: none;
}

.dep-time {
    font-family: 'SF Pro', sans-serif;
    font-weight: 700;
    font-size: 15px;
    color: var(--color-black);
    width: 55px;
    flex-shrink: 0;
}

.dep-dest {
    font-family: 'SF Pro', sans-serif;
    font-size: 13px;
    color: var(--color-text-gray);
    flex: 1;
    text-align: right;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Loading spinner for lines tab */
.loading {
    text-align: center;
    padding: 2rem 1rem;
}

.loading .spinner {
    border: 3px solid var(--color-spinner-base);
    border-top: 3px solid var(--color-primary-green);
    border-radius: 50%;
    width: 40px;
    height: 40px;
    animation: spin 1s linear infinite;
    margin: 0 auto 1rem;
}

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

/* Share Button */
.share-button {
    background: none;
    border: none;
    font-size: 22px;
    cursor: pointer;
    line-height: 1;
    color: rgba(255, 255, 255, 0.7);
    transition: color 0.2s ease;
    padding: 4px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.share-button:hover { color: var(--color-white); }

/* ===== Bacheca avvisi ===== */
#noticeboard:empty {
    display: none;
}

.board-card {
    background: var(--actv-surface);
    border: 1px solid var(--actv-border);
    border-radius: var(--actv-radius);
    box-shadow: var(--actv-shadow-sm);
    margin: var(--spacing-sm, 8px) 0 var(--spacing-md, 16px);
    overflow: hidden;
}

.board-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 14px;
    background: var(--actv-surface-2);
    border-bottom: 1px solid var(--actv-border);
    color: var(--actv-ink);
}

.board-title {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-weight: 750;
    font-size: 14px;
    letter-spacing: -.01em;
}

.board-title svg {
    width: 18px;
    height: 18px;
    color: var(--actv-green-dark);
}
[data-theme="dark"] .board-title svg { color: var(--actv-green); }

.board-collapse {
    display: grid;
    place-items: center;
    width: 32px;
    height: 32px;
    min-height: 0;
    padding: 0;
    background: transparent;
    border: 1px solid var(--actv-border);
    border-radius: 50%;
    color: var(--actv-muted);
    font-size: 18px;
    line-height: 1;
    cursor: pointer;
}
.board-collapse:hover { background: var(--actv-surface); color: var(--actv-ink); }

.board-body {
    padding: 6px 14px 12px;
    display: flex;
    flex-direction: column;
}

.board-note {
    display: flex;
    gap: 10px;
    align-items: flex-start;
    font-size: 14px;
    line-height: 1.5;
    color: var(--actv-ink);
    padding: 10px 0 0;
}
.board-note + .board-note {
    margin-top: 10px;
    border-top: 1px solid var(--actv-border);
    padding-top: 12px;
}

.board-note-icon {
    display: grid;
    place-items: center;
    width: 30px;
    height: 30px;
    flex-shrink: 0;
    border-radius: 9px;
    background: var(--actv-surface-2);
    color: var(--actv-muted);
}
.board-note-icon svg { width: 17px; height: 17px; }

.board-note-strike .board-note-icon {
    background: #fdf0d3;
    color: #9a6b00;
}
.board-note-strike .board-note-text {
    color: var(--actv-ink);
}
.board-note-strike .board-note-text strong {
    color: #8a5a00;
}
[data-theme="dark"] .board-note-strike .board-note-icon {
    background: rgba(214, 158, 46, .18);
    color: #e8b44a;
}
[data-theme="dark"] .board-note-strike .board-note-text strong {
    color: #e8b44a;
}

.board-note-text a { color: var(--actv-blue); }

/* Bolla bacheca collassata */
.board-bubble {
    position: fixed;
    right: 18px;
    bottom: 100px;
    width: 52px;
    height: 52px;
    border-radius: 50%;
    background: var(--actv-surface);
    border: 1px solid var(--actv-border);
    color: var(--actv-green-dark);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: var(--actv-shadow);
    cursor: pointer;
    z-index: 1000;
}
[data-theme="dark"] .board-bubble { color: var(--actv-green); }
.board-bubble-icon svg {
    width: 24px;
    height: 24px;
    display: block;
}

.board-bubble-count {
    position: absolute;
    top: -4px;
    right: -4px;
    background: var(--color-actv-red, #E30613);
    color: #fff;
    font-size: 12px;
    font-weight: 700;
    min-width: 20px;
    height: 20px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 5px;
}

/* Sotto il badge tempo: ETA assoluta + scostamento dall'orario di linea */
.passage-schedule { display: flex; flex-direction: column; align-items: flex-end; gap: 2px; }
.passage-eta { font-size: 12px; color: var(--color-text-gray); font-weight: 600; }
.passage-sched { font-size: 11px; color: var(--color-text-gray); }
.passage-delay { font-size: 11px; font-weight: 800; }
.passage-delay.is-late { color: var(--color-primary-red); }
.passage-delay.is-early { color: var(--color-primary-blue); }
.passage-delay.is-ontime { color: var(--color-primary-green); }
