/*
 * vgp-lines.css – Fahrpläne & Linien
 * Verwendet CSS-Variablen aus dem VGP-Stylesheet.
 * Olaf: Bitte die Hex-Werte unten aus dem aktuellen VGP-Stylesheet übernehmen.
 */

:root {
    --vgp-primary:      #3e8394;
    --vgp-primary-dark: #246b7c;
    --vgp-accent:       #a7bf29;
    --vgp-text:         #111111;
    --vgp-muted:        #687078;
    --vgp-border:       #dbe4e8;
    --vgp-background:   #ffffff;
    --vgp-selected:     #edf7f7;
    --vgp-radius:       6px;
    --vgp-shadow:       0 1px 4px rgba(0,0,0,.08);
}

/* ─── Filter-Leiste ─────────────────────────────────────────────────────── */

.vgp-lines-filter {
    display: flex;
    flex-wrap: nowrap;
    gap: 8px;
    align-items: flex-end;
    padding: 0 0 12px;
}

.vgp-lines-filter-label {
    display: block;
    font-size: .75rem;
    font-weight: 600;
    letter-spacing: .04em;
    color: var(--vgp-muted);
    margin-bottom: 6px;
}

/* Suchfelder */
#searchbox > .e-con-inner > div:first-of-type {width: 100%}
.vgp-lines-search,
.vgp-lines-stop-search {
    flex: 0 0 auto;
    width: 302px;
    min-width: 0;
}

.vgp-lines-search .vgp-input-wrapper,
.vgp-lines-stop-search .vgp-input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.vgp-search-icon {
    position: absolute;
    left: 10px;
    color: var(--vgp-muted);
    pointer-events: none;
    display: flex;
    align-items: center;
}

.vgp-lines-search-input,
.vgp-stop-search-input {
    width: 100%;
    padding: 9px 10px 9px 34px;
    border: 1.5px solid var(--vgp-border);
    border-radius: var(--vgp-radius);
    font-size: .9rem;
    color: var(--vgp-text);
    background: var(--vgp-background);
    transition: border-color .15s;
    appearance: none;
}

.vgp-lines-search-input:focus,
.vgp-stop-search-input:focus {
    outline: none;
    border-color: var(--vgp-primary);
    box-shadow: 0 0 0 3px rgba(62, 131, 148, .15);
}

.vgp-lines-search-input::placeholder,
.vgp-stop-search-input::placeholder {
    color: var(--vgp-muted);
}

/* Kategorie-Filter */
.vgp-lines-category-filter {
    flex: 1 1 auto;
    min-width: 0;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    margin-left: auto;
}

.vgp-lines-filter-btns {
    display: flex;
    flex-wrap: nowrap;
    gap: 6px;
    margin-left: auto;
}

.vgp-lines-filter-btn {
    padding: 7px 16px;
    border: 1.5px solid var(--vgp-primary);
    border-radius: var(--vgp-radius);
    background: var(--vgp-background);
    color: var(--vgp-primary);
    font-size: .85rem;
    cursor: pointer;
    transition: background .15s, border-color .15s, color .15s;
    white-space: nowrap;
}

.vgp-lines-filter-btn:hover {
    background: rgba(62, 131, 148, .08);
}

.vgp-lines-filter-btn.is-active {
    background: var(--vgp-primary);
    border-color: var(--vgp-primary);
    color: #fff;
}

.vgp-filter-icon-btn {
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 46px;
    height: 46px;
    border: 1.5px solid var(--vgp-border);
    border-radius: var(--vgp-radius);
    background: var(--vgp-background);
    color: var(--vgp-primary);
    cursor: pointer;
    transition: border-color .15s, color .15s;
}

.vgp-filter-icon-btn:hover {
    border-color: var(--vgp-primary);
    color: var(--vgp-primary);
}

.vgp-lines-category-filter .vgp-lines-filter-label {
    display: none;
}

/* ─── Zweispaltiges Haupt-Grid ──────────────────────────────────────────── */

.vgp-lines-grid {
    display: grid;
    grid-template-columns: 48fr 52fr;
    gap: 20px;
    align-items: start;
}

@media (max-width: 768px) {
    .vgp-lines-grid {
        grid-template-columns: 1fr;
        gap: 0;
    }
}

/* ─── Linke Spalte – Linienliste ────────────────────────────────────────── */

.vgp-lines-list {
    border: 1px solid var(--vgp-border);
    border-radius: var(--vgp-radius);
    background: var(--vgp-background);
    overflow: hidden;
}

.vgp-lines-list-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    border-bottom: 1px solid var(--vgp-border);
    background: #f8fafb;
}

.vgp-lines-list-title {
    font-size: .9rem;
    font-weight: 600;
    color: var(--vgp-text);
}

.vgp-lines-list-count {
    font-size: .8rem;
    font-weight: 600;
    background: var(--vgp-primary);
    color: #fff;
    padding: 2px 8px;
    border-radius: 12px;
    min-width: 24px;
    text-align: center;
}

.vgp-lines-list-body {
    max-height: 600px;
    overflow-y: auto;
    scroll-behavior: smooth;
}

/* Einzelne Linienzeile */
.vgp-line-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    border-bottom: 1px solid var(--vgp-border);
    transition: background .12s;
    cursor: default;
}

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

.vgp-line-row:hover {
    background: #f3fbfc;
}

.vgp-line-row.is-selected {
    background: var(--vgp-selected);
    border-left: 3px solid var(--vgp-primary);
}

.vgp-line-row.is-hidden {
    display: none;
}

/* Liniennummer */
.vgp-line-number {
    flex-shrink: 0;
    width: 48px;
    text-align: center;
}

.vgp-line-number span {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: .875rem;
    font-weight: 700;
    color: #fff;
    background: var(--vgp-primary);
    border-radius: 6px;
    padding: 4px 6px;
    min-width: 40px;
    min-height: 32px;
}

/* Linienbezeichnung */
.vgp-line-title {
    flex: 1 1 0;
    font-size: .875rem;
    color: var(--vgp-text);
    line-height: 1.35;
    min-width: 0;
    overflow: hidden;
}

.vgp-line-type-badge {
    display: inline-block;
    font-size: .7rem;
    padding: 1px 5px;
    border-radius: 3px;
    margin-left: 4px;
    vertical-align: middle;
    font-weight: 500;
}

.vgp-type-stadtverkehr   { background: #e8f4fd; color: #1565c0; }
.vgp-type-regionalverkehr { background: #e8f7ed; color: #2e7d32; }
.vgp-type-rufbus         { background: #fff3e0; color: #e65100; }
.vgp-type-schulverkehr   { background: #fce4ec; color: #c62828; }

.vgp-line-row .vgp-line-type-badge { display: none; }

/* Aktionen in der Zeile */
.vgp-line-actions {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
}

.vgp-line-schedule,
.vgp-line-pdf {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: .78rem;
    padding: 4px 10px;
    border-radius: var(--vgp-radius);
    text-decoration: none;
    font-weight: 500;
    white-space: nowrap;
    transition: background .12s, color .12s;
}

.vgp-line-schedule {
    color: var(--vgp-primary);
    border: 1px solid var(--vgp-primary);
}

.vgp-line-schedule:hover {
    background: var(--vgp-primary);
    color: #fff;
}

.vgp-line-pdf {
    color: var(--vgp-muted);
    border: 1px solid var(--vgp-border);
}

.vgp-line-pdf:hover {
    background: var(--vgp-muted);
    color: #fff;
}

.vgp-line-select {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: .78rem;
    padding: 4px 10px;
    border-radius: var(--vgp-radius);
    border: none;
    background: var(--vgp-primary);
    color: #fff;
    cursor: pointer;
    font-weight: 600;
    transition: background .12s;
    white-space: nowrap;
}

.vgp-line-select:hover {
    background: var(--vgp-primary-dark);
}

.vgp-line-row.is-selected .vgp-line-select {
    background: var(--vgp-primary-dark);
}

/* Kein Ergebnis */
.vgp-lines-no-results {
    padding: 24px;
    text-align: center;
    color: var(--vgp-muted);
    font-size: .9rem;
}

/* ─── Rechte Spalte – Line Preview ─────────────────────────────────────── */

.vgp-line-preview {
    border: 1px solid var(--vgp-border);
    border-radius: var(--vgp-radius);
    background: var(--vgp-background);
    padding: 24px;
    box-shadow: var(--vgp-shadow);
    position: sticky;
    top: 80px;
}

/* Platzhalter wenn keine Linie gewählt */
.vgp-line-preview-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px 20px;
    text-align: center;
    color: var(--vgp-muted);
}

.vgp-line-preview-placeholder p {
    margin-top: 16px;
    font-size: .9rem;
    line-height: 1.5;
}

/* Lade-Spinner */
.vgp-line-preview-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 32px 20px;
    color: var(--vgp-muted);
    font-size: .9rem;
}

.vgp-loading-spinner {
    width: 20px;
    height: 20px;
    border: 2.5px solid var(--vgp-border);
    border-top-color: var(--vgp-primary);
    border-radius: 50%;
    animation: vgp-spin .7s linear infinite;
    flex-shrink: 0;
}

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

/* Preview-Kopfbereich */
.vgp-line-header {
    margin-bottom: 20px;
}

.vgp-line-preview-label {
    display: inline-block;
    font-size: .7rem;
    font-weight: 600;
    letter-spacing: .06em;
    text-transform: uppercase;
    color: var(--vgp-primary);
    background: rgba(62,131,148,.1);
    border: 1px solid rgba(62,131,148,.25);
    border-radius: 12px;
    padding: 2px 10px;
    margin-bottom: 10px;
}

.vgp-line-preview-title {
    display: flex;
    align-items: baseline;
    gap: 10px;
    flex-wrap: wrap;
    margin-bottom: 8px;
}

.vgp-line-preview-number {
	font-size: 1.3rem;
	font-weight: 800;
	color: #fff;
	line-height: 1;
	background: var(--vgp-primary);
	padding: 8px 11px;
	border-radius: 6px;
}

.vgp-line-preview-name {
    font-size: 1.05rem;
    font-weight: 600;
    color: var(--vgp-text);
    line-height: 1.3;
}

.vgp-line-preview-meta {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    margin-bottom: 16px;
    font-size: .85rem;
    color: var(--vgp-muted);
}

.vgp-line-operating-days {
    display: inline-flex;
    align-items: center;
    gap: 5px;
}

.vgp-line-operating-days::before {
    content: '';
    display: inline-block;
    width: 13px;
    height: 13px;
    flex-shrink: 0;
    background-repeat: no-repeat;
    background-size: contain;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='none' stroke='%23687078' stroke-width='1.5' stroke-linecap='round'%3E%3Crect x='2' y='3' width='12' height='11' rx='2'/%3E%3Cline x1='5' y1='1.5' x2='5' y2='4'/%3E%3Cline x1='11' y1='1.5' x2='11' y2='4'/%3E%3Cline x1='2' y1='7' x2='14' y2='7'/%3E%3C/svg%3E");
}

.vgp-line-type-tag {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: .75rem;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 12px;
    background: var(--vgp-selected);
    color: var(--vgp-primary);
}

.vgp-line-type-tag.is-regionalverkehr::before {
    content: '';
    display: inline-block;
    width: 12px;
    height: 12px;
    flex-shrink: 0;
    background-repeat: no-repeat;
    background-size: contain;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='none' stroke='%233e8394' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='1' y='3' width='14' height='9' rx='2'/%3E%3Cline x1='1' y1='7' x2='15' y2='7'/%3E%3Cline x1='5.5' y1='3' x2='5.5' y2='7'/%3E%3Cline x1='10.5' y1='3' x2='10.5' y2='7'/%3E%3Ccircle cx='4' cy='13.5' r='1.5' fill='%233e8394' stroke='none'/%3E%3Ccircle cx='12' cy='13.5' r='1.5' fill='%233e8394' stroke='none'/%3E%3C/svg%3E");
}

.vgp-line-preview-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-bottom: 20px;
}

/* ─── Buttons ───────────────────────────────────────────────────────────── */

.vgp-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 9px 18px;
    border-radius: var(--vgp-radius);
    font-size: .875rem;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    border: none;
    transition: background .15s, color .15s, border-color .15s;
    white-space: nowrap;
}

.vgp-btn--primary {
    background: var(--vgp-primary);
    color: #fff;
}

.vgp-btn--primary:hover {
    background: var(--vgp-primary-dark);
    color: #fff;
}

.vgp-btn--secondary {
    background: transparent;
    color: var(--vgp-primary);
    border: 1.5px solid var(--vgp-primary);
}

.vgp-btn--secondary:hover {
    background: var(--vgp-primary);
    color: #fff;
}

.vgp-btn--pdf {
    background: transparent;
    color: var(--vgp-muted);
    border: 1.5px solid var(--vgp-border);
}

.vgp-btn--pdf:hover {
    border-color: var(--vgp-muted);
    color: var(--vgp-text);
}

/* ─── Schnellinfos ──────────────────────────────────────────────────────── */

.vgp-line-quickfacts {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1px;
    background: var(--vgp-border);
    border: 1px solid var(--vgp-border);
    border-radius: var(--vgp-radius);
    overflow: hidden;
    margin-bottom: 20px;
}

.vgp-quickfact {
    background: var(--vgp-background);
    padding: 12px 14px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.vgp-quickfact-label {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: .72rem;
    font-weight: 600;
    letter-spacing: .04em;
    text-transform: uppercase;
    color: var(--vgp-muted);
}

.vgp-quickfact-label::before {
    content: '';
    display: inline-block;
    width: 12px;
    height: 12px;
    flex-shrink: 0;
    background-repeat: no-repeat;
    background-size: contain;
}

/* Sonnenaufgang: erste Abfahrt */
.vgp-quickfact:has([data-field="first_departure"]) .vgp-quickfact-label::before {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='none' stroke='%23687078' stroke-width='1.5' stroke-linecap='round'%3E%3Cpath d='M3 11a5 5 0 0 1 10 0'/%3E%3Cline x1='8' y1='1.5' x2='8' y2='3'/%3E%3Cline x1='12' y1='3.5' x2='11' y2='4.5'/%3E%3Cline x1='4' y1='3.5' x2='5' y2='4.5'/%3E%3Cline x1='14' y1='11' x2='2' y2='11'/%3E%3C/svg%3E");
}

/* Mond: letzte Abfahrt */
.vgp-quickfact:has([data-field="last_departure"]) .vgp-quickfact-label::before {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='none' stroke='%23687078' stroke-width='1.5' stroke-linecap='round'%3E%3Cpath d='M11.5 11.5A5.5 5.5 0 1 1 6 3a4.5 4.5 0 0 0 5.5 8.5z'/%3E%3C/svg%3E");
}

/* Stoppuhr: Fahrtdauer */
.vgp-quickfact:has([data-field="duration"]) .vgp-quickfact-label::before {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='none' stroke='%23687078' stroke-width='1.5' stroke-linecap='round'%3E%3Ccircle cx='8' cy='9.5' r='5'/%3E%3Cline x1='8' y1='2' x2='8' y2='4.5'/%3E%3Cline x1='5.5' y1='1.5' x2='10.5' y2='1.5'/%3E%3Cline x1='8' y1='9.5' x2='8' y2='7'/%3E%3Cline x1='8' y1='9.5' x2='10.5' y2='9.5'/%3E%3C/svg%3E");
}

.vgp-quickfact-value {
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--vgp-text);
}

/* ─── Streckenverlauf ───────────────────────────────────────────────────── */

/* Bus-Haltestellen-Icon im Goto-Button */
.vgp-goto-stops::before {
    content: '';
    display: inline-block;
    width: 14px;
    height: 14px;
    flex-shrink: 0;
    background-repeat: no-repeat;
    background-size: contain;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='none' stroke='%233e8394' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cline x1='5' y1='2' x2='5' y2='14'/%3E%3Crect x='5' y='3' width='8' height='5' rx='1.5'/%3E%3C/svg%3E");
}

/* ─── Streckenverlauf ───────────────────────────────────────────────────── */

.vgp-line-route {
    margin-bottom: 20px;
}

.vgp-line-route-header {
    font-size: .75rem;
    font-weight: 700;
    letter-spacing: .06em;
    text-transform: uppercase;
    color: var(--vgp-muted);
    margin-bottom: 10px;
}

/* Haltestellen als kompakte vertikale Liste (wie vgp-inter-stops auf der Startseite) */
.vgp-route-stops {
    margin-top: .2rem;
    padding: .3rem .5rem;
    background: rgba(62,131,148,.06);
    border-radius: 4px;
}

.vgp-route-stop {
    display: flex;
    align-items: center;
    gap: .55rem;
    padding: .18rem 0;
    font-size: .82rem;
    color: #444;
}

.vgp-route-stop-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--vgp-border);
    flex-shrink: 0;
}

/* Erste und letzte Haltestelle hervorheben */
.vgp-route-stop.is-start,
.vgp-route-stop.is-end {
    font-weight: 600;
    color: var(--vgp-primary);
}

.vgp-route-stop.is-start .vgp-route-stop-dot,
.vgp-route-stop.is-end .vgp-route-stop-dot {
    background: var(--vgp-primary);
}

/* Toggle-Button für Zwischenstationen */
.vgp-route-toggle {
    background: transparent;
    border: none;
    color: var(--vgp-primary);
    font-size: .8rem;
    font-family: inherit;
    font-weight: 600;
    cursor: pointer;
    padding: .2rem 0 .1rem .35rem;
    display: inline-flex;
    align-items: center;
    gap: .15rem;
}

.vgp-route-toggle-chevron {
    display: inline-block;
    font-size: .7rem;
    transition: transform .2s;
}

.vgp-route-loading {
    font-size: .85rem;
    color: var(--vgp-muted);
}

.vgp-no-live-notice {
    font-size: .82rem;
    color: var(--vgp-muted);
    background: #f5f7f8;
    border-left: 3px solid var(--vgp-border);
    border-radius: 0 4px 4px 0;
    padding: 6px 10px;
    margin: 4px 0 0;
}

/* ─── Aktionskarten ─────────────────────────────────────────────────────── */

.vgp-line-action-cards {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    margin-top: 16px;
}

.vgp-action-card {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 0;
    padding: 14px 14px 12px;
    border: 1.5px solid var(--vgp-border);
    border-radius: var(--vgp-radius);
    background: var(--vgp-background);
    color: var(--vgp-text);
    text-decoration: none;
    cursor: pointer;
    transition: border-color .12s, background .12s;
    text-align: left;
    width: 100%;
    box-sizing: border-box;
}

.vgp-action-card:hover {
    border-color: var(--vgp-primary);
    background: var(--vgp-selected);
}

.vgp-action-card-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 6px;
    background: rgba(62, 131, 148, .1);
    color: var(--vgp-primary);
    margin-bottom: 10px;
    flex-shrink: 0;
}

.vgp-action-card-title {
    font-size: .85rem;
    font-weight: 700;
    color: var(--vgp-text);
    line-height: 1.2;
    margin-bottom: 4px;
}

.vgp-action-card-desc {
    font-size: .75rem;
    color: var(--vgp-muted);
    line-height: 1.4;
    flex: 1;
    margin-bottom: 8px;
}

.vgp-action-card-link {
    font-size: .78rem;
    font-weight: 600;
    color: var(--vgp-primary);
    margin-top: auto;
}

/* ─── PDF-Widget ────────────────────────────────────────────────────────── */

.vgp-line-pdf-widget {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.vgp-pdf-hint {
    font-size: .75rem;
    color: var(--vgp-muted);
    margin-left: 2px;
}

/* ─── Mobile Anpassung ──────────────────────────────────────────────────── */

@media (max-width: 768px) {
    .vgp-lines-filter {
        flex-direction: column;
        gap: 10px;
    }

    .vgp-lines-search,
    .vgp-lines-stop-search {
        flex: 1 1 100%;
        max-width: none;
    }

    .vgp-lines-filter-btns {
        flex-wrap: wrap;
    }

    /* Aktionen in Linienzeile komprimieren */
    .vgp-line-row {
        padding: 8px 10px;
        gap: 8px;
    }

    .vgp-line-schedule span,
    .vgp-line-schedule { font-size: 0; } /* Text verstecken */
    .vgp-line-schedule::after { content: '▶'; font-size: .78rem; }

    .vgp-line-quickfacts {
        grid-template-columns: 1fr 1fr;
    }

    .vgp-line-quickfacts .vgp-quickfact:last-child {
        grid-column: 1 / -1;
    }

    .vgp-line-preview {
        position: static;
        margin-top: 16px;
    }

    .vgp-route-stops {
        gap: 0;
    }

    .vgp-line-action-cards {
        grid-template-columns: 1fr 1fr;
    }

    .vgp-line-preview-number {
        font-size: 1.4rem;
    }
}

@media (min-width: 769px) {
    .vgp-lines-list-body {
        max-height: 70vh;
    }
}

/* ─── Zustände & Utilities ──────────────────────────────────────────────── */

.vgp-error,
.vgp-info {
    padding: 10px 14px;
    border-radius: var(--vgp-radius);
    font-size: .875rem;
}

.vgp-error { background: #fff3f3; color: #c62828; border: 1px solid #ffcdd2; }
.vgp-info  { background: #f0f7ff; color: #1565c0; border: 1px solid #bbdefb; }
