/* ============================================================
   TaxiApp - arkusz stylów
   Kierunek: luxury / refined dark. Paleta: czerń + metaliczne złoto.
   Restyling pod ciemny motyw - nazwy klas bez zmian.
   ============================================================ */

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

/* --- Zmienne ------------------------------------------------- */
:root {
    /* tła - od najciemniejszego do najjaśniejszego */
    --ink:         #0f0f0f;   /* najgłębsza czerń - tło strony */
    --ink-soft:    #1a1a1a;   /* karty, panele */
    --surface:     #1a1a1a;   /* alias dla kart (zgodność z klasami) */
    --surface-2:   #232323;   /* elementy wyżej: nagłówki tabel, pola */
    --bg:          #0f0f0f;   /* tło strony */
    --line:        #2e2e2e;   /* obramowania */
    --line-soft:   #262626;   /* delikatniejsze linie */

    /* akcent - metaliczne złoto */
    --accent:      #d4af37;
    --accent-dark: #b8962e;
    --accent-soft: #f4d06f;   /* jaśniejsze złoto - hover, akcenty */
    --accent-ink:  #0f0f0f;   /* tekst na złotym tle */
    --accent-glow: rgba(212,175,55,.22);

    /* tekst */
    --text:        #f0f0f0;   /* tekst główny */
    --text-soft:   #b0b0b0;   /* tekst drugorzędny */
    --text-faint:  #6f6f6f;   /* tekst wygaszony */
    --text-invert: #f0f0f0;   /* tekst na ciemnym (alias) */

    /* stany */
    --ok:          #3ecf7d;
    --ok-bg:       rgba(62,207,125,.13);
    --warn:        #e0a13a;
    --warn-bg:     rgba(224,161,58,.14);
    --error:       #e5484d;
    --error-bg:    rgba(229,72,77,.14);

    /* kształt i cień */
    --radius:      12px;
    --radius-sm:   8px;
    --shadow:      0 1px 2px rgba(0,0,0,.4),
                   0 8px 24px rgba(0,0,0,.35);
    --shadow-lg:   0 18px 50px rgba(0,0,0,.6);

    /* czcionki */
    --font-display: 'Montserrat', system-ui, sans-serif;
    --font-body:    'Montserrat', system-ui, sans-serif;
}

/* --- Reset --------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }

html, body {
    margin: 0;
    padding: 0;
}

body {
    font-family: var(--font-body);
    color: var(--text);
    background: var(--bg);
    line-height: 1.55;
    -webkit-font-smoothing: antialiased;
}

h1, h2, h3 {
    font-family: var(--font-display);
    line-height: 1.2;
    margin: 0 0 .5em;
    color: var(--text);
}

a { color: inherit; }

/* pasek przewijania w klimacie motywu */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: var(--ink); }
::-webkit-scrollbar-thumb {
    background: var(--line);
    border-radius: 10px;
    border: 2px solid var(--ink);
}
::-webkit-scrollbar-thumb:hover { background: #3a3a3a; }

/* ============================================================
   EKRAN LOGOWANIA
   ============================================================ */
.auth-body {
    min-height: 100vh;
    display: flex;
    /* atmosfera: głęboka czerń z promieniem złota od góry */
    background:
        radial-gradient(900px 520px at 50% -12%,
            var(--accent-glow), transparent 62%),
        var(--ink);
}

.auth-wrap {
    margin: auto;
    width: 100%;
    max-width: 400px;
    padding: 24px;
}

.auth-card {
    background: var(--ink-soft);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    padding: 36px 32px 28px;
}

.auth-card__head {
    text-align: center;
    margin-bottom: 24px;
}

.auth-card__logo {
    font-size: 40px;
    display: block;
    line-height: 1;
}

.auth-card__title {
    font-size: 26px;
    font-weight: 800;
    letter-spacing: -.02em;
    margin: 10px 0 2px;
    /* metaliczny połysk na tytule */
    background: linear-gradient(180deg, var(--accent-soft), var(--accent));
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

.auth-card__sub {
    margin: 0;
    color: var(--text-soft);
    font-size: 14px;
}

.auth-card__foot {
    margin: 20px 0 0;
    text-align: center;
    font-size: 12.5px;
    color: var(--text-faint);
}

/* ============================================================
   FORMULARZE
   ============================================================ */
.form__group {
    margin-bottom: 16px;
}

.form__label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-soft);
    margin-bottom: 6px;
}

.form__input {
    width: 100%;
    padding: 11px 13px;
    font-family: inherit;
    font-size: 15px;
    color: var(--text);
    background: var(--surface-2);
    border: 1.5px solid var(--line);
    border-radius: var(--radius-sm);
    transition: border-color .15s, box-shadow .15s;
}

.form__input::placeholder { color: var(--text-faint); }

.form__input:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-glow);
}

/* ============================================================
   PRZYCISKI
   ============================================================ */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    font-family: var(--font-display);
    font-size: 14.5px;
    font-weight: 700;
    padding: 11px 18px;
    border: none;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: transform .08s, background .15s, box-shadow .15s, color .15s;
}

.btn:active { transform: translateY(1px); }

.btn--primary {
    background: linear-gradient(180deg, var(--accent-soft), var(--accent));
    color: var(--accent-ink);
}
.btn--primary:hover {
    background: linear-gradient(180deg, var(--accent), var(--accent-dark));
    box-shadow: 0 4px 16px var(--accent-glow);
}

.btn--block {
    width: 100%;
    margin-top: 4px;
}

/* ============================================================
   KOMUNIKATY
   ============================================================ */
.alert {
    padding: 11px 14px;
    border-radius: var(--radius-sm);
    font-size: 13.5px;
    margin-bottom: 18px;
    border-left: 4px solid;
}

.alert--error {
    background: var(--error-bg);
    border-color: var(--error);
    color: #f3a3a5;
}

.alert--success {
    background: var(--ok-bg);
    border-color: var(--ok);
    color: #8fe3b3;
}

/* ============================================================
   UKŁAD PANELI - nagłówek, treść, stopka
   ============================================================ */
.app-body {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    background: var(--bg);
}

.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    height: 62px;
    background: var(--ink-soft);
    color: var(--text);
    border-bottom: 1px solid var(--line);
    /* subtelna złota linia akcentu pod paskiem */
    box-shadow: 0 1px 0 var(--accent-glow);
}

.topbar__brand {
    display: flex;
    align-items: center;
    gap: 9px;
}

.topbar__logo { font-size: 22px; }

.topbar__name {
    font-family: var(--font-display);
    font-weight: 800;
    font-size: 18px;
    letter-spacing: -.01em;
    color: var(--accent);
}

.topbar__user {
    display: flex;
    align-items: center;
    gap: 14px;
    font-size: 13.5px;
}

.topbar__role {
    background: linear-gradient(180deg, var(--accent-soft), var(--accent));
    color: var(--accent-ink);
    font-weight: 700;
    font-size: 11.5px;
    text-transform: uppercase;
    letter-spacing: .04em;
    padding: 3px 9px;
    border-radius: 100px;
}

.topbar__person { color: var(--text); }

.topbar__logout {
    color: var(--text-faint);
    text-decoration: none;
    font-weight: 600;
}
.topbar__logout:hover { color: var(--accent); }

.content {
    flex: 1;
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 28px 24px;
}

.footer {
    text-align: center;
    padding: 18px;
    color: var(--text-faint);
}

/* ============================================================
   KARTY - uniwersalny kontener treści paneli
   ============================================================ */
.card {
    background: var(--ink-soft);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 22px;
}

/* ============================================================
   NAGŁÓWEK STRONY (panele)
   ============================================================ */
.page-head {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 22px;
}

.page-head__title {
    font-size: 24px;
    font-weight: 800;
    letter-spacing: -.02em;
    margin: 0;
}

.page-head__sub {
    margin: 4px 0 0;
    color: var(--text-soft);
    font-size: 14px;
}

/* ============================================================
   KARTY - warianty
   ============================================================ */
.card--flush { padding: 0; overflow: hidden; }

.form-card { max-width: 720px; }

/* ============================================================
   TABELA
   ============================================================ */
.table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

.table thead th {
    text-align: left;
    font-family: var(--font-display);
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: .04em;
    color: var(--text-soft);
    background: var(--surface-2);
    padding: 12px 16px;
    border-bottom: 1px solid var(--line);
}

.table tbody td {
    padding: 13px 16px;
    border-bottom: 1px solid var(--line-soft);
    vertical-align: middle;
}

.table tbody tr:last-child td { border-bottom: none; }
.table tbody tr:hover { background: rgba(255,255,255,.03); }

.table__row--inactive { opacity: .5; }

.table__hint {
    display: block;
    font-size: 12px;
    color: var(--text-faint);
    margin-top: 1px;
}

.table__muted { color: var(--text-faint); }

.table__empty {
    text-align: center;
    padding: 32px;
    color: var(--text-faint);
}

.table__actions-col { width: 1%; white-space: nowrap; }

.table__actions {
    display: flex;
    gap: 6px;
    white-space: nowrap;
}

.table code {
    font-size: 12.5px;
    background: var(--surface-2);
    color: var(--accent-soft);
    padding: 2px 6px;
    border-radius: 4px;
}

.inline-form { display: inline; margin: 0; }

/* ============================================================
   TAGI I KROPKI STATUSU
   ============================================================ */
.tag {
    display: inline-block;
    font-size: 11.5px;
    font-weight: 700;
    letter-spacing: .02em;
    padding: 3px 9px;
    border-radius: 100px;
}

.tag--role-admin      { background: rgba(155,125,255,.16); color: #b9a3ff; }
.tag--role-dispatcher { background: rgba(90,160,240,.16);  color: #8fc0f5; }
.tag--role-driver     { background: var(--accent-glow);    color: var(--accent-soft); }

.tag--ok  { background: var(--ok-bg);  color: var(--ok); }
.tag--off { background: rgba(255,255,255,.08); color: var(--text-faint); }

.dot {
    display: inline-block;
    width: 8px; height: 8px;
    border-radius: 50%;
    margin-right: 5px;
    vertical-align: middle;
}

.dot--offline   { background: #5a5a5a; }
.dot--available { background: var(--ok);   box-shadow: 0 0 6px var(--ok); }
.dot--busy      { background: var(--warn); box-shadow: 0 0 6px var(--warn); }

/* ============================================================
   FORMULARZE - rozbudowa
   ============================================================ */
.form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 4px 18px;
}

.form__group--wide { grid-column: 1 / -1; }

.form__select {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8'%3E%3Cpath fill='%23b0b0b0' d='M1 1l5 5 5-5'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 13px center;
    padding-right: 34px;
}

.form__select option {
    background: var(--surface-2);
    color: var(--text);
}

.form__input--err {
    border-color: var(--error);
}
.form__input--err:focus {
    box-shadow: 0 0 0 3px var(--error-bg);
}

.form__error {
    display: block;
    color: #f3a3a5;
    font-size: 12.5px;
    margin-top: 4px;
}

.form__hint {
    display: block;
    color: var(--text-faint);
    font-size: 12px;
    margin-top: 4px;
}

.form__optional {
    color: var(--text-faint);
    font-weight: 400;
}

.form-section {
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    padding: 14px 18px 4px;
    margin: 8px 0 4px;
}

.form-section__title {
    font-family: var(--font-display);
    font-size: 12.5px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .04em;
    color: var(--accent);
    padding: 0 6px;
}

.form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 20px;
    padding-top: 18px;
    border-top: 1px solid var(--line);
}

/* ============================================================
   PRZYCISKI - warianty
   ============================================================ */
.btn--sm {
    font-size: 12.5px;
    padding: 6px 11px;
}

.btn--ghost {
    background: transparent;
    color: var(--text-soft);
    border: 1.5px solid var(--line);
}
.btn--ghost:hover {
    background: var(--surface-2);
    color: var(--text);
    border-color: #3a3a3a;
}

.btn--ok {
    background: var(--ok);
    color: #08130c;
}
.btn--ok:hover { background: #34b86d; }

.btn--danger {
    background: var(--error);
    color: #fff;
}
.btn--danger:hover { background: #cf3b40; }

/* ============================================================
   RESPONSYWNOŚĆ
   ============================================================ */
@media (max-width: 680px) {
    .form-grid { grid-template-columns: 1fr; }
    .page-head { flex-direction: column; align-items: stretch; }
    .table { font-size: 13px; }
    .table thead th,
    .table tbody td { padding: 10px 11px; }
    .radio-group { grid-template-columns: 1fr; }
}

/* ============================================================
   TEXTAREA
   ============================================================ */
.form__textarea {
    resize: vertical;
    min-height: 70px;
    font-family: inherit;
    line-height: 1.5;
}

/* ============================================================
   RADIO-KARTY (wybór trybu przydzielenia)
   ============================================================ */
.radio-group {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.radio-card {
    display: flex;
    gap: 10px;
    padding: 13px 14px;
    border: 1.5px solid var(--line);
    border-radius: var(--radius-sm);
    background: var(--surface-2);
    cursor: pointer;
    transition: border-color .15s, background .15s;
}

.radio-card:hover { border-color: var(--accent-dark); }

.radio-card:has(input:checked) {
    border-color: var(--accent);
    background: var(--accent-glow);
}

.radio-card input {
    margin: 2px 0 0;
    accent-color: var(--accent);
}

.radio-card__body {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.radio-card__body strong {
    font-family: var(--font-display);
    font-size: 14px;
}

.radio-card__body span {
    font-size: 12.5px;
    color: var(--text-soft);
    line-height: 1.4;
}

/* ============================================================
   PANEL KIEROWCY
   ============================================================ */
.status-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 24px;
}

.status-bar__current {
    display: flex;
    align-items: center;
    gap: 12px;
}

.status-bar__label {
    display: block;
    font-size: 12px;
    color: var(--text-faint);
    text-transform: uppercase;
    letter-spacing: .04em;
}

.status-bar__value {
    font-family: var(--font-display);
    font-size: 17px;
}

.status-bar__hint {
    font-size: 12.5px;
    color: var(--text-faint);
}

.dot--lg { width: 13px; height: 13px; margin-right: 0; }

/* --- Sekcje pulpitu --- */
.section { margin-bottom: 28px; }

.section__title {
    display: flex;
    align-items: center;
    gap: 9px;
    font-size: 16px;
    font-weight: 700;
    margin-bottom: 12px;
}

.section__count {
    background: linear-gradient(180deg, var(--accent-soft), var(--accent));
    color: var(--accent-ink);
    font-size: 12px;
    font-weight: 700;
    min-width: 22px;
    height: 22px;
    padding: 0 7px;
    border-radius: 100px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.empty-state {
    color: var(--text-faint);
    font-size: 14px;
    text-align: center;
    padding: 26px;
}

/* --- Lista i karty kursów --- */
.order-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(310px, 1fr));
    gap: 14px;
}

.order-card {
    background: var(--ink-soft);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 16px 18px;
    display: flex;
    flex-direction: column;
    gap: 11px;
}

.order-card--active {
    border-left: 3px solid var(--accent);
    box-shadow: var(--shadow), inset 0 0 0 1px var(--accent-glow);
}

.order-card__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.order-card__id {
    font-family: var(--font-display);
    font-weight: 700;
    font-size: 13.5px;
    color: var(--text-soft);
}

/* --- Trasa: punkt odbioru i celu --- */
.order-card__route {
    display: flex;
    flex-direction: column;
    gap: 7px;
}

.route-point {
    display: flex;
    align-items: flex-start;
    gap: 9px;
    font-size: 14px;
    line-height: 1.4;
}

.route-point__marker {
    flex: none;
    width: 11px;
    height: 11px;
    border-radius: 50%;
    margin-top: 3px;
    border: 2.5px solid;
}

.route-point__marker--from {
    border-color: var(--ok);
    background: var(--ink-soft);
}
.route-point__marker--to {
    border-color: var(--error);
    background: var(--error);
}

.order-card__meta {
    margin: 0;
    font-size: 13px;
    color: var(--text-soft);
}

.order-card__notes {
    margin: 0;
    font-size: 13px;
    color: var(--text-soft);
    background: var(--surface-2);
    border-radius: var(--radius-sm);
    padding: 8px 11px;
}

.order-card__actions {
    display: flex;
    gap: 8px;
    margin-top: 2px;
}

@media (max-width: 560px) {
    .status-bar { flex-direction: column; align-items: stretch; }
    .order-list { grid-template-columns: 1fr; }
}

/* ============================================================
   MAPA DYSPOZYTORA
   ============================================================ */
.page-head__actions {
    display: flex;
    gap: 9px;
}

.map-toolbar {
    display: flex;
    align-items: center;
    gap: 18px;
    flex-wrap: wrap;
    background: var(--ink-soft);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 11px 16px;
    margin-bottom: 12px;
    font-size: 13.5px;
}

.map-toolbar__legend {
    display: flex;
    align-items: center;
    gap: 7px;
    margin-left: auto;
    color: var(--text-soft);
    font-size: 12.5px;
}

.legend-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    display: inline-block;
}
.legend-dot--available { background: var(--ok); }
.legend-dot--busy      { background: var(--warn); margin-left: 8px; }

/* Płótno mapy */
.map-canvas {
    height: 600px;
    border-radius: var(--radius);
    border: 1px solid var(--line);
    box-shadow: var(--shadow);
    overflow: hidden;
    z-index: 0;
}

/* Marker pojazdu na mapie */
.car-marker__dot {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    border-radius: 50%;
    border: 3px solid var(--ink-soft);
    box-shadow: 0 2px 8px rgba(0,0,0,.6);
    font-size: 16px;
}

/* Leaflet na ciemnym tle - dopasowanie kontrolek i dymków */
.leaflet-container { background: #1a1a1a; }
.leaflet-popup-content-wrapper,
.leaflet-popup-tip {
    background: var(--surface-2);
    color: var(--text);
    box-shadow: var(--shadow);
}
.leaflet-bar a {
    background: var(--surface-2);
    color: var(--text);
    border-color: var(--line);
}
.leaflet-bar a:hover { background: #3a3a3a; }

/* ============================================================
   WSKAŹNIK POŁĄCZENIA WEBSOCKET
   ============================================================ */
.ws-indicator {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    font-weight: 700;
    padding: 3px 10px;
    border-radius: 100px;
}

.ws-indicator::before {
    content: '';
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: currentColor;
}

.ws-indicator--connecting { background: var(--warn-bg); color: var(--warn); }
.ws-indicator--online     { background: var(--ok-bg);   color: var(--ok); }
.ws-indicator--offline    { background: var(--error-bg); color: #f3a3a5; }

@media (max-width: 560px) {
    .map-canvas { height: 420px; }
    .map-toolbar__legend { margin-left: 0; }
    .page-head__actions { flex-direction: column; }
}
