/* RitRadar Dashboard styles — ReisWijs brand palette */

@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@400;500;600;700&display=swap');

:root {
    /* ReisWijs brand */
    --rw-primary: #2744a0;
    --rw-secondary: #ec008c;
    --rw-green: #68e29f;
    --rw-blue: #4f90ff;
    --rw-purple: #ce70fc;
    --rw-yellow: #ffe450;

    /* Dashboard mappings */
    --version-a: var(--rw-green);
    --version-b: var(--rw-purple);
    --accent: var(--rw-blue);
    --accent-secondary: var(--rw-secondary);

    /* Text & surface */
    --text-primary: #e9ecef;
    --text-secondary: #b0b8c1;
    --text-muted: #7e8a96;
    --bg-body: #131720;
    --bg-card: #1a1f2b;
    --bg-card-header: rgba(79, 144, 255, 0.06);
    --bg-hover: rgba(79, 144, 255, 0.08);
    --border-subtle: rgba(79, 144, 255, 0.12);
}

body {
    font-family: 'Poppins', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    font-size: 0.88rem;
    color: var(--text-primary);
    background: var(--bg-body) !important;
}

.text-secondary {
    color: var(--text-secondary) !important;
}
.text-muted {
    color: var(--text-muted) !important;
}

/* Version badges */
.version-badge-a { background: var(--version-a) !important; color: #0d1117; font-weight: 600; }
.version-badge-b { background: var(--version-b) !important; color: #fff; font-weight: 600; }

/* Modality tag */
.modality-tag {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    padding: 2px 8px;
    border-radius: 6px;
    font-size: 0.78em;
    background: rgba(79, 144, 255, 0.1);
    color: var(--text-primary);
    white-space: nowrap;
}

/* Cards */
.card {
    border-color: var(--border-subtle);
    background: var(--bg-card);
    border-radius: 8px;
}

.card-header {
    font-size: 0.82rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--text-secondary);
    background: var(--bg-card-header);
    border-bottom-color: var(--border-subtle);
}

/* Table tweaks */
.table {
    font-size: 0.84rem;
    color: var(--text-primary);
}

.table thead th {
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    border-bottom: 1px solid var(--border-subtle);
    font-weight: 600;
}

.table td {
    border-color: rgba(79, 144, 255, 0.06);
    color: var(--text-primary);
}

.table-hover > tbody > tr:hover {
    background-color: var(--bg-hover);
}

/* Journey rows */
.journey-row {
    cursor: pointer;
    transition: background 0.2s ease;
}
.journey-row:hover {
    background: rgba(79, 144, 255, 0.12) !important;
}
.journey-row:hover td {
    color: #fff !important;
}

/* Score display in list */
.score-pill {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 0.75em;
    font-weight: 600;
    min-width: 36px;
    text-align: center;
}
.score-pill-good { background: rgba(104, 226, 159, 0.18); color: var(--rw-green); }
.score-pill-mid  { background: rgba(255, 228, 80, 0.18); color: var(--rw-yellow); }
.score-pill-bad  { background: rgba(236, 0, 140, 0.18); color: var(--rw-secondary); }
.score-pill-none { background: rgba(255, 255, 255, 0.05); color: var(--text-muted); }

/* Sort header */
.sortable {
    cursor: pointer;
    user-select: none;
}
.sortable:hover {
    color: var(--text-primary) !important;
}
.sort-arrow {
    font-size: 0.7em;
    margin-left: 3px;
    opacity: 0.5;
}
.sort-arrow.active {
    opacity: 1;
    color: var(--accent);
}

/* Score buttons */
.score-btn {
    width: 44px;
    height: 44px;
    font-size: 1.1em;
    font-weight: 600;
    border-color: var(--accent) !important;
    color: var(--accent) !important;
}

.score-btn:hover {
    background: rgba(79, 144, 255, 0.15) !important;
}

.score-btn.active {
    background: var(--accent) !important;
    color: #0d1117 !important;
    border-color: var(--accent) !important;
}

/* Primary buttons */
.btn-info {
    background: var(--accent) !important;
    border-color: var(--accent) !important;
    color: #fff !important;
}
.btn-info:hover {
    background: #3a7de6 !important;
    border-color: #3a7de6 !important;
}
.btn-outline-info {
    color: var(--accent) !important;
    border-color: var(--accent) !important;
}
.btn-outline-info:hover {
    background: var(--accent) !important;
    color: #fff !important;
}

/* Comment bubbles */
.comment-bubble {
    border-left: 3px solid var(--accent);
    padding: 8px 12px;
    margin-bottom: 8px;
    background: rgba(79, 144, 255, 0.04);
    border-radius: 0 8px 8px 0;
    color: var(--text-primary);
}

/* Version panels */
.version-panel {
    border-top: 3px solid;
    border-radius: 8px;
}

.version-panel-a { border-color: var(--version-a); }
.version-panel-b { border-color: var(--version-b); }

/* Map */
#map,
.map-panel {
    height: 420px;
    min-height: 300px;
    border-radius: 0 0 8px 8px;
}
#map {
    height: 450px;
}

/* Sticky filter bar */
.filter-bar {
    position: sticky;
    top: 0;
    z-index: 10;
    border-color: var(--border-subtle) !important;
    background: var(--bg-body) !important;
}

/* Commit info */
.commit-mono {
    font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, monospace;
    font-size: 0.8em;
}

/* Correction badge */
.correction-badge {
    font-size: 0.75em;
    padding: 2px 6px;
    border-radius: 4px;
}

/* Login page */
.card.border-info {
    border-color: var(--accent) !important;
}

/* Responsive map heights */
@media (max-width: 768px) {
    .map-panel,
    #map {
        height: 300px;
    }
}

/* Leaflet tooltip override for dark theme */
.leaflet-tooltip {
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    color: var(--text-primary);
    border-radius: 6px;
    font-size: 0.8rem;
    padding: 5px 10px;
    font-family: 'Poppins', sans-serif;
}

.leaflet-tooltip::before {
    border-top-color: var(--border-subtle);
}

/* Leaflet popup override */
.leaflet-popup-content-wrapper {
    background: var(--bg-card);
    color: var(--text-primary);
    border-radius: 8px;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.5);
    font-family: 'Poppins', sans-serif;
}

.leaflet-popup-content {
    margin: 10px 14px;
    font-size: 0.82rem;
    line-height: 1.5;
}

.leaflet-popup-tip {
    background: var(--bg-card);
}

.leaflet-popup-close-button {
    color: var(--text-muted) !important;
}

/* Navbar */
.navbar {
    background: var(--bg-card) !important;
    border-bottom: 1px solid var(--border-subtle) !important;
}

.navbar-brand {
    font-family: 'Poppins', sans-serif;
    font-weight: 700;
    letter-spacing: -0.02em;
}

.nav-link.active {
    color: var(--accent) !important;
}

/* Form controls in dark theme */
.form-control, .form-select {
    color: var(--text-primary);
    background: rgba(79, 144, 255, 0.05);
    border-color: var(--border-subtle);
}
.form-control:focus, .form-select:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 0.2rem rgba(79, 144, 255, 0.2);
}

/* Alert text */
.alert {
    color: var(--text-primary);
}

/* Relative timestamp styling */
time.relative-time {
    cursor: help;
    border-bottom: 1px dotted var(--text-muted);
}

/* Version history timeline */
.version-timeline {
    list-style: none;
    padding: 0;
    margin: 0;
}
.version-timeline li {
    position: relative;
    padding: 6px 0 6px 20px;
    border-left: 2px solid var(--border-subtle);
    font-size: 0.8rem;
}
.version-timeline li::before {
    content: '';
    position: absolute;
    left: -5px;
    top: 12px;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--text-muted);
}
.version-timeline li.active::before {
    background: var(--accent);
}
.version-timeline li.at-creation::before {
    background: var(--rw-yellow);
}
.version-timeline .commit-hash {
    font-family: 'SFMono-Regular', Consolas, monospace;
    font-size: 0.75em;
    color: var(--accent);
}

/* Segment time cell */
.seg-time {
    white-space: nowrap;
    font-size: 0.8rem;
}
.seg-time .time-arrow {
    color: var(--text-muted);
    margin: 0 2px;
}
.seg-time .seg-date {
    font-size: 0.68rem;
    color: var(--text-muted);
}

/* Segment detail row (expandable) */
.seg-detail-row {
    background: rgba(79, 144, 255, 0.03);
}
.seg-detail-row td {
    padding: 8px 12px !important;
    border: none !important;
}
.dl-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 6px 16px;
}
.dl-label {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--text-muted);
    font-weight: 600;
}
.dl-value {
    font-size: 0.82rem;
    color: var(--text-primary);
}

/* Badge overrides for brand */
.badge.bg-secondary {
    background: rgba(79, 144, 255, 0.15) !important;
    color: var(--accent) !important;
}
.badge.bg-warning {
    background: rgba(255, 228, 80, 0.2) !important;
    color: var(--rw-yellow) !important;
}
.badge.bg-success {
    background: rgba(104, 226, 159, 0.2) !important;
    color: var(--rw-green) !important;
}

/* Recent trip highlight */
.recent-trip td:first-child::after {
    content: ' \231B';
    font-size: .7em;
}

/* Invalid/flagged trips in list */
.opacity-50 { opacity: 0.5; }

/* Scrollbar styling */
::-webkit-scrollbar { width: 8px; }
::-webkit-scrollbar-track { background: var(--bg-body); }
::-webkit-scrollbar-thumb { background: rgba(79, 144, 255, 0.2); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: rgba(79, 144, 255, 0.35); }
