/* =========================================
   Vehicle Booking - Tablet-First Styles
   ========================================= */

:root {
    --color-bg: #0f1419;
    --color-surface: #1a1f26;
    --color-surface-hover: #242b35;
    --color-border: #2d3640;
    --color-text: #e7e9ea;
    --color-text-muted: #8899a6;
    --color-primary: #1d9bf0;
    --color-primary-hover: #1a8cd8;
    --color-success: #00ba7c;
    --color-warning: #ffad1f;
    --color-danger: #f4212e;
    --color-disabled: #6e767d;
    
    --font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, sans-serif;
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 16px;
    --shadow: 0 4px 12px rgba(0,0,0,0.4);
    
    --header-height: 60px;
    --sidebar-width: 240px;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html, body {
    font-family: var(--font-family);
    font-size: 16px;
    line-height: 1.5;
    background: var(--color-bg);
    color: var(--color-text);
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
}

a {
    color: var(--color-primary);
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

/* =========================================
   Header
   ========================================= */

.header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: var(--header-height);
    background: var(--color-surface);
    border-bottom: 1px solid var(--color-border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    z-index: 100;
}

.header-brand a {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--color-text);
    text-decoration: none;
}

.header-nav {
    display: flex;
    gap: 8px;
}

.nav-link {
    padding: 8px 16px;
    border-radius: var(--radius-md);
    color: var(--color-text-muted);
    font-weight: 500;
    text-decoration: none;
    transition: all 0.2s;
}

.nav-link:hover {
    background: var(--color-surface-hover);
    color: var(--color-text);
    text-decoration: none;
}

.nav-link.active {
    background: var(--color-primary);
    color: white;
}

.nav-link-help {
    font-size: 1.2rem;
    padding: 6px 12px;
    display: flex;
    align-items: center;
    gap: 4px;
}

.nav-link-help .help-text {
    color: #e53935;
    font-size: 0.85rem;
    font-weight: 700;
    letter-spacing: 0.5px;
}

/* =========================================
   Main Content
   ========================================= */

.main-content {
    padding-top: var(--header-height);
    min-height: 100vh;
    padding: calc(var(--header-height) + 24px) 24px 24px;
}

/* =========================================
   Vehicles Grid
   ========================================= */

.vehicles-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
    max-width: 1400px;
    margin: 0 auto;
}

.vehicle-card {
    background: var(--color-surface);
    border-radius: var(--radius-lg);
    padding: 20px;
    border: 1px solid var(--color-border);
    text-decoration: none;
    color: var(--color-text);
    transition: all 0.2s;
    display: block;
}

.vehicle-card:hover {
    border-color: var(--color-primary);
    transform: translateY(-2px);
    box-shadow: var(--shadow);
    text-decoration: none;
}

.vehicle-card.disabled {
    opacity: 0.7;
    border-color: var(--color-danger);
}

.vehicle-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.vehicle-reg {
    font-family: monospace;
    font-size: 0.9rem;
    background: var(--color-bg);
    padding: 4px 10px;
    border-radius: var(--radius-sm);
    color: var(--color-text-muted);
}

.status-badge {
    font-size: 0.75rem;
    font-weight: 600;
    padding: 4px 10px;
    border-radius: 20px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.status-badge.status-available {
    background: rgba(0, 186, 124, 0.15);
    color: var(--color-success);
}

.status-badge.status-busy {
    background: rgba(255, 173, 31, 0.15);
    color: var(--color-warning);
}

.status-badge.status-disabled {
    background: rgba(244, 33, 46, 0.15);
    color: var(--color-danger);
}

.vehicle-name {
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 4px;
}

.vehicle-model {
    color: var(--color-text-muted);
    font-size: 0.9rem;
    margin-bottom: 8px;
}

.vehicle-parking {
    font-size: 0.85rem;
    color: var(--color-text-muted);
}

.vehicle-disabled-info,
.vehicle-current-res {
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid var(--color-border);
}

.vehicle-disabled-info .disabled-reason {
    color: var(--color-danger);
    font-weight: 500;
}

.vehicle-disabled-info .disabled-until,
.vehicle-current-res .res-until {
    font-size: 0.85rem;
    color: var(--color-text-muted);
    margin-top: 4px;
}

.vehicle-current-res .res-person {
    font-weight: 500;
}

.vehicle-upcoming {
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px dashed var(--color-border);
}

.upcoming-table {
    width: 100%;
    border-collapse: collapse;
}

.upcoming-table td {
    padding: 1px 0;
    vertical-align: top;
    font-size: 0.65rem !important;
    color: rgba(136, 153, 166, 0.6) !important;
    line-height: 1.3;
}

.upcoming-table .upcoming-date {
    width: 70px;
    white-space: nowrap;
}

.upcoming-table .upcoming-person {
    text-align: right;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 0;
}

.vehicle-current-res .res-info {
    font-size: 0.65rem;
    color: var(--color-warning);
    line-height: 1.3;
    margin-bottom: 2px;
}

.vehicle-current-res .res-info strong {
    font-weight: 600;
}

.vehicle-current-res .res-person {
    font-size: 0.65rem;
    color: var(--color-warning);
    font-weight: 600;
    line-height: 1.3;
}

/* =========================================
   Vehicle View
   ========================================= */

.vehicle-view {
    max-width: 1600px;
    margin: 0 auto;
}

.vehicle-header {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    gap: 60px;
    margin-bottom: 32px;
}

.back-link {
    color: var(--color-text-muted);
    font-size: 0.9rem;
}

.vehicle-header .back-link {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    background: var(--color-surface);
    border-radius: 12px;
    color: var(--color-text);
    transition: all 0.2s ease;
    flex-shrink: 0;
    font-weight: 500;
    font-size: 0.95rem;
}

.vehicle-header .back-link:hover {
    background: var(--color-primary);
    color: white;
    transform: translateX(-2px);
}

.vehicle-header .back-link svg {
    width: 18px;
    height: 18px;
}

.vehicle-info {
    flex: 1;
    min-width: 300px;
}

.vehicle-info h1 {
    font-size: 1.75rem;
    margin-bottom: 8px;
}

.vehicle-details {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    color: var(--color-text-muted);
    font-size: 0.9rem;
}

.vehicle-details .reg {
    font-family: monospace;
    background: var(--color-surface);
    padding: 2px 8px;
    border-radius: var(--radius-sm);
}

.vehicle-status {
    min-width: 200px;
}

.status-box {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px 20px;
    border-radius: var(--radius-md);
    background: var(--color-surface);
}

.status-box.status-available {
    border-left: 4px solid var(--color-success);
}

.status-box.status-busy {
    border-left: 4px solid var(--color-warning);
}

.status-box.status-disabled {
    border-left: 4px solid var(--color-danger);
}

.status-icon {
    font-size: 1.5rem;
}

.status-text strong {
    display: block;
    margin-bottom: 4px;
}

.status-text p {
    font-size: 0.85rem;
    color: var(--color-text-muted);
    margin: 0;
}

.status-text .note {
    font-style: italic;
}

/* =========================================
   Vehicle Guardian
   ========================================= */

.vehicle-guardian {
    min-width: 200px;
}

.guardian-box {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 16px 20px;
    border-radius: var(--radius-md);
    background: var(--color-surface);
    border-left: 4px solid var(--color-primary);
}

.guardian-icon {
    font-size: 1.5rem;
}

.guardian-info strong {
    display: block;
    font-size: 0.8rem;
    color: var(--color-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 4px;
}

.guardian-name {
    font-weight: 600;
    margin-bottom: 8px;
}

.guardian-contacts {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.guardian-contact {
    font-size: 0.85rem;
    color: var(--color-primary);
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    transition: opacity 0.2s;
}

.guardian-contact:hover {
    opacity: 0.7;
}

/* =========================================
   Timeline
   ========================================= */

.timeline-container {
    background: var(--color-surface);
    border-radius: var(--radius-lg);
    padding: 20px;
    border: 1px solid var(--color-border);
    overflow: hidden;
}

.timeline-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.timeline-header h2 {
    font-size: 1.1rem;
    font-weight: 600;
}

.timeline-actions {
    display: flex;
    gap: 8px;
}

.timeline-scroll {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.timeline {
    display: flex;
    flex-direction: column;
    width: 100%;
    min-width: 700px; /* Minimalna szerokość dla czytelności */
}

.timeline-hours {
    display: flex;
    position: sticky;
    top: 0;
    z-index: 10;
    background: var(--color-surface);
}

.timeline-corner {
    width: 80px;
    min-width: 80px;
    flex-shrink: 0;
}

.hour-label {
    flex: 1;
    min-width: 28px;
    text-align: center;
    font-size: 0.65rem;
    color: var(--color-text-muted);
    padding: 6px 0;
    border-left: 1px solid var(--color-border);
    white-space: nowrap;
    overflow: hidden;
}

.timeline-day {
    display: flex;
    border-top: 1px solid var(--color-border);
}

.day-label {
    width: 80px;
    min-width: 80px;
    flex-shrink: 0;
    padding: 6px 8px;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.day-label .day-name {
    font-weight: 600;
    font-size: 0.75rem;
    text-transform: capitalize;
}

.day-label .day-date {
    font-size: 0.7rem;
    color: var(--color-text-muted);
}

.hour-slot {
    flex: 1;
    min-width: 28px;
    height: 50px;
    border-left: 1px solid var(--color-border);
    position: relative;
    cursor: pointer;
    transition: background 0.15s;
}

.hour-slot:hover:not(.reserved):not(.past) {
    background: rgba(29, 155, 240, 0.1);
}

.hour-slot.past {
    background: rgba(110, 118, 125, 0.1);
    cursor: not-allowed;
}

/* Cały poprzedni dzień wyszarzony */
.timeline-day.past-day {
    opacity: 0.5;
}

.timeline-day.past-day .day-label {
    color: var(--color-text-muted);
}

.timeline-day.past-day .hour-slot {
    background: rgba(110, 118, 125, 0.15);
    cursor: not-allowed;
}

.hour-slot.selected {
    background: rgba(29, 155, 240, 0.3) !important;
}

.hour-slot.reserved {
    cursor: pointer;
}

.reservation-block {
    position: absolute;
    top: 3px;
    left: 2px;
    bottom: 3px;
    /* Szerokość ustawiana dynamicznie przez JS */
    background: linear-gradient(135deg, var(--color-primary), #0d7bc4);
    border-radius: var(--radius-sm);
    padding: 4px 6px;
    font-size: 0.65rem;
    color: white;
    overflow: hidden;
    z-index: 5;
    display: flex;
    flex-direction: column;
    justify-content: center;
    white-space: nowrap;
}

.reservation-block .res-person {
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.reservation-block .res-time {
    opacity: 0.9;
    font-size: 0.6rem;
}

/* Większe ekrany - więcej miejsca */
@media (min-width: 1200px) {
    .timeline {
        min-width: 900px;
    }
    
    .hour-label {
        font-size: 0.7rem;
        min-width: 35px;
    }
    
    .hour-slot {
        height: 55px;
        min-width: 35px;
    }
    
    .reservation-block {
        font-size: 0.7rem;
        padding: 5px 8px;
    }
}

/* Tablet landscape */
@media (max-width: 1199px) and (min-width: 768px) {
    .timeline {
        min-width: 650px;
    }
}

/* =========================================
   Dashboard
   ========================================= */

.dashboard {
    max-width: 1200px;
    margin: 0 auto;
}

.dashboard h1 {
    font-size: 1.75rem;
    margin-bottom: 32px;
}

.dashboard-section {
    margin-bottom: 40px;
}

.dashboard-section h2 {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 16px;
    color: var(--color-text-muted);
}

.reservations-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.reservation-item {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 16px;
    padding: 16px 20px;
    background: var(--color-surface);
    border-radius: var(--radius-md);
    border: 1px solid var(--color-border);
}

.reservation-item.current {
    border-left: 4px solid var(--color-success);
}

.res-vehicle {
    min-width: 200px;
}

.res-vehicle a {
    font-weight: 600;
    color: var(--color-text);
}

.res-vehicle .reg {
    font-family: monospace;
    font-size: 0.8rem;
    color: var(--color-text-muted);
    margin-left: 8px;
}

.res-date {
    font-size: 0.9rem;
    color: var(--color-text-muted);
    min-width: 100px;
}

.res-time {
    font-family: monospace;
    font-size: 0.9rem;
    color: var(--color-text);
    min-width: 120px;
}

.res-person {
    flex: 1;
}

.res-person .phone {
    font-size: 0.85rem;
    margin-left: 8px;
}

.empty-state {
    color: var(--color-text-muted);
    font-style: italic;
    padding: 20px;
    text-align: center;
}

/* =========================================
   Buttons
   ========================================= */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 10px 20px;
    font-size: 0.9rem;
    font-weight: 600;
    border-radius: var(--radius-md);
    border: none;
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
    gap: 8px;
}

.btn:hover {
    text-decoration: none;
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn-primary {
    background: var(--color-primary);
    color: white;
}

.btn-primary:hover:not(:disabled) {
    background: var(--color-primary-hover);
}

.btn-secondary {
    background: var(--color-surface-hover);
    color: var(--color-text);
    border: 1px solid var(--color-border);
}

.btn-secondary:hover:not(:disabled) {
    background: var(--color-border);
}

.btn-success {
    background: var(--color-success);
    color: white;
}

.btn-warning {
    background: var(--color-warning);
    color: black;
}

.btn-danger {
    background: var(--color-danger);
    color: white;
}

.btn-sm {
    padding: 6px 12px;
    font-size: 0.8rem;
}

.btn-block {
    width: 100%;
}

/* =========================================
   Forms
   ========================================= */

.form-group {
    margin-bottom: 16px;
}

.form-group label {
    display: block;
    margin-bottom: 6px;
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--color-text-muted);
}

.form-input {
    width: 100%;
    padding: 12px 16px;
    font-size: 1rem;
    font-family: inherit;
    background: var(--color-bg);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    color: var(--color-text);
    transition: border-color 0.2s;
}

.form-input:focus {
    outline: none;
    border-color: var(--color-primary);
}

.form-input::placeholder {
    color: var(--color-text-muted);
}

.form-input-sm {
    padding: 8px 12px;
    font-size: 0.9rem;
}

.form-help {
    font-size: 0.8rem;
    color: var(--color-text-muted);
    margin-top: 4px;
}

.required {
    color: var(--color-danger);
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    font-weight: 500;
}

.checkbox-label input[type="checkbox"] {
    width: 20px;
    height: 20px;
    cursor: pointer;
    accent-color: var(--color-primary);
}

.form-row {
    display: flex;
    gap: 16px;
}

.form-row .form-group {
    flex: 1;
}

.form-row-inline {
    align-items: center;
}

.form-group-inline {
    display: flex !important;
    flex-direction: row !important;
    align-items: center !important;
    gap: 10px;
}

.form-group-inline label {
    display: inline-block !important;
    margin-bottom: 0 !important;
    white-space: nowrap;
    font-weight: 600;
    min-width: 80px;
    flex-shrink: 0;
    font-size: 0.85rem;
}

.form-group-inline .searchable-select,
.form-group-inline .form-input,
.form-group-inline textarea {
    flex: 1;
}

.form-group-inline textarea {
    min-height: 60px;
}

.form-inline {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: 12px;
}

.form-inline .form-group {
    margin-bottom: 0;
}

.form-help {
    font-size: 0.8rem;
    color: var(--color-text-muted);
    margin-top: 6px;
}

/* Searchable Select */
.searchable-select {
    position: relative;
}

.searchable-select .form-input {
    cursor: text;
}

.searchable-select .form-input.selected {
    background: rgba(29, 155, 240, 0.1);
    border-color: var(--color-primary);
}

.search-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-top: none;
    border-radius: 0 0 var(--radius-md) var(--radius-md);
    max-height: 400px;
    overflow-y: auto;
    z-index: 1100;
    display: none;
    box-shadow: var(--shadow);
}

.search-dropdown.active {
    display: block;
}

.search-option {
    padding: 6px 10px;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--color-border);
    transition: background 0.15s;
    font-size: 0.85rem;
}

.search-option:last-child {
    border-bottom: none;
}

.search-option:hover,
.search-option.highlighted {
    background: var(--color-surface-hover);
}

.search-option.add-new {
    color: var(--color-primary);
    font-weight: 500;
    position: sticky;
    top: 0;
    background: var(--color-surface);
    border-bottom: 1px solid var(--color-border);
}

.search-option.add-new:hover {
    background: rgba(29, 155, 240, 0.1);
}

.search-option .option-name {
    font-weight: 500;
    font-size: 0.85rem;
}

.search-option .option-phone {
    font-size: 0.75rem;
    color: var(--color-text-muted);
}

.search-option.hidden {
    display: none;
}

.search-no-results {
    padding: 16px;
    text-align: center;
    color: var(--color-text-muted);
    font-style: italic;
}

.info-table {
    width: 100%;
}

.info-table th,
.info-table td {
    padding: 10px 0;
    border-bottom: 1px solid var(--color-border);
}

.info-table th {
    text-align: left;
    font-weight: 500;
    color: var(--color-text-muted);
    width: 150px;
}

.inline-edit {
    display: flex;
    align-items: center;
    gap: 8px;
}

.inline-edit .form-input {
    width: auto;
    min-width: 200px;
}

/* =========================================
   Alerts
   ========================================= */

.alert {
    padding: 12px 16px;
    border-radius: var(--radius-md);
    margin-bottom: 16px;
    font-size: 0.9rem;
}

.alert-success {
    background: rgba(0, 186, 124, 0.15);
    color: var(--color-success);
    border: 1px solid rgba(0, 186, 124, 0.3);
}

.alert-error {
    background: rgba(244, 33, 46, 0.15);
    color: var(--color-danger);
    border: 1px solid rgba(244, 33, 46, 0.3);
}

/* =========================================
   Modal
   ========================================= */

.modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 1000;
    display: none;
    align-items: flex-start;
    justify-content: center;
    padding: 20px;
    padding-top: 5vh;
    overflow-y: auto;
}

.modal.active {
    display: flex;
}

.modal-backdrop {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
}

.modal-content {
    position: relative;
    background: var(--color-surface);
    border-radius: var(--radius-lg);
    width: 100%;
    max-width: 750px;
    max-height: 95vh;
    overflow-y: visible;
    overflow-x: visible;
    box-shadow: var(--shadow);
}

.modal-sm {
    max-width: 400px;
}

/* Modal z ikoną ostrzeżenia */
.modal-icon {
    font-size: 48px;
    margin-bottom: 8px;
    text-align: center;
}

.modal-icon.warning {
    animation: pulse-warning 1.5s ease-in-out infinite;
}

@keyframes pulse-warning {
    0%, 100% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.1); opacity: 0.8; }
}

/* Info dla długiej rezerwacji */
.long-res-info {
    background: var(--color-surface);
    border-radius: 12px;
    padding: 16px;
    margin-bottom: 16px;
}

.long-res-info .info-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 0;
}

.long-res-info .info-row:not(:last-child) {
    border-bottom: 1px solid var(--color-border);
}

.long-res-info .info-label {
    color: var(--color-text-secondary);
    font-size: 0.9rem;
}

.long-res-info .info-value {
    font-weight: 600;
    font-size: 1.1rem;
    color: var(--color-text);
}

.long-res-info .info-value.highlight {
    font-size: 1.4rem;
    font-weight: 700;
    color: #f59e0b;
    background: rgba(245, 158, 11, 0.15);
    padding: 4px 12px;
    border-radius: 8px;
}

.warning-text {
    text-align: center;
    color: var(--color-text-secondary);
    margin-top: 12px;
    font-size: 0.95rem;
}

/* Przycisk warning */
.btn-warning {
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
    color: white;
    border: none;
}

.btn-warning:hover {
    background: linear-gradient(135deg, #d97706 0%, #b45309 100%);
    transform: translateY(-1px);
}

#longReservationModal .modal-header {
    flex-direction: column;
    text-align: center;
    padding-bottom: 16px;
}

#longReservationModal .modal-header h3 {
    margin: 0;
    font-size: 1.25rem;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 24px;
    border-bottom: 1px solid var(--color-border);
}

.modal-header h3 {
    font-size: 1.1rem;
    font-weight: 600;
}

.modal-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    color: var(--color-text-muted);
    cursor: pointer;
    padding: 0;
    line-height: 1;
}

.modal-body {
    padding: 16px 20px;
}

.modal-body .form-group {
    margin-bottom: 10px;
}

.modal-body .form-input {
    padding: 8px 12px;
    font-size: 0.9rem;
}

.modal-body textarea.form-input {
    min-height: 50px;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    padding: 16px 24px;
    border-top: 1px solid var(--color-border);
}

/* =========================================
   Access Page
   ========================================= */

.access-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: linear-gradient(135deg, var(--color-bg) 0%, #1a2634 100%);
}

.access-container {
    width: 100%;
    max-width: 400px;
    padding: 20px;
}

.access-box {
    background: var(--color-surface);
    border-radius: var(--radius-lg);
    padding: 40px;
    text-align: center;
    border: 1px solid var(--color-border);
}

.access-icon {
    font-size: 3rem;
    margin-bottom: 20px;
}

.access-box h1 {
    font-size: 1.5rem;
    margin-bottom: 8px;
}

.access-subtitle {
    color: var(--color-text-muted);
    margin-bottom: 24px;
}

.access-form {
    margin-top: 24px;
}

.access-form .form-input {
    text-align: center;
}

.access-page .back-link {
    display: block;
    margin-top: 24px;
    font-size: 0.9rem;
}

/* =========================================
   Admin Layout
   ========================================= */

.admin-body {
    display: flex;
}

.admin-sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: var(--sidebar-width);
    background: var(--color-surface);
    border-right: 1px solid var(--color-border);
    display: flex;
    flex-direction: column;
    z-index: 100;
}

.sidebar-header {
    padding: 20px;
    border-bottom: 1px solid var(--color-border);
}

.sidebar-header a {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--color-text);
    text-decoration: none;
}

.sidebar-nav {
    flex: 1;
    padding: 16px 0;
    overflow-y: auto;
}

.sidebar-nav a {
    display: block;
    padding: 12px 20px;
    color: var(--color-text-muted);
    text-decoration: none;
    transition: all 0.2s;
}

.sidebar-nav a:hover {
    background: var(--color-surface-hover);
    color: var(--color-text);
}

.sidebar-nav a.active {
    background: rgba(29, 155, 240, 0.1);
    color: var(--color-primary);
    border-right: 3px solid var(--color-primary);
}

.sidebar-footer {
    padding: 16px 0;
    border-top: 1px solid var(--color-border);
}

.sidebar-footer a {
    display: block;
    padding: 12px 20px;
    color: var(--color-text-muted);
    text-decoration: none;
}

.sidebar-footer a.logout {
    color: var(--color-danger);
}

.admin-main {
    flex: 1;
    margin-left: var(--sidebar-width);
    min-height: 100vh;
    padding: 24px;
}

.admin-content {
    max-width: 1200px;
}

.admin-content h1 {
    font-size: 1.75rem;
    margin-bottom: 24px;
}

.page-header {
    margin-bottom: 24px;
}

.page-header .back-link {
    display: inline-block;
    margin-bottom: 12px;
    color: var(--color-text-muted);
    font-size: 0.9rem;
}

.page-description {
    color: var(--color-text-muted);
    font-size: 0.9rem;
    margin-top: 8px;
}

/* =========================================
   Cards
   ========================================= */

.card {
    background: var(--color-surface);
    border-radius: var(--radius-lg);
    border: 1px solid var(--color-border);
    margin-bottom: 24px;
}

.card-header {
    padding: 16px 20px;
    border-bottom: 1px solid var(--color-border);
}

.card-header h2 {
    font-size: 1rem;
    font-weight: 600;
}

.card-body {
    padding: 20px;
}

.card-danger {
    border-color: rgba(244, 33, 46, 0.3);
}

.card-danger .card-header {
    background: rgba(244, 33, 46, 0.1);
}

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

.cards-row .card {
    margin-bottom: 0;
}

/* =========================================
   Stats
   ========================================= */

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 32px;
}

.stat-card {
    background: var(--color-surface);
    border-radius: var(--radius-lg);
    padding: 24px;
    border: 1px solid var(--color-border);
    display: flex;
    align-items: center;
    gap: 16px;
}

.stat-icon {
    font-size: 2rem;
}

.stat-value {
    display: block;
    font-size: 2rem;
    font-weight: 700;
}

.stat-label {
    font-size: 0.85rem;
    color: var(--color-text-muted);
}

.quick-actions h2 {
    font-size: 1.1rem;
    margin-bottom: 16px;
    color: var(--color-text-muted);
}

.actions-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 16px;
}

.action-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    padding: 24px;
    background: var(--color-surface);
    border-radius: var(--radius-lg);
    border: 1px solid var(--color-border);
    text-decoration: none;
    color: var(--color-text);
    transition: all 0.2s;
}

.action-card:hover {
    border-color: var(--color-primary);
    transform: translateY(-2px);
    text-decoration: none;
}

.action-icon {
    font-size: 1.5rem;
}

/* =========================================
   Tables
   ========================================= */

.table {
    width: 100%;
    border-collapse: collapse;
}

.table th,
.table td {
    padding: 12px 16px;
    text-align: left;
    border-bottom: 1px solid var(--color-border);
}

.table th {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--color-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

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

.table tbody tr.row-muted {
    opacity: 0.5;
}

.table tbody tr.row-muted:hover {
    opacity: 0.7;
}

.table.table-compact th,
.table.table-compact td {
    padding: 8px 10px;
    font-size: 0.85rem;
}

.table .date-expired {
    color: var(--color-danger);
    font-weight: 600;
}

.table .date-warning {
    color: #f5a623;
    font-weight: 500;
}

.table .text-muted {
    color: var(--color-text-muted);
}

.table .actions {
    white-space: nowrap;
}

.table .actions form.inline {
    display: inline;
}

/* =========================================
   Badges
   ========================================= */

.badge {
    display: inline-block;
    padding: 4px 10px;
    font-size: 0.75rem;
    font-weight: 600;
    border-radius: 20px;
    text-transform: uppercase;
}

.badge-success {
    background: rgba(0, 186, 124, 0.15);
    color: var(--color-success);
}

.badge-danger {
    background: rgba(244, 33, 46, 0.15);
    color: var(--color-danger);
}

.badge-secondary {
    background: var(--color-surface-hover);
    color: var(--color-text-muted);
}

/* =========================================
   Status Info
   ========================================= */

/* Section title within cards */
.section-title {
    font-size: 1rem;
    font-weight: 600;
    color: var(--color-text);
    margin: 24px 0 16px 0;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--color-border);
}

.section-title:first-of-type {
    margin-top: 0;
}

/* Availability status box */
.availability-status {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px 20px;
    border-radius: var(--radius-md);
    margin-bottom: 20px;
}

.availability-status .availability-icon {
    font-size: 1.5rem;
}

.availability-status .availability-text {
    font-size: 1.1rem;
    font-weight: 600;
}

.availability-status.availability-enabled {
    background: rgba(0, 186, 124, 0.15);
    border: 2px solid rgba(0, 186, 124, 0.4);
    color: #00ba7c;
}

.availability-status.availability-disabled {
    background: rgba(244, 33, 46, 0.15);
    border: 2px solid rgba(244, 33, 46, 0.4);
    color: #f4212e;
}

.disable-form-section {
    margin-top: 24px;
    padding-top: 20px;
    border-top: 1px solid var(--color-border);
}

.disable-form-section h4 {
    margin-bottom: 16px;
    color: var(--color-text-muted);
}

.status-info {
    padding: 16px;
    border-radius: var(--radius-md);
    margin-bottom: 16px;
}

.status-info.status-enabled {
    background: rgba(0, 186, 124, 0.1);
    border: 1px solid rgba(0, 186, 124, 0.2);
}

.status-info.status-disabled {
    background: rgba(244, 33, 46, 0.1);
    border: 1px solid rgba(244, 33, 46, 0.2);
}

.status-info.status-warning {
    background: rgba(255, 173, 31, 0.1);
    border: 1px solid rgba(255, 173, 31, 0.2);
}

.status-info p {
    margin-bottom: 12px;
}

.status-info .btn {
    margin-top: 8px;
}

.status-info .form-group {
    margin-top: 16px;
}

/* =========================================
   Info Box
   ========================================= */

.info-box {
    background: rgba(29, 155, 240, 0.1);
    border: 1px solid rgba(29, 155, 240, 0.2);
    border-radius: var(--radius-md);
    padding: 16px;
    margin-bottom: 24px;
}

.info-box code {
    background: var(--color-bg);
    padding: 2px 8px;
    border-radius: var(--radius-sm);
    font-family: monospace;
}

.info-box-action {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px;
}

.info-box-content {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.info-box-form {
    flex-shrink: 0;
}

.info-box-form .btn-icon {
    font-weight: bold;
    margin-right: 4px;
}

/* =========================================
   Help Page
   ========================================= */

.help-page {
    max-width: 1200px;
    margin: 0 auto;
    padding: 32px 24px;
}

.help-header {
    text-align: center;
    margin-bottom: 40px;
}

.help-header h1 {
    font-size: 2rem;
    margin-bottom: 8px;
}

.help-header .help-subtitle {
    color: var(--color-text-muted);
    font-size: 1.1rem;
}

.help-header .back-link {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    background: var(--color-surface);
    border-radius: 12px;
    color: var(--color-text);
    margin-bottom: 24px;
    transition: all 0.2s ease;
}

.help-header .back-link:hover {
    background: var(--color-primary);
    color: white;
}

.help-content {
    display: grid;
    grid-template-columns: 250px 1fr;
    gap: 40px;
}

@media (max-width: 900px) {
    .help-content {
        grid-template-columns: 1fr;
    }
    
    .help-nav {
        position: static;
    }
}

.help-nav {
    position: sticky;
    top: 24px;
    height: fit-content;
    background: var(--color-surface);
    border-radius: var(--radius-lg);
    padding: 20px;
}

.help-nav h3 {
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--color-text-muted);
    margin-bottom: 16px;
}

.help-nav ul {
    list-style: none;
}

.help-nav li {
    margin-bottom: 8px;
}

.help-nav a {
    display: block;
    padding: 8px 12px;
    border-radius: var(--radius-sm);
    color: var(--color-text);
    transition: all 0.2s ease;
}

.help-nav a:hover {
    background: var(--color-bg);
    color: var(--color-primary);
}

.help-sections {
    display: flex;
    flex-direction: column;
    gap: 32px;
}

.help-section h2 {
    font-size: 1.5rem;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 2px solid var(--color-border);
}

.help-card {
    background: var(--color-surface);
    border-radius: var(--radius-lg);
    padding: 24px;
}

.help-card h4 {
    font-size: 1rem;
    margin: 20px 0 12px 0;
    color: var(--color-primary);
}

.help-card h4:first-child {
    margin-top: 0;
}

.help-card p {
    color: var(--color-text-secondary);
    line-height: 1.6;
    margin-bottom: 12px;
}

.help-card ul, .help-card ol {
    margin-left: 20px;
    margin-bottom: 16px;
}

.help-card li {
    margin-bottom: 8px;
    line-height: 1.5;
}

.help-card ul ul {
    margin-top: 8px;
    margin-bottom: 8px;
}

.help-tip, .help-warning, .help-action {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 16px;
    border-radius: var(--radius-md);
    margin: 16px 0;
}

.help-tip {
    background: rgba(29, 155, 240, 0.1);
    border: 1px solid rgba(29, 155, 240, 0.2);
}

.help-warning {
    background: rgba(255, 173, 31, 0.1);
    border: 1px solid rgba(255, 173, 31, 0.2);
}

.help-action {
    background: rgba(0, 186, 124, 0.1);
    border: 1px solid rgba(0, 186, 124, 0.2);
}

.tip-icon, .warning-icon, .action-icon {
    font-size: 1.2rem;
    flex-shrink: 0;
}

.status-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 0.85rem;
    font-weight: 500;
}

.status-badge.available {
    background: rgba(0, 186, 124, 0.2);
    color: #00ba7c;
}

.status-badge.busy {
    background: rgba(29, 155, 240, 0.2);
    color: #1d9bf0;
}

.status-badge.disabled {
    background: rgba(244, 33, 46, 0.2);
    color: #f4212e;
}

.status-badge.warning {
    background: rgba(255, 173, 31, 0.2);
    color: #ffad1f;
}

.tips-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 16px;
}

.tip-item {
    display: flex;
    gap: 16px;
    padding: 16px;
    background: var(--color-bg);
    border-radius: var(--radius-md);
}

.tip-number {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    background: var(--color-primary);
    color: white;
    border-radius: 50%;
    font-weight: bold;
    flex-shrink: 0;
}

.tip-item strong {
    display: block;
    margin-bottom: 4px;
}

.tip-item p {
    font-size: 0.9rem;
    margin: 0;
}

.help-footer {
    text-align: center;
    margin-top: 48px;
    padding-top: 24px;
    border-top: 1px solid var(--color-border);
    color: var(--color-text-muted);
}

/* =========================================
   Error Page
   ========================================= */

.error-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    text-align: center;
}

.error-container h1 {
    font-size: 6rem;
    color: var(--color-text-muted);
    margin-bottom: 16px;
}

.error-container p {
    color: var(--color-text-muted);
    margin-bottom: 24px;
}

/* =========================================
   Responsive
   ========================================= */

@media (max-width: 1024px) {
    .admin-sidebar {
        width: 200px;
    }
    
    .admin-main {
        margin-left: 200px;
    }
    
    --sidebar-width: 200px;
}

@media (max-width: 768px) {
    .header {
        padding: 0 16px;
    }
    
    .main-content {
        padding: 16px;
        padding-top: calc(var(--header-height) + 16px);
    }
    
    .vehicles-grid {
        grid-template-columns: 1fr;
    }
    
    .form-row {
        flex-direction: column;
    }
    
    .modal .form-row {
        flex-direction: row;
    }
    
    .modal .form-group-inline {
        display: flex !important;
        flex-direction: row !important;
        align-items: center !important;
    }
    
    .modal .form-group-inline label {
        min-width: 80px;
    }
    
    .admin-sidebar {
        transform: translateX(-100%);
    }
    
    .admin-main {
        margin-left: 0;
    }
    
    .cards-row {
        grid-template-columns: 1fr;
    }
}

/* =========================================
   Success Popup
   ========================================= */

.success-popup {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 2000;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
}

.success-popup.active {
    display: flex;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.popup-content {
    position: relative;
    background: linear-gradient(135deg, #1a2634 0%, #0f1419 100%);
    border: 2px solid var(--color-success);
    border-radius: var(--radius-lg);
    padding: 40px 50px;
    text-align: center;
    min-width: 320px;
    max-width: 450px;
    box-shadow: 0 20px 60px rgba(0, 186, 124, 0.3);
    animation: popIn 0.4s ease;
}

@keyframes popIn {
    from { 
        opacity: 0; 
        transform: scale(0.8) translateY(-20px);
    }
    to { 
        opacity: 1; 
        transform: scale(1) translateY(0);
    }
}

.popup-icon {
    font-size: 4rem;
    margin-bottom: 20px;
    animation: bounce 0.6s ease 0.2s;
}

@keyframes bounce {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.2); }
}

.popup-message h3 {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--color-success);
    margin-bottom: 8px;
}

.popup-message p {
    color: var(--color-text-muted);
    font-size: 0.95rem;
    line-height: 1.5;
}

.popup-timer {
    margin-top: 24px;
    height: 4px;
    background: var(--color-border);
    border-radius: 2px;
    overflow: hidden;
}

.timer-bar {
    height: 100%;
    background: var(--color-success);
    width: 100%;
    transition: width linear;
}

.popup-close {
    position: absolute;
    top: 12px;
    right: 12px;
    background: none;
    border: none;
    font-size: 1.5rem;
    color: var(--color-text-muted);
    cursor: pointer;
    padding: 4px 8px;
    line-height: 1;
    opacity: 0.7;
    transition: opacity 0.2s;
}

.popup-close:hover {
    opacity: 1;
}

/* =========================================
   Statistics Page
   ========================================= */

.stats-section {
    background: var(--color-surface);
    border-radius: var(--radius-lg);
    padding: 24px;
    margin-bottom: 24px;
}

.stats-section h2 {
    font-size: 1.2rem;
    margin-bottom: 20px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--color-border);
}

.stats-section h3 {
    font-size: 1rem;
    margin: 20px 0 12px 0;
    color: var(--color-text-muted);
}

/* Statistics page grid */
.statistics-page .stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 16px;
}

.statistics-page .stat-card {
    background: var(--color-bg);
    border-radius: var(--radius-md);
    padding: 16px;
    text-align: center;
    display: block;
}

.stat-card.stat-large {
    grid-column: span 2;
}

.stat-value {
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--color-primary);
    line-height: 1;
}

.stat-label {
    font-size: 0.85rem;
    color: var(--color-text-muted);
    margin-top: 8px;
}

.stat-details {
    font-size: 0.75rem;
    margin-top: 8px;
}

.stat-details-list {
    display: flex;
    flex-direction: column;
    gap: 2px;
    align-items: center;
}

.stat-details-list span {
    display: block;
    white-space: nowrap;
    font-size: 0.7rem;
}

/* Specjalna karta ze szczegółami - większa szerokość */
.stat-card:has(.stat-details-list) {
    min-width: 180px;
}

.text-success { color: var(--color-success); }
.text-warning { color: #f5a623; }
.text-danger { color: var(--color-danger); }
.text-muted { color: var(--color-text-muted); }

.progress-bar {
    height: 8px;
    background: var(--color-border);
    border-radius: 4px;
    margin-top: 12px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--color-primary), var(--color-success));
    border-radius: 4px;
    transition: width 0.5s ease;
}

.mini-progress {
    display: flex;
    align-items: center;
    gap: 8px;
}

.mini-progress-fill {
    flex: 1;
    height: 6px;
    background: var(--color-primary);
    border-radius: 3px;
}

.mini-progress span {
    font-size: 0.8rem;
    min-width: 45px;
    text-align: right;
}

.mini-bar {
    height: 8px;
    background: var(--color-primary);
    border-radius: 4px;
    min-width: 4px;
}

.stats-tables-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
    gap: 24px;
}

.stats-table-col {
    min-width: 0;
}

/* Alerts Section */
.alerts-section {
    border: 2px solid var(--color-warning);
    background: rgba(245, 166, 35, 0.05);
}

.alerts-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 16px;
}

.alert-card {
    background: var(--color-bg);
    border-radius: var(--radius-md);
    padding: 16px;
    border-left: 4px solid var(--color-border);
}

.alert-card h3 {
    margin: 0 0 12px 0;
    font-size: 0.95rem;
    color: var(--color-text);
}

.alert-card ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.alert-card li {
    padding: 6px 0;
    font-size: 0.85rem;
    border-bottom: 1px solid var(--color-border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
}

.alert-card li:last-child {
    border-bottom: none;
}

.alert-card.alert-danger {
    border-left-color: var(--color-danger);
}

.alert-card.alert-warning {
    border-left-color: #f5a623;
}

.alert-card.alert-info {
    border-left-color: var(--color-primary);
}

/* Bar Chart */
.chart-container {
    padding: 20px 0;
    overflow-x: auto;
}

.bar-chart {
    display: flex;
    align-items: flex-end;
    justify-content: space-around;
    height: 200px;
    gap: 8px;
    min-width: 600px;
}

.bar-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    flex: 1;
    max-width: 60px;
}

.bar {
    width: 100%;
    background: linear-gradient(180deg, var(--color-primary), rgba(29, 155, 240, 0.5));
    border-radius: 4px 4px 0 0;
    min-height: 4px;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    position: relative;
}

.bar-value {
    position: absolute;
    top: -22px;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--color-text);
}

.bar-label {
    margin-top: 8px;
    font-size: 0.7rem;
    text-align: center;
    color: var(--color-text-muted);
}

@media (max-width: 768px) {
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .stat-card.stat-large {
        grid-column: span 2;
    }
    
    .stats-tables-row {
        grid-template-columns: 1fr;
    }
    
    .alerts-grid {
        grid-template-columns: 1fr;
    }
}

/* =========================================
   Data Management Page
   ========================================= */

.data-stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 16px;
}

.data-stat {
    background: var(--color-bg);
    border-radius: var(--radius-md);
    padding: 16px;
    text-align: center;
}

.data-stat-value {
    display: block;
    font-size: 1.8rem;
    font-weight: 700;
    color: var(--color-primary);
}

.data-stat-label {
    display: block;
    font-size: 0.8rem;
    color: var(--color-text-muted);
    margin-top: 4px;
}

.info-text {
    color: var(--color-text-muted);
    font-size: 0.9rem;
    margin-bottom: 16px;
}

.info-text.text-danger {
    color: var(--color-danger);
}

.data-form {
    margin-top: 16px;
}

.data-form .form-row {
    display: flex;
    gap: 16px;
    margin-bottom: 16px;
}

.data-form .form-group {
    flex: 1;
}

.danger-section {
    padding: 20px 0;
}

.danger-section h3 {
    font-size: 1rem;
    margin-bottom: 8px;
    color: var(--color-danger);
}

.danger-divider {
    border: none;
    border-top: 1px solid var(--color-border);
    margin: 20px 0;
}

.export-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}

.card.card-danger {
    border: 2px solid var(--color-danger);
}

.card.card-danger .card-header {
    background: rgba(244, 33, 46, 0.1);
}

