/* ---- Fonts (self-hosted, wie next.telematiclink.de) ---- */

@font-face {
    font-family: 'Inter';
    font-style: normal;
    font-weight: 100 900;
    font-display: swap;
    src: url("../fonts/inter-latin.woff2") format('woff2');
    unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
    font-family: 'Inter';
    font-style: normal;
    font-weight: 100 900;
    font-display: swap;
    src: url("../fonts/inter-latin-ext.woff2") format('woff2');
    unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

@font-face {
    font-family: 'Space Grotesk';
    font-style: normal;
    font-weight: 300 700;
    font-display: swap;
    src: url("../fonts/space-grotesk-latin.woff2") format('woff2');
    unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
    font-family: 'Space Grotesk';
    font-style: normal;
    font-weight: 300 700;
    font-display: swap;
    src: url("../fonts/space-grotesk-latin-ext.woff2") format('woff2');
    unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

@font-face {
    font-family: 'JetBrains Mono';
    font-style: normal;
    font-weight: 100 800;
    font-display: swap;
    src: url("../fonts/jetbrains-mono-latin.woff2") format('woff2');
    unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

/* ---- Design-Tokens (next.telematiclink.de) ---- */

:root {
    --tl-bg: #ffffff;
    --tl-bg-elev: #f5f7fa;
    --tl-line: #e5e9ee;
    --tl-line-strong: #d2d8e0;
    --tl-fg: #14181d;
    --tl-fg-muted: #5b6472;
    --tl-fg-dim: #8b93a0;
    --tl-accent: #2633CB;
    --tl-accent-soft: rgba(38, 51, 203, 0.08);
    --tl-warn: #ff7a3b;
    --tl-radius: 14px;
    --tl-radius-sm: 8px;
    --tl-font-display: 'Space Grotesk', 'Inter', system-ui, sans-serif;
    --tl-font-mono: 'JetBrains Mono', ui-monospace, monospace;
}

html, body {
    height: 100%;
    margin: 0;
    font-family: 'Inter', system-ui, sans-serif;
    color: var(--tl-fg);
    -webkit-font-smoothing: antialiased;
}

/* Dezenter Scrollbalken wie in der Vorlage */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--tl-line-strong); border-radius: 10px; }

#blazor-error-ui {
    background: lightyellow;
    bottom: 0;
    box-shadow: 0 -1px 2px rgba(0, 0, 0, 0.2);
    display: none;
    left: 0;
    padding: 0.6rem 1.25rem 0.7rem 1.25rem;
    position: fixed;
    width: 100%;
    z-index: 2000;
}

#blazor-error-ui .dismiss {
    cursor: pointer;
    position: absolute;
    right: 0.75rem;
    top: 0.5rem;
}

.main-content {
    height: 100vh;
    display: flex;
    flex-direction: column;
}

/* ---- App-Chrome: Leisten mit 1px-Linien statt Schatten ---- */

.tl-appbar {
    border-bottom: 1px solid var(--tl-line);
}

.tl-drawer {
    border-right: 1px solid var(--tl-line);
}

.tl-logo {
    width: 26px;
    height: 26px;
    display: block;
}

.tl-wordmark {
    font-family: var(--tl-font-display);
    font-weight: 600;
    font-size: 1.1rem;
    letter-spacing: -0.02em;
}

/* Pill-Chip (Benutzer in der AppBar, System-Name im Login) */
.tl-chip {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 4px 12px;
    border-radius: 999px;
    border: 1px solid var(--tl-line-strong);
    font-family: var(--tl-font-mono);
    font-size: 12px;
    color: var(--tl-fg-muted);
    white-space: nowrap;
}

.tl-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--tl-accent);
    flex: none;
}

.tl-pulse { animation: tl-pulse 2s ease-in-out infinite; }

@keyframes tl-pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.4; }
}

/* Navigation: abgerundete Links, aktiver Eintrag im Akzentton */
.tl-drawer .mud-nav-menu { padding: 8px; }

.tl-drawer .mud-nav-link {
    border-radius: var(--tl-radius-sm);
    margin-bottom: 2px;
    color: var(--tl-fg-muted);
}

.tl-drawer .mud-nav-link:hover {
    background: var(--tl-bg-elev);
}

.tl-drawer .mud-nav-link.active {
    background: var(--tl-accent-soft);
    color: var(--tl-accent);
    font-weight: 600;
}

.tl-drawer .mud-nav-link.active .mud-nav-link-icon {
    color: var(--tl-accent);
}

/* ---- Login (Hero-Look der Vorlage) ---- */

.tl-login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    background: var(--tl-bg);
    padding: 20px;
}

/* Subtiles Grid-Muster wie auf der Landingpage */
.tl-grid-bg {
    position: absolute;
    inset: 0;
    pointer-events: none;
    background-image:
        linear-gradient(to right, rgba(0, 0, 0, 0.035) 1px, transparent 1px),
        linear-gradient(to bottom, rgba(0, 0, 0, 0.035) 1px, transparent 1px);
    background-size: 64px 64px;
    -webkit-mask-image: radial-gradient(ellipse at center, rgba(0, 0, 0, 0.6), transparent 70%);
    mask-image: radial-gradient(ellipse at center, rgba(0, 0, 0, 0.6), transparent 70%);
}

.tl-login-card {
    position: relative;
    width: 100%;
    max-width: 420px;
    background: var(--tl-bg);
    border: 1px solid var(--tl-line);
    border-radius: var(--tl-radius);
    padding: 36px 32px 28px 32px;
}

.tl-login-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 6px;
}

.tl-login-brand .tl-logo {
    width: 38px;
    height: 38px;
}

.tl-login-title {
    font-family: var(--tl-font-display);
    font-weight: 600;
    font-size: 1.5rem;
    letter-spacing: -0.02em;
    line-height: 1.05;
    margin: 0;
}

.tl-eyebrow {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-family: var(--tl-font-mono);
    font-size: 12px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--tl-fg-muted);
    margin-bottom: 22px;
}

.tl-eyebrow::before {
    content: '';
    width: 6px;
    height: 6px;
    background: var(--tl-accent);
    border-radius: 50%;
    animation: tl-pulse 2s ease-in-out infinite;
}

/* Pill-Button (Primary) wie .btn-primary der Vorlage */
.tl-btn-pill {
    border-radius: 999px !important;
    transition: transform 0.15s ease, box-shadow 0.15s ease !important;
}

.tl-btn-pill:hover:not(:disabled) {
    transform: translateY(-1px);
    box-shadow: 0 8px 30px -8px var(--tl-accent);
}

/* ---- Tabellen / DataGrid ---- */

/* Spaltenköpfe im Mono-Eyebrow-Stil der Vorlage */
.mud-table-head th,
.mud-table-head .mud-table-cell {
    font-family: var(--tl-font-mono);
    font-size: 11px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    color: var(--tl-fg-muted);
}

.tl-activity-badge {
    display: inline-block;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    margin-right: 6px;
    vertical-align: middle;
    border: 1px solid rgba(0, 0, 0, 0.12);
}

.tl-pos-age {
    color: var(--tl-fg-dim);
    font-size: 0.75rem;
    margin-left: 4px;
}

.tl-activity-table {
    max-height: 32vh;
    overflow-y: auto;
}

.tl-row-clickable {
    cursor: pointer;
}

.tl-row-selected td {
    background-color: var(--tl-accent-soft);
    box-shadow: inset 3px 0 0 var(--tl-accent);
}

/* ---- Karte ---- */

.tl-map-page {
    display: flex;
    /* Dense-AppBar = 3/4 der Theme-Höhe (siehe .mud-appbar-dense ~ .mud-main-content) */
    height: calc(100vh - (var(--mud-appbar-height, 60px) - var(--mud-appbar-height, 60px) / 4));
}

.tl-map-sidebar {
    width: 280px;
    min-width: 280px;
    border-right: 1px solid var(--tl-line);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background: var(--tl-bg);
}

.tl-map-vehicle-list {
    overflow-y: auto;
    flex: 1;
}

.tl-map-main {
    position: relative;
    flex: 1;
}

.tl-leaflet-map {
    height: 100%;
    width: 100%;
    z-index: 0;
}

.tl-vehicle-card {
    position: absolute;
    top: 12px;
    right: 12px;
    width: 300px;
    z-index: 1000;
    border: 1px solid var(--tl-line) !important;
    border-radius: var(--tl-radius) !important;
}

.tl-playback-bar {
    position: absolute;
    bottom: 12px;
    left: 12px;
    right: 12px;
    z-index: 1000;
    border: 1px solid var(--tl-line) !important;
    border-radius: var(--tl-radius) !important;
}

/* ---- Marker ---- */

.tl-vehicle-marker, .tl-playback-marker {
    background: transparent;
    border: none;
}

.tl-marker-wrap {
    position: relative;
}

.tl-marker-label {
    position: absolute;
    top: 28px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(255, 255, 255, 0.9);
    border: 1px solid var(--tl-line);
    border-radius: 4px;
    padding: 0 5px;
    font-family: var(--tl-font-mono);
    font-size: 11px;
    font-weight: 500;
    white-space: nowrap;
    pointer-events: none;
}

.tl-marker-label-selected {
    background: var(--tl-accent);
    border-color: var(--tl-accent);
    color: #fff;
}

/* ---- Fleetview-Detail: Aktivitäten links, Karte rechts (nur breite Bildschirme) ---- */

.tl-fleet-detail {
    display: flex;
    gap: 12px;
}

.tl-fleet-detail-activities {
    flex: 1;
    min-width: 0;
}

.tl-fleet-detail-map {
    width: 45%;
    min-height: 300px;
    height: 34vh;
    border: 1px solid var(--tl-line);
    border-radius: var(--tl-radius-sm);
    overflow: hidden;
}

@media (max-width: 959px) {
    .tl-fleet-detail-map {
        display: none;
    }
}

/* ---- Nachrichten (Chat) ---- */

.tl-chat-page {
    display: flex;
    height: calc(100vh - (var(--mud-appbar-height, 60px) - var(--mud-appbar-height, 60px) / 4));
}

.tl-chat-sidebar {
    width: 300px;
    min-width: 300px;
    border-right: 1px solid var(--tl-line);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background: var(--tl-bg);
}

.tl-chat-group-list {
    overflow-y: auto;
    flex: 1;
}

.tl-chat-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.tl-chat-empty {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.tl-chat-header {
    border-bottom: 1px solid var(--tl-line);
    display: flex;
    align-items: center;
    gap: 12px;
}

.tl-chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.tl-chat-bubble-row {
    display: flex;
}

.tl-chat-bubble-row.tl-own {
    justify-content: flex-end;
}

.tl-chat-bubble {
    max-width: 70%;
    background: #fff;
    border: 1px solid var(--tl-line);
    border-radius: 10px 10px 10px 2px;
    padding: 6px 10px;
}

.tl-chat-bubble.tl-own {
    background: #e8ebff;
    border-radius: 10px 10px 2px 10px;
}

.tl-chat-bubble-header {
    font-size: 11px;
    color: var(--mud-palette-text-secondary, #666);
    margin-bottom: 2px;
}

.tl-chat-text {
    white-space: pre-wrap;
    word-break: break-word;
    font-size: 14px;
}

.tl-chat-thumb {
    max-width: 120px;
    max-height: 120px;
    border-radius: 4px;
    cursor: pointer;
    display: block;
}

.tl-chat-read {
    font-size: 11px;
    color: var(--mud-palette-text-secondary, #666);
    display: flex;
    align-items: center;
    gap: 2px;
    justify-content: flex-end;
}

.tl-chat-input {
    border-top: 1px solid var(--tl-line);
}

.tl-nav-badge {
    background: var(--mud-palette-error, #d32f2f);
    color: #fff;
    border-radius: 10px;
    font-size: 11px;
    font-weight: 600;
    padding: 1px 7px;
    margin-left: 8px;
}

/* ---- Geo-Suche ---- */

.tl-geo-sidebar {
    width: 320px;
    min-width: 320px;
}

.tl-geo-form {
    overflow-y: auto;
    flex-shrink: 0;
    max-height: 60%;
}

.tl-geo-pin {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 22px;
    height: 22px;
    border-radius: 50%;
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    flex-shrink: 0;
}
