/* =========================================================
   Veridian Systems – Serwer techniczny
   Motyw: tabor autobusowy (granat + bursztynowy akcent)
   ========================================================= */

:root {
    --navy-900: #0b1f3a;
    --navy-800: #10294c;
    --navy-700: #163a68;
    --navy-600: #1e4d86;
    --amber-500: #f5a623;
    --amber-400: #ffbf47;
    --amber-600: #d98a12;
    --ink: #12233b;
    --slate-500: #5b6b7f;
    --slate-300: #a9b6c6;
    --line: #e2e8f0;
    --surface: #ffffff;
    --bg: #eef2f7;
    --danger-bg: #fdecec;
    --danger-fg: #b3261e;
    --success: #1f9d55;
    --radius: 14px;
    --shadow-sm: 0 1px 2px rgba(11, 31, 58, 0.06), 0 2px 8px rgba(11, 31, 58, 0.06);
    --shadow-lg: 0 24px 60px rgba(11, 31, 58, 0.28);
    --font: "Segoe UI", system-ui, -apple-system, Roboto, Arial, sans-serif;
}

* {
    box-sizing: border-box;
}

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

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

a {
    color: inherit;
    text-decoration: none;
}

/* ============================ LOGIN ============================ */

.login-body {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    background:
        radial-gradient(1200px 600px at 100% -10%, rgba(245, 166, 35, 0.16), transparent 60%),
        radial-gradient(900px 500px at -10% 110%, rgba(30, 77, 134, 0.5), transparent 55%),
        linear-gradient(160deg, var(--navy-900), var(--navy-700));
}

.login-shell {
    width: 100%;
    max-width: 440px;
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.login-shell-wide {
    max-width: 820px;
}

.login-card {
    background: var(--surface);
    border-radius: 20px;
    padding: 40px 36px 32px;
    box-shadow: var(--shadow-lg);
    border-top: 6px solid var(--amber-500);
}

.login-brand {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 14px;
    margin-bottom: 22px;
}

.login-logo {
    width: 120px;
    height: 120px;
    object-fit: contain;
    border-radius: 16px;
    background: var(--navy-900);
    padding: 8px;
    box-shadow: var(--shadow-sm);
}

.login-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 0.78rem;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--navy-700);
    background: rgba(245, 166, 35, 0.16);
    border: 1px solid rgba(245, 166, 35, 0.4);
    padding: 6px 12px;
    border-radius: 999px;
}

.badge-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--success);
    box-shadow: 0 0 0 3px rgba(31, 157, 85, 0.18);
}

.login-title {
    margin: 0 0 4px;
    font-size: 1.5rem;
    text-align: center;
    color: var(--navy-900);
}

.login-subtitle {
    margin: 0 0 22px;
    text-align: center;
    color: var(--slate-500);
    font-size: 0.95rem;
}

.login-form {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.field {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.field-label {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--navy-800);
}

.field input {
    width: 100%;
    padding: 12px 14px;
    border: 1.5px solid var(--line);
    border-radius: 10px;
    font-size: 1rem;
    font-family: inherit;
    transition: border-color 0.15s, box-shadow 0.15s;
    background: #fbfcfe;
}

.checkbox-inline {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    width: fit-content;
}

.field input[type="checkbox"] {
    width: fit-content;
}

.field input:focus {
    outline: none;
    border-color: var(--navy-600);
    box-shadow: 0 0 0 3px rgba(30, 77, 134, 0.15);
    background: #fff;
}

.btn {
    cursor: pointer;
    border: none;
    border-radius: 10px;
    font-size: 1rem;
    font-weight: 600;
    font-family: inherit;
    padding: 13px 18px;
    transition: transform 0.05s, background 0.15s, box-shadow 0.15s;
}

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

.btn-block {
    width: 100%;
}

.btn-primary {
    color: var(--navy-900);
    background: linear-gradient(180deg, var(--amber-400), var(--amber-500));
    box-shadow: 0 8px 18px rgba(245, 166, 35, 0.35);
}

.btn-primary:hover {
    background: linear-gradient(180deg, var(--amber-500), var(--amber-600));
}

.alert {
    border-radius: 10px;
    padding: 12px 14px;
    font-size: 0.9rem;
    margin-bottom: 18px;
}

.alert-error {
    background: var(--danger-bg);
    color: var(--danger-fg);
    border: 1px solid rgba(179, 38, 30, 0.25);
}

.login-footnote {
    margin: 20px 0 0;
    text-align: center;
    font-size: 0.8rem;
    color: var(--slate-500);
}

.login-copyright {
    text-align: center;
    color: rgba(255, 255, 255, 0.75);
    font-size: 0.8rem;
}

/* ============================ APP LAYOUT ============================ */

.app-body {
    background: var(--bg);
}

.app-shell {
    display: flex;
    min-height: 100vh;
}

.sidebar {
    width: 264px;
    flex-shrink: 0;
    background: linear-gradient(180deg, var(--navy-900), var(--navy-800));
    color: #eaf0f8;
    display: flex;
    flex-direction: column;
    padding: 22px 16px;
    position: sticky;
    top: 0;
    height: 100vh;
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 6px 8px 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    margin-bottom: 18px;
}

.sidebar-logo {
    width: 46px;
    height: 46px;
    object-fit: contain;
    border-radius: 10px;
    background: #fff;
    padding: 4px;
}

.sidebar-brand-text {
    display: flex;
    flex-direction: column;
    line-height: 1.25;
}

.sidebar-brand-text strong {
    font-size: 1rem;
}

.sidebar-brand-text span {
    font-size: 0.75rem;
    color: var(--amber-400);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.sidebar-nav {
    display: flex;
    flex-direction: column;
    gap: 4px;
    flex: 1;
}

.nav-link {
    display: block;
    padding: 12px 14px;
    border-radius: 10px;
    font-weight: 500;
    color: #d3ddec;
    border-left: 3px solid transparent;
    transition: background 0.15s, color 0.15s, border-color 0.15s;
}

.nav-link:hover {
    background: rgba(255, 255, 255, 0.07);
    color: #fff;
}

.nav-link.is-active {
    background: rgba(245, 166, 35, 0.16);
    color: #fff;
    border-left-color: var(--amber-500);
}

.sidebar-footer {
    padding-top: 16px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.nav-logout {
    color: var(--amber-400);
}

.nav-logout:hover {
    background: rgba(245, 166, 35, 0.14);
    color: #fff;
}

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

.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    background: var(--surface);
    padding: 18px 28px;
    border-bottom: 1px solid var(--line);
    box-shadow: var(--shadow-sm);
}

.topbar-title {
    margin: 0;
    font-size: 1.3rem;
    color: var(--navy-900);
}

.topbar-user {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    line-height: 1.3;
}

.user-name {
    font-weight: 600;
    color: var(--navy-800);
}

.user-email {
    font-size: 0.8rem;
    color: var(--slate-500);
}

.content {
    padding: 28px;
    flex: 1;
}

.app-footer {
    padding: 16px 28px;
    color: var(--slate-500);
    font-size: 0.82rem;
    border-top: 1px solid var(--line);
    background: var(--surface);
}

/* ============================ CONTENT ============================ */

.welcome {
    margin-bottom: 24px;
}

.welcome-title {
    margin: 0 0 6px;
    color: var(--navy-900);
    font-size: 1.4rem;
}

.welcome-text {
    margin: 0;
    color: var(--slate-500);
}

.cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 18px;
}

.stat-card {
    background: var(--surface);
    border-radius: var(--radius);
    padding: 22px;
    box-shadow: var(--shadow-sm);
    border-top: 4px solid var(--amber-500);
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.stat-label {
    font-size: 0.82rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--slate-500);
}

.stat-value {
    font-size: 2rem;
    font-weight: 700;
    color: var(--navy-900);
}

.stat-ok {
    color: var(--success);
    font-size: 1.6rem;
}

.stat-link {
    margin-top: 8px;
    font-size: 0.88rem;
    font-weight: 600;
    color: var(--navy-600);
}

.stat-link:hover {
    color: var(--amber-600);
}

.stat-link-muted {
    color: var(--slate-500);
    font-weight: 500;
}

.panel {
    background: var(--surface);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
}

.panel-head {
    padding: 20px 24px;
    border-bottom: 1px solid var(--line);
    background: linear-gradient(180deg, #f8fafd, #fff);
}

.panel-title {
    margin: 0;
    font-size: 1.15rem;
    color: var(--navy-900);
}

.panel-body {
    padding: 24px;
}

.placeholder-text {
    margin: 0;
    color: var(--slate-500);
}

/* ============================ UŻYTKOWNICY ============================ */

.users-layout {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 18px;
    align-items: start;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.92rem;
}

.data-table th,
.data-table td {
    text-align: left;
    padding: 12px 14px;
    border-bottom: 1px solid var(--line);
    vertical-align: middle;
}

.data-table thead th {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--slate-500);
    background: #f8fafd;
}

.data-table tbody tr:hover {
    background: #f8fafd;
}

.data-table .col-actions {
    text-align: right;
    width: 1%;
    white-space: nowrap;
}

.table-actions {
    display: flex;
    gap: 8px;
    justify-content: flex-end;
    align-items: center;
}

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

.muted {
    color: var(--slate-300);
}

.badge {
    display: inline-block;
    font-size: 0.72rem;
    font-weight: 600;
    padding: 3px 9px;
    border-radius: 999px;
    letter-spacing: 0.02em;
}

.badge-active {
    background: rgba(31, 157, 85, 0.14);
    color: var(--success);
}

.badge-inactive {
    background: rgba(179, 38, 30, 0.12);
    color: var(--danger-fg);
}

.badge-you {
    background: rgba(30, 77, 134, 0.12);
    color: var(--navy-600);
    margin-left: 6px;
}

.stack-form {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.checkbox-field {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 500;
    color: var(--navy-800);
    cursor: pointer;
}

.checkbox-field input {
    width: 18px;
    height: 18px;
    accent-color: var(--navy-600);
}

.form-actions {
    display: flex;
    gap: 10px;
    align-items: center;
}

.btn-secondary {
    background: #eef2f7;
    color: var(--navy-800);
    border: 1px solid var(--line);
}

.btn-secondary:hover {
    background: #e2e8f0;
}

.btn-danger {
    background: #fbe9e8;
    color: var(--danger-fg);
    border: 1px solid rgba(179, 38, 30, 0.25);
}

.btn-danger:hover {
    background: #f6d7d5;
}

.btn-sm {
    padding: 7px 12px;
    font-size: 0.85rem;
    border-radius: 8px;
}

.alert-success {
    background: rgba(31, 157, 85, 0.12);
    color: #14713c;
    border: 1px solid rgba(31, 157, 85, 0.3);
}

.alert-list {
    margin: 0;
    padding-left: 18px;
}

/* ============================ RESPONSYWNOŚĆ ============================ */

@media (max-width: 760px) {
    .app-shell {
        flex-direction: column;
    }

    .sidebar {
        width: 100%;
        height: auto;
        position: static;
        flex-direction: row;
        flex-wrap: wrap;
        align-items: center;
        gap: 8px;
    }

    .sidebar-brand {
        border: none;
        margin: 0;
        padding: 0;
        flex: 1;
    }

    .sidebar-nav {
        flex-direction: row;
        flex-wrap: wrap;
        flex: 1 1 100%;
    }

    .sidebar-footer {
        border: none;
        padding: 0;
    }

    .users-layout {
        grid-template-columns: 1fr;
    }
}

/* ============================ SAMOCHODY ============================ */

.field select,
.filter-select {
    width: 100%;
    padding: 12px 14px;
    border: 1.5px solid var(--line);
    border-radius: 10px;
    font-size: 1rem;
    font-family: inherit;
    background: #fbfcfe;
    transition: border-color 0.15s, box-shadow 0.15s;
}

.field select:focus,
.filter-select:focus {
    outline: none;
    border-color: var(--navy-600);
    box-shadow: 0 0 0 3px rgba(30, 77, 134, 0.15);
    background: #fff;
}

.field input[readonly] {
    background: #eef2f7;
    color: var(--slate-500);
    cursor: default;
}

.field-hint {
    font-size: 0.8rem;
    color: var(--slate-500);
}

.field-hint code {
    background: #eef2f7;
    padding: 1px 6px;
    border-radius: 6px;
    font-size: 0.78rem;
}

.panel-head {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
}

.panel-head-tools {
    display: flex;
    align-items: flex-end;
    gap: 12px;
}

.field-inline {
    min-width: 220px;
}

.grid-form {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
}

.grid-form .field-wide,
.grid-form .form-actions.field-wide {
    grid-column: 1 / -1;
}

.table-scroll {
    overflow-x: auto;
}

/* DataTables – dopasowanie do motywu panelu. */
.dataTables_wrapper {
    font-size: 0.92rem;
}

.dataTables_wrapper .dataTables_filter input,
.dataTables_wrapper .dataTables_length select {
    border: 1.5px solid var(--line);
    border-radius: 8px;
    padding: 6px 10px;
    font-family: inherit;
    background: #fbfcfe;
}

.dataTables_wrapper .dataTables_paginate .paginate_button.current {
    border-radius: 8px;
}

.dataTables_wrapper .dataTables_info,
.dataTables_wrapper .dataTables_paginate {
    margin-top: 12px;
    color: var(--slate-500);
}

@media (max-width: 720px) {
    .grid-form {
        grid-template-columns: 1fr;
    }
}

/* ============================ MODAL ============================ */

.modal-overlay {
    position: fixed;
    inset: 0;
    z-index: 100;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding: 48px 16px;
    overflow-y: auto;
    background: rgba(15, 27, 45, 0.55);
}

.modal-overlay[hidden] {
    display: none;
}

.modal {
    width: 100%;
    max-width: 640px;
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 24px 60px rgba(15, 27, 45, 0.35);
    animation: modal-in 0.16s ease-out;
}

@keyframes modal-in {
    from { transform: translateY(-14px); opacity: 0; }
    to   { transform: translateY(0);     opacity: 1; }
}

.modal-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 20px 24px;
    border-bottom: 1px solid var(--line);
    background: linear-gradient(180deg, #f8fafd, #fff);
    border-radius: 16px 16px 0 0;
}

.modal-title {
    margin: 0;
    font-size: 1.15rem;
    color: var(--navy-900);
}

.modal-close {
    border: none;
    background: none;
    font-size: 1.6rem;
    line-height: 1;
    cursor: pointer;
    color: var(--slate-500);
    padding: 2px 10px;
    border-radius: 8px;
}

.modal-close:hover {
    background: #eef2f7;
    color: var(--navy-800);
}

.modal-body {
    padding: 24px;
}

body.modal-open {
    overflow: hidden;
}

@media (max-width: 720px) {
    .modal-overlay {
        padding: 16px;
    }
}
