/* === Rails World View — Stile base === */

:root {
    --bg: #f0ebe3;
    --bg-dark: #2c3e50;
    --text: #2c3440;
    --text-light: #6b7b8d;
    --accent: #e74c3c;
    --accent-hover: #c0392b;
    --card-bg: #fff;
    --border: #d5cec4;
    --nav-height: 64px;
    --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    --font-mono: 'JetBrains Mono', 'Fira Code', monospace;
    --radius: 8px;
    --shadow: 0 2px 12px rgba(0,0,0,0.08);
}

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

body {
    font-family: var(--font);
    color: var(--text);
    background: var(--bg);
    line-height: 1.6;
}

a { color: var(--text); text-decoration: none; }
a:hover { color: var(--accent); }

/* === NAV === */
.nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 2rem;
    height: var(--nav-height);
    background: var(--bg);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 100;
}

.nav-brand {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-family: var(--font-mono);
    font-weight: 700;
    font-size: 0.95rem;
    letter-spacing: 1px;
    text-transform: uppercase;
}

.nav-brand img {
    width: 36px;
    height: 36px;
    border-radius: 6px;
}

.nav-links {
    display: flex;
    gap: 2rem;
    list-style: none;
    font-family: var(--font-mono);
    font-size: 0.85rem;
    letter-spacing: 0.5px;
}

.nav-links a {
    color: var(--text-light);
    transition: color 0.2s;
}
.nav-links a:hover,
.nav-links a.active {
    color: var(--text);
}

.nav-right {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.lang-switcher {
    display: flex;
    gap: 0.25rem;
}

.lang-btn {
    background: none;
    border: 1px solid transparent;
    padding: 0.2rem 0.4rem;
    font-family: var(--font-mono);
    font-size: 0.65rem;
    color: var(--text-light);
    cursor: pointer;
    border-radius: 3px;
    transition: all 0.15s;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.lang-btn:hover { color: var(--text); border-color: var(--border); }
.lang-btn.active { color: var(--text); border-color: var(--text); font-weight: 700; }

.auth-nav {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.auth-user {
    font-family: var(--font-mono);
    font-size: 0.78rem;
    color: var(--text);
    font-weight: 600;
}

.auth-btn {
    font-family: var(--font-mono);
    font-size: 0.75rem;
    padding: 0.3rem 0.7rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: transparent;
    color: var(--text);
    cursor: pointer;
    text-decoration: none;
    transition: all 0.15s;
}
.auth-btn:hover { background: var(--bg-dark); color: #fff; border-color: var(--bg-dark); }

/* === LOGIN PAGE === */
.login-container {
    max-width: 400px;
    margin: 3rem auto;
    padding: 0 1.5rem;
}

.login-card {
    background: var(--card-bg);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 2rem;
}

.login-card h2 {
    font-size: 1.3rem;
    margin-bottom: 1.5rem;
    text-align: center;
}

.login-tabs {
    display: flex;
    border-bottom: 2px solid var(--border);
    margin-bottom: 1.5rem;
}

.login-tab {
    flex: 1;
    text-align: center;
    padding: 0.6rem;
    font-family: var(--font-mono);
    font-size: 0.85rem;
    cursor: pointer;
    color: var(--text-light);
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    background: none;
    border-top: none;
    border-left: none;
    border-right: none;
}
.login-tab.active {
    color: var(--text);
    border-bottom-color: var(--accent);
    font-weight: 600;
}

.form-group {
    margin-bottom: 1rem;
}

.form-group label {
    display: block;
    font-size: 0.8rem;
    font-family: var(--font-mono);
    color: var(--text-light);
    margin-bottom: 0.3rem;
}

.form-group input {
    width: 100%;
    padding: 0.6rem 0.8rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 0.9rem;
    font-family: var(--font);
}
.form-group input:focus {
    outline: none;
    border-color: var(--accent);
}

.form-submit {
    width: 100%;
    padding: 0.7rem;
    background: var(--bg-dark);
    color: #fff;
    border: none;
    border-radius: var(--radius);
    font-family: var(--font-mono);
    font-size: 0.9rem;
    cursor: pointer;
    margin-top: 0.5rem;
    transition: background 0.2s;
}
.form-submit:hover { background: #3d5166; }

.form-error {
    color: var(--accent);
    font-size: 0.8rem;
    text-align: center;
    margin-top: 0.75rem;
    min-height: 1.2rem;
}

.form-divider {
    text-align: center;
    color: var(--text-light);
    font-size: 0.8rem;
    margin: 1.25rem 0;
    position: relative;
}
.form-divider::before,
.form-divider::after {
    content: '';
    position: absolute;
    top: 50%;
    width: 35%;
    height: 1px;
    background: var(--border);
}
.form-divider::before { left: 0; }
.form-divider::after { right: 0; }

.oauth-buttons {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.oauth-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    width: 100%;
    padding: 0.6rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: #fff;
    font-family: var(--font);
    font-size: 0.85rem;
    cursor: pointer;
    transition: background 0.15s;
    color: var(--text);
}
.oauth-btn:hover { background: var(--bg); }

/* === HERO (homepage) === */
.hero {
    text-align: center;
    padding: 4rem 2rem 3rem;
    border-bottom: 1px solid var(--border);
}

.hero-label {
    font-family: var(--font-mono);
    font-size: 0.75rem;
    letter-spacing: 4px;
    color: var(--text-light);
    text-transform: uppercase;
    margin-bottom: 2rem;
}

.hero-logo {
    width: 160px;
    height: 160px;
    border-radius: 20px;
    margin: 0 auto 2rem;
    display: block;
}

.hero-tagline {
    font-size: 2rem;
    font-style: italic;
    font-weight: 300;
    margin-bottom: 0.75rem;
}

.hero-desc {
    color: var(--text-light);
    max-width: 520px;
    margin: 0 auto 2rem;
    font-size: 0.95rem;
}

.hero-cta {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.9rem 2rem;
    background: var(--bg-dark);
    color: #fff;
    border-radius: var(--radius);
    font-family: var(--font-mono);
    font-size: 0.9rem;
    letter-spacing: 0.5px;
    transition: background 0.2s;
}
.hero-cta:hover { background: #3d5166; color: #fff; }

.hero-badges {
    display: flex;
    justify-content: center;
    gap: 1rem;
    margin-top: 2rem;
    flex-wrap: wrap;
}

.badge {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.4rem 1rem;
    border: 1px solid var(--border);
    border-radius: 20px;
    font-family: var(--font-mono);
    font-size: 0.7rem;
    letter-spacing: 1.5px;
    text-transform: uppercase;
    color: var(--text-light);
}

/* === SEZIONI === */
.section {
    padding: 3rem 2rem;
    max-width: 1200px;
    margin: 0 auto;
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

.section-title {
    font-family: var(--font-mono);
    font-size: 0.75rem;
    letter-spacing: 3px;
    text-transform: uppercase;
    color: var(--text-light);
}

.section-link {
    font-family: var(--font-mono);
    font-size: 0.85rem;
    color: var(--text-light);
}

/* === CARD (video/journey) === */
.cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1.5rem;
}

.card {
    background: var(--card-bg);
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow);
    transition: transform 0.2s, box-shadow 0.2s;
    cursor: pointer;
}
.card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 20px rgba(0,0,0,0.12);
}

.card-thumb {
    position: relative;
    width: 100%;
    aspect-ratio: 16/9;
    overflow: hidden;
}

.card-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.card-thumb .play-icon {
    position: absolute;
    bottom: 10px;
    left: 10px;
    width: 36px;
    height: 36px;
    background: var(--accent);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}
.card-thumb .play-icon::after {
    content: '';
    display: block;
    width: 0;
    height: 0;
    border-style: solid;
    border-width: 6px 0 6px 10px;
    border-color: transparent transparent transparent #fff;
    margin-left: 2px;
}

.card-thumb .duration {
    position: absolute;
    bottom: 10px;
    right: 10px;
    background: rgba(0,0,0,0.75);
    color: #fff;
    padding: 2px 6px;
    border-radius: 4px;
    font-family: var(--font-mono);
    font-size: 0.75rem;
}

.card-thumb .channel-badge {
    position: absolute;
    top: 8px;
    left: 8px;
    background: rgba(0,0,0,0.8);
    color: #fff;
    padding: 3px 8px;
    border-radius: 4px;
    font-family: var(--font-mono);
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.3px;
    max-width: calc(100% - 16px);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Video item (pannello Atlas) */
.video-item-thumb .channel-badge {
    position: absolute;
    top: 4px;
    left: 4px;
    background: rgba(0,0,0,0.8);
    color: #fff;
    padding: 2px 5px;
    border-radius: 3px;
    font-family: var(--font-mono);
    font-size: 0.6rem;
    font-weight: 700;
    max-width: calc(100% - 8px);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.card-body {
    padding: 0.75rem 1rem;
}

.card-title {
    font-weight: 600;
    font-size: 0.95rem;
    margin-bottom: 0.25rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.card-meta {
    font-size: 0.8rem;
    color: var(--text-light);
    font-family: var(--font-mono);
}

/* === ROUTE/VIDEO DETAIL PANEL (shared Atlas + Routes) === */
.route-detail {
    position: absolute;
    bottom: 20px;
    left: 20px;
    width: 400px;
    max-height: 80%;
    background: var(--card-bg);
    border-radius: var(--radius);
    box-shadow: 0 4px 24px rgba(0,0,0,0.18);
    z-index: 10;
    display: none;
    flex-direction: column;
    overflow: hidden;
}
.route-detail.open { display: flex; }

.route-detail-close {
    position: absolute;
    top: 8px; right: 10px;
    background: none; border: none;
    font-size: 1.3rem; cursor: pointer;
    color: var(--text-light); z-index: 1;
}

.route-detail-thumb {
    width: 100%; aspect-ratio: 16/9;
    overflow: hidden; position: relative;
}
.route-detail-thumb img { width: 100%; height: 100%; object-fit: cover; }

.route-detail-body { padding: 1rem; overflow-y: auto; }

.route-detail-title {
    font-size: 1rem; font-weight: 600;
    margin-bottom: 0.5rem; padding-right: 1.5rem;
}

.route-detail-meta {
    font-size: 0.8rem; color: var(--text-light);
    font-family: var(--font-mono); margin-bottom: 0.75rem; line-height: 1.6;
}

.route-stops { list-style: none; padding: 0; margin: 0.75rem 0 0; border-left: 3px solid var(--accent); padding-left: 1rem; }
.route-stop { font-size: 0.8rem; padding: 0.25rem 0; color: var(--text); }
.route-stop .stop-role { font-family: var(--font-mono); font-size: 0.68rem; color: var(--text-light); margin-left: 0.5rem; }

.route-detail-actions { padding: 0.75rem 1rem; border-top: 1px solid var(--border); }

/* === VIDEO PANEL (unificato Atlas + Routes) === */
.vp-overlay {
    display: none;
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.45);
    z-index: 1000;
    align-items: center;
    justify-content: center;
}
.vp-overlay.open { display: flex; }

.vp-card {
    background: var(--card-bg);
    border-radius: 12px;
    box-shadow: 0 8px 40px rgba(0,0,0,0.25);
    width: 460px;
    max-width: 92vw;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    position: relative;
}

.vp-close {
    position: absolute; top: 8px; right: 10px; z-index: 2;
    background: rgba(255,255,255,0.85); border: none; border-radius: 50%;
    width: 28px; height: 28px; font-size: 1.2rem; cursor: pointer;
    color: var(--text-light); display: flex; align-items: center; justify-content: center;
}
.vp-close:hover { background: #fff; color: var(--text); }

.vp-scroll { flex: 1; overflow-y: auto; }

.vp-thumb {
    width: 100%; aspect-ratio: 16/9; overflow: hidden; position: relative;
    background: #ddd;
}
.vp-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }

.vp-channel-badge {
    position: absolute; top: 8px; left: 8px;
    background: rgba(0,0,0,0.8); color: #fff;
    padding: 3px 8px; border-radius: 4px;
    font-family: var(--font-mono); font-size: 0.7rem; font-weight: 700;
}

.vp-body { padding: 1rem; }

.vp-title { font-size: 0.95rem; font-weight: 600; margin-bottom: 0.3rem; line-height: 1.3; }
.vp-desc { font-size: 0.82rem; color: var(--text-light); line-height: 1.4; margin-bottom: 0.5rem; }
.vp-meta { font-size: 0.78rem; font-family: var(--font-mono); color: var(--text-light); margin-bottom: 0.6rem; line-height: 1.5; }

.vp-label {
    font-family: var(--font-mono); font-size: 0.68rem; letter-spacing: 1.5px;
    text-transform: uppercase; color: var(--text-light); margin-bottom: 0.4rem;
}

.vp-stops-section { margin-bottom: 0.6rem; }
.vp-stops {
    list-style: none; padding: 0; margin: 0;
    border-left: 3px solid var(--accent); padding-left: 0.8rem;
}
.vp-stops li { font-size: 0.8rem; padding: 0.15rem 0; }
.vp-stop-meta { font-family: var(--font-mono); font-size: 0.68rem; color: var(--text-light); }

.vp-missing {
    background: #fff3f3; border-radius: var(--radius);
    padding: 0.4rem 0.7rem; margin-bottom: 0.6rem; font-size: 0.75rem;
}
.vp-missing strong { color: var(--accent); }
.vp-missing span { color: var(--text-light); }

.vp-community-box {
    background: var(--bg); border-radius: var(--radius); padding: 0.8rem 1rem; margin-top: 0.6rem;
}
.vp-community-title { font-weight: 600; font-size: 0.88rem; margin-bottom: 0.3rem; }
.vp-community-sub { font-size: 0.8rem; color: var(--text-light); margin-bottom: 0.3rem; }
.vp-community-list { font-size: 0.8rem; padding-left: 1.2rem; margin: 0; line-height: 1.8; }

.vp-section { margin-bottom: 1rem; }
.vp-section:last-child { margin-bottom: 0; }
.vp-hint { font-size: 0.8rem; color: var(--text-light); margin-bottom: 0.3rem; }

.vp-stars { display: flex; gap: 0.25rem; }
.vp-rating-info { font-size: 0.75rem; color: var(--text-light); font-family: var(--font-mono); margin-top: 0.2rem; }

.vp-channel-name { font-size: 0.78rem; color: var(--text-light); text-align: center; margin-top: 0.3rem; }

.vp-watch-bar {
    padding: 0.75rem 1rem; border-top: 1px solid var(--border);
}
.vp-watch-btn {
    width: 100%; padding: 0.8rem;
    background: var(--bg-dark); color: #fff; border: none;
    border-radius: var(--radius); font-family: var(--font-mono);
    font-size: 0.95rem; cursor: pointer; transition: background 0.2s;
}
.vp-watch-btn:hover { background: #3d5166; }

/* === VIDEO FEEDBACK OVERLAY (legacy, da rimuovere) === */
.feedback-overlay {
    display: none;
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.5);
    z-index: 1000;
    align-items: center;
    justify-content: center;
}
.feedback-overlay.open { display: flex; }

.feedback-card {
    background: var(--card-bg);
    border-radius: 12px;
    box-shadow: 0 8px 40px rgba(0,0,0,0.25);
    width: 380px;
    max-width: 90vw;
    overflow: hidden;
}
.feedback-card.fb-large {
    width: 480px;
    max-height: 90vh;
}
.feedback-card.fb-large .feedback-body {
    max-height: calc(90vh - 60px);
    overflow-y: auto;
}

.feedback-header {
    padding: 1.2rem 1.5rem;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.feedback-header h3 {
    font-size: 1rem;
    margin: 0;
}
.feedback-close {
    background: none;
    border: none;
    font-size: 1.4rem;
    cursor: pointer;
    color: var(--text-light);
}

.feedback-body {
    padding: 1.2rem 1.5rem;
}

.feedback-section {
    margin-bottom: 1.2rem;
}
.feedback-section:last-child { margin-bottom: 0; }

.feedback-label {
    font-family: var(--font-mono);
    font-size: 0.72rem;
    letter-spacing: 1.5px;
    text-transform: uppercase;
    color: var(--text-light);
    margin-bottom: 0.5rem;
}

/* Stelle rating */
.star-rating {
    display: flex;
    gap: 0.3rem;
}
.star-btn {
    background: none;
    border: none;
    font-size: 1.6rem;
    cursor: pointer;
    color: var(--border);
    transition: color 0.15s;
    padding: 0;
    line-height: 1;
}
.star-btn.active, .star-btn:hover { color: #f39c12; }

.rating-info {
    font-size: 0.78rem;
    color: var(--text-light);
    margin-top: 0.3rem;
    font-family: var(--font-mono);
}

/* Subscribe button */
.subscribe-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    width: 100%;
    padding: 0.7rem;
    background: #c4302b;
    color: #fff;
    border: none;
    border-radius: var(--radius);
    font-family: var(--font-mono);
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    transition: background 0.2s;
}
.subscribe-btn:hover { background: #a82723; color: #fff; }

.subscribe-channel-name {
    font-size: 0.8rem;
    color: var(--text-light);
    text-align: center;
    margin-top: 0.4rem;
}

/* Edit invite */
.edit-invite {
    padding: 0.8rem;
    background: var(--bg);
    border-radius: var(--radius);
    text-align: center;
}
.edit-invite p {
    font-size: 0.82rem;
    color: var(--text);
    margin-bottom: 0.5rem;
}
.edit-invite .missing-list {
    font-size: 0.72rem;
    font-family: var(--font-mono);
    color: var(--accent);
    margin-bottom: 0.5rem;
}

/* === FOOTER === */
.footer {
    background: var(--bg-dark);
    color: #c8d1d9;
    text-align: center;
    padding: 1.5rem 2rem;
    font-family: var(--font-mono);
    font-size: 0.8rem;
    letter-spacing: 0.5px;
}

.footer-accent {
    color: var(--accent);
    margin-right: 0.5rem;
}

/* === ATLAS (mappa) === */
.atlas-container {
    display: flex;
    height: calc(100vh - var(--nav-height));
}

.atlas-sidebar {
    width: 340px;
    min-width: 340px;
    background: var(--card-bg);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.atlas-sidebar-header {
    padding: 1rem;
    border-bottom: 1px solid var(--border);
}

.atlas-search {
    width: 100%;
    padding: 0.6rem 0.8rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 0.9rem;
    font-family: var(--font);
    outline: none;
}
.atlas-search:focus { border-color: var(--accent); }

.atlas-filters {
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--border);
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.filter-select {
    padding: 0.35rem 0.5rem;
    border: 1px solid var(--border);
    border-radius: 4px;
    font-size: 0.78rem;
    font-family: var(--font);
    background: #fff;
    cursor: pointer;
    flex: 1;
    min-width: 100px;
}

.atlas-results {
    flex: 1;
    overflow-y: auto;
    padding: 0;
}

.station-item {
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--border);
    cursor: pointer;
    transition: background 0.15s;
}
.station-item:hover { background: var(--bg); }

.station-name {
    font-weight: 600;
    font-size: 0.9rem;
}

.station-meta {
    font-size: 0.75rem;
    color: var(--text-light);
    font-family: var(--font-mono);
}

.atlas-map {
    flex: 1;
    position: relative;
}

#map { width: 100%; height: 100%; }

/* === VIDEO LIST (sidebar panel) === */
.video-panel {
    position: absolute;
    right: 0;
    top: 0;
    width: 380px;
    height: 100%;
    background: var(--card-bg);
    box-shadow: -4px 0 20px rgba(0,0,0,0.1);
    z-index: 10;
    display: none;
    flex-direction: column;
    overflow: hidden;
}
.video-panel.open { display: flex; }

.video-panel-header {
    padding: 1rem;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.video-panel-close {
    background: none;
    border: none;
    font-size: 1.4rem;
    cursor: pointer;
    color: var(--text-light);
    line-height: 1;
}

.video-panel-list {
    flex: 1;
    overflow-y: auto;
    padding: 0.5rem;
}

.video-item {
    display: flex;
    gap: 0.75rem;
    padding: 0.75rem;
    border-radius: var(--radius);
    transition: background 0.15s;
}
.video-item:hover { background: var(--bg); }

.video-item-thumb {
    width: 120px;
    min-width: 120px;
    aspect-ratio: 16/9;
    border-radius: 4px;
    overflow: hidden;
    position: relative;
}
.video-item-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.video-item-info {
    flex: 1;
    min-width: 0;
}

.video-item-wrap {
    display: flex;
    align-items: center;
    position: relative;
}
.video-item-wrap .video-item { flex: 1; min-width: 0; }

.video-edit-link {
    position: absolute;
    right: 6px;
    top: 6px;
    width: 26px;
    height: 26px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255,255,255,0.9);
    border-radius: 50%;
    font-size: 0.85rem;
    color: var(--text-light);
    text-decoration: none;
    box-shadow: 0 1px 4px rgba(0,0,0,0.15);
    transition: all 0.15s;
    z-index: 2;
}
.video-edit-link:hover {
    background: var(--bg-dark);
    color: #fff;
}

.video-edit-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    min-width: 28px;
    height: 28px;
    background: var(--bg);
    border-radius: 50%;
    font-size: 0.85rem;
    color: var(--text-light);
    text-decoration: none;
    transition: all 0.15s;
    align-self: center;
    margin-left: auto;
}
.video-edit-btn:hover {
    background: var(--bg-dark);
    color: #fff;
}

.video-item-title {
    font-size: 0.82rem;
    font-weight: 600;
    line-height: 1.35;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
    margin-bottom: 0.3rem;
}

.video-item-meta {
    font-size: 0.72rem;
    color: var(--text-light);
    font-family: var(--font-mono);
}

/* === ROUTES PAGE === */
.routes-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem;
}

.routes-toolbar {
    display: flex;
    gap: 0.75rem;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
    align-items: center;
}

.routes-search {
    flex: 1;
    min-width: 200px;
    padding: 0.6rem 0.8rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 0.9rem;
    font-family: var(--font);
}

/* === PAGE HEADER (generico per pagine interne) === */
.page-header {
    text-align: center;
    padding: 3rem 2rem;
    border-bottom: 1px solid var(--border);
}

.page-header h1 {
    font-size: 1.8rem;
    font-weight: 300;
    margin-bottom: 0.5rem;
}

.page-header p {
    color: var(--text-light);
    max-width: 500px;
    margin: 0 auto;
    font-size: 0.95rem;
}

/* === COMMUNITY PAGE === */
.community-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1.5rem;
    max-width: 1000px;
    margin: 2rem auto;
    padding: 0 2rem;
}

.comm-card {
    background: var(--card-bg);
    border-radius: var(--radius);
    padding: 2rem;
    box-shadow: var(--shadow);
    text-align: center;
}

.comm-card h3 {
    margin-bottom: 0.75rem;
    font-size: 1.1rem;
}

.comm-card p {
    color: var(--text-light);
    font-size: 0.9rem;
    margin-bottom: 1rem;
}

.btn {
    display: inline-block;
    padding: 0.6rem 1.5rem;
    background: var(--bg-dark);
    color: #fff;
    border-radius: var(--radius);
    font-family: var(--font-mono);
    font-size: 0.8rem;
    border: none;
    cursor: pointer;
    transition: background 0.2s;
}
.btn:hover { background: #3d5166; color: #fff; }
.btn-outline {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text);
}
.btn-outline:hover { background: var(--bg); color: var(--text); }

/* === ABOUT PAGE === */
.about-content {
    max-width: 700px;
    margin: 2rem auto;
    padding: 0 2rem;
}

.about-content h2 {
    font-size: 1.2rem;
    margin: 2rem 0 0.75rem;
}

.about-content p {
    margin-bottom: 1rem;
    color: var(--text);
    line-height: 1.7;
}

.stats-bar {
    display: flex;
    justify-content: center;
    gap: 3rem;
    padding: 2rem;
    flex-wrap: wrap;
}

.stat-item {
    text-align: center;
}

.stat-number {
    font-size: 2rem;
    font-weight: 700;
    color: var(--accent);
    display: block;
}

.stat-label {
    font-family: var(--font-mono);
    font-size: 0.7rem;
    letter-spacing: 1px;
    text-transform: uppercase;
    color: var(--text-light);
}

/* === LOADER / EMPTY === */
.loader {
    text-align: center;
    padding: 2rem;
    color: var(--text-light);
}

.spinner {
    width: 30px;
    height: 30px;
    border: 3px solid var(--border);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin: 0 auto 0.5rem;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* Loader treno */
.train-loader {
    position: fixed; top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(240,235,227,0.92);
    z-index: 999;
    display: flex; flex-direction: column;
    align-items: center; justify-content: center;
    gap: 1rem;
}
.train-loader.hidden { display: none; }

.train-track {
    width: 200px; height: 4px; background: var(--border); border-radius: 2px;
    position: relative; overflow: visible;
}
.train-icon {
    position: absolute; top: -14px;
    animation: trainMove 2s ease-in-out infinite;
    font-size: 1.4rem; line-height: 1;
}
@keyframes trainMove {
    0% { left: -20px; }
    50% { left: 180px; }
    100% { left: -20px; }
}
.train-track::before {
    content: '';
    position: absolute; top: 50%; left: 0; right: 0;
    height: 1px; background: repeating-linear-gradient(90deg, var(--text-light) 0, var(--text-light) 6px, transparent 6px, transparent 12px);
}
.train-loader-text {
    font-family: var(--font-mono); font-size: 0.82rem;
    color: var(--text-light); letter-spacing: 0.5px;
}

.empty-state {
    text-align: center;
    padding: 3rem 2rem;
    color: var(--text-light);
}

/* === RESPONSIVE === */
@media (max-width: 768px) {
    .nav { padding: 0 1rem; }
    .nav-links { gap: 1rem; font-size: 0.78rem; }
    .hero-tagline { font-size: 1.5rem; }
    .hero-logo { width: 120px; height: 120px; }
    .atlas-container { flex-direction: column; }
    .atlas-sidebar { width: 100%; min-width: 100%; max-height: 40vh; }
    .atlas-map { min-height: 60vh; }
    .video-panel { width: 100%; }
    .stats-bar { gap: 1.5rem; }
}
