/* OGÓLNE USTAWIENIA */
body, html {
    height: 100%; margin: 0;
    background: radial-gradient(circle at center, #1a1a1a 0%, #0a0a0a 100%);
    color: white; font-family: 'Segoe UI', Tahoma, sans-serif; overflow: hidden;
}

body::before {
    content: ""; position: absolute; top: 0; left: 0; width: 100%; height: 100%;
    background: url('https://www.transparenttextures.com/patterns/carbon-fibre.png');
    opacity: 0.1; pointer-events: none; z-index: -1;
}

.full-screen-center { display: flex; justify-content: center; align-items: center; height: 100vh; width: 100%; }

.btn-enter { 
    background: #007bff; color: #fff; padding: 15px 50px; border: none; cursor: pointer; 
    font-weight: bold; border-radius: 8px; font-size: 1.4rem; transition: 0.3s;
    box-shadow: 0 4px 15px rgba(0, 123, 255, 0.4); text-transform: uppercase;
}

.modal { 
    display: none; position: fixed; width: 100%; height: 100%; 
    background: rgba(0,0,0,0.95); z-index: 1000; justify-content: center; align-items: center;
}

/* KARTY */
.modal-content, .form-card {
    background: #161616; padding: 35px; border-radius: 12px; border: 1px solid #333;
    display: none; flex-direction: column; align-items: center; gap: 20px;
    width: 380px; box-sizing: border-box; animation: fadeIn 0.4s ease-out;
}

/* DODATEK: Ograniczenie wysokości i przewijanie dla formularzy */
.form-card {
    max-height: 90vh; /* Maksymalnie 90% wysokości ekranu */
    overflow-y: auto; /* Włącz przewijanie jeśli treść się nie mieści */
    justify-content: flex-start; /* Żeby treść zaczynała się od góry */
}

/* Stylizacja paska przewijania (Scrollbar) dla nowoczesnego wyglądu */
.form-card::-webkit-scrollbar {
    width: 8px;
}
.form-card::-webkit-scrollbar-track {
    background: rgba(0,0,0,0.1);
}
.form-card::-webkit-scrollbar-thumb {
    background: #4b5563;
    border-radius: 4px;
}
.form-card::-webkit-scrollbar-thumb:hover {
    background: #007bff;
}

/* POPRAWKA: Formularz logowania musi być widoczny w sekcji #loginPage */
#loginPage .modal-content {
    display: flex !important;
}

/* DASHBOARD I NAV */
.dashboard-container { width: 100%; height: 100vh; display: flex; flex-direction: column; }
.top-nav { 
    background: rgba(10, 10, 10, 0.95); /* Lekka przezroczystość */
    backdrop-filter: blur(10px);        /* Rozmycie tła pod paskiem */
    padding: 15px 40px; 
    display: flex; 
    justify-content: space-between;     /* Logo z lewej, przyciski z prawej */
    align-items: center;
    gap: 20px; 
    border-bottom: 1px solid #333;
    box-shadow: 0 4px 20px rgba(0,0,0,0.5);
    z-index: 100;
}

/* Komunikaty błędów (Logowanie) */
.error-msg {
    color: #ef4444; /* Czerwony */
    font-weight: 600;
    margin-top: 10px;
    text-align: center;
}

/* --- NOWOCZESNE INPUTY Z IKONAMI --- */
.input-wrapper {
    position: relative;
    width: 100%;
    display: flex;
    align-items: center;
}

.input-wrapper i {
    position: absolute;
    left: 15px;
    color: #6b7280; /* Szary kolor ikony */
    pointer-events: none; /* Żeby kliknięcie w ikonę aktywowało input */
    transition: color 0.3s ease;
    z-index: 10;
}

.input-wrapper input {
    padding-left: 45px !important; /* Robimy miejsce na ikonę */
}

.input-wrapper input:focus + i {
    color: #3b82f6; /* Ikona świeci na niebiesko gdy piszesz */
}

/* STYL LOGO MECHANIK */
.nav-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 1.8rem;
    font-weight: 800; /* Bardzo gruby font */
    letter-spacing: -1px;
    user-select: none;
}

.brand-icon {
    color: #007bff;
    filter: drop-shadow(0 0 8px rgba(0, 123, 255, 0.5)); /* Świecąca ikona */
}

.brand-text {
    background: linear-gradient(135deg, #ffffff 0%, #007bff 100%); /* Gradient Biały -> Niebieski */
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent; /* Tekst przezroczysty, widać tło (gradient) */
}

.nav-btn { 
    background: #222; color: #ccc; border: 1px solid #444; padding: 10px 20px; 
    border-radius: 5px; cursor: pointer; transition: 0.3s;
}
.nav-btn:hover { background: #007bff; color: white; }

/* INPUTY I PRZYCISKI - FIX SZEROKOŚCI */
input { 
    padding: 12px; border-radius: 5px; border: 1px solid #333; 
    background: #fff; color: #000; width: 100%; font-size: 1rem; 
    box-sizing: border-box; 
}

.btn-submit { 
    background: #28a745; color: white; padding: 12px; border: none; 
    border-radius: 5px; font-weight: bold; cursor: pointer; width: 100%; 
    box-sizing: border-box; transition: 0.3s;
}
.btn-submit:hover { background: #218838; }

/* Przycisk o automatycznej szerokości (nie 100%) */
.btn-auto-width {
    width: auto !important;
    padding-left: 25px;
    padding-right: 25px;
    white-space: nowrap;
}

.btn-cancel { 
    background: transparent; color: #888; border: 1px solid #444; 
    padding: 10px; width: 100%; border-radius: 5px; cursor: pointer; 
    box-sizing: border-box; transition: 0.3s;
}
.btn-cancel:hover { background: #333; color: #fff; }

/* STYL DLA PRZYCISKÓW POWROTU (LINKÓW) */
.btn-link-back {
    background: transparent;
    border: none;
    color: #6b7280; /* Szary, nienachalny kolor */
    cursor: pointer;
    margin-top: 20px;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    transition: color 0.2s;
}

.btn-link-back:hover {
    color: #007bff; /* Podświetlenie na niebiesko */
    text-decoration: none;
}

/* FORMULARZE - ESTETYKA (image_9cc77e.png & image_9cc719.png) */
#specForm, #addInvoiceForm, #loginForm {
    width: 100%; display: flex; flex-direction: column; gap: 15px;
}

#specForm div {
    display: grid; grid-template-columns: 1fr 1fr; gap: 10px; width: 100%;
}

/* CHECKBOXY */
.checkbox-group { display: flex; flex-direction: column; gap: 15px; width: 100%; margin: 10px 0; }
.checkbox-group label { display: flex; align-items: center; gap: 10px; cursor: pointer; font-size: 1.1rem; }
.checkbox-group input { width: 18px; height: 18px; margin: 0; }

/* INFORMACJE - UKŁAD OBOK SIEBIE */
.info-grid { 
    display: flex; flex-direction: row; justify-content: space-between; 
    gap: 20px; width: 100%; 
}
.info-col { flex: 1; text-align: center; }
.info-col h4 { color: #fff; margin-bottom: 10px; font-size: 1.1rem; border-bottom: 1px solid #007bff; padding-bottom: 5px; }
.info-data-box { color: #ccc; font-size: 0.9rem; min-height: 50px; }

/* TABELA WYNIKÓW - DATA I OPIS ODDZIELNIE */
.history-table-header {
    display: grid; grid-template-columns: 120px 1fr; width: 100%;
    background: #007bff; padding: 10px; border-radius: 5px 5px 0 0;
    font-weight: bold; font-size: 0.9rem; box-sizing: border-box;
}

.history-list-container {
    width: 100%; max-height: 300px; overflow-y: auto;
    background: rgba(255,255,255,0.05); border-radius: 0 0 5px 5px;
}

.history-item {
    display: grid; grid-template-columns: 120px 1fr; width: 100%;
    padding: 12px 10px; border-bottom: 1px solid #333;
    font-size: 0.9rem; align-items: center; box-sizing: border-box; text-align: left;
}




/* --- Nowoczesna tabela wynik�w (Klasy) --- */

/* Kontener na wyniki */
.history-results-area {
    margin-top: 25px;
    width: 100%;
    overflow-x: auto;
    border-radius: 12px;
    background: #1a1a1a;
    box-shadow: 0 8px 24px rgba(0,0,0,0.6);
    border: 1px solid #333;
}

/* Tabela */
.history-results-area table {
    width: 100%;
    border-collapse: collapse;
    color: #f0f0f0;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

/* Nag��wki */
.history-results-area th {
    background: #252525;
    color: #e67e22; /* Tw�j pomara�czowy kolor */
    text-align: left;
    padding: 16px;
    text-transform: uppercase;
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 1.5px;
    border-bottom: 2px solid #e67e22;
}

/* Kom�rki */
.history-results-area td {
    padding: 14px 16px;
    border-bottom: 1px solid #2a2a2a;
    font-size: 0.9rem;
    line-height: 1.4;
}

/* Efekt najechania na wiersz */
.history-results-area tr:hover {
    background: #2c2c2c;
    transition: background 0.2s ease;
}

/* Ostatni wiersz bez linii na dole */
.history-results-area tr:last-child td {
    border-bottom: none;
}

/* Stylowanie status�w (je�li chcesz mie� kolory) */
.status-gotowe { color: #2ecc71; font-weight: bold; }
.status-w-trakcie { color: #3498db; font-weight: bold; }
.status-oczekuje { color: #e74c3c; font-weight: bold; }

/* Komunikat o braku wynik�w */
.no-results {
    color: #888;
    text-align: center;
    padding: 30px;
    font-style: italic;
}

.h-date { color: #007bff; font-weight: bold; }
.h-desc { color: #ccc; line-height: 1.4; }


/* --- POPRAWKI UJEDNOLICAJĄCE POLA I FILTR DATY --- */

/* Wspólna klasa dla wszystkich inputów, selectów i textarea w formularzach */
.form-input-unified {
    width: 100%;
    padding: 12px;
    margin: 8px 0;
    border: 1px solid #333;
    border-radius: 5px;
    background: #ffffff; /* Białe tło zgodnie z Twoim screenem */
    color: #000000;      /* Czarny tekst dla kontrastu na białym tle */
    font-size: 1rem;
    box-sizing: border-box;
    font-family: inherit;
    transition: border-color 0.3s;
}

.form-input-unified:focus {
    border-color: #007bff;
    outline: none;
}

/* Specyficzne poprawki dla pol typu date (kalendarz) */
input[type="date"].form-input-unified {
    cursor: pointer;
    text-transform: uppercase;
}

/* Kontener filtra daty w sekcji Aktualne Zlecenia */
.date-filter-container {
    background: #1f2937;
    padding: 8px 15px;
    border-radius: 50px; /* Pastylka */
    border: 1px solid #374151;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    margin-bottom: 20px;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

.date-filter-container label {
    margin: 0;
    color: #9ca3af;
    font-size: 0.9rem;
    font-weight: 600;
}

/* Przycisk odświeżania obok daty */
.btn-refresh {
    background: #3b82f6;
    color: white;
    border: none;
    padding: 6px 12px;
    border-radius: 20px;
    cursor: pointer;
    font-weight: 600;
    font-size: 0.85rem;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 5px;
}

.btn-refresh:hover {
    background: #2563eb;
    box-shadow: 0 0 10px rgba(59, 130, 246, 0.5);
}

/* Stylizacja inputa daty w filtrze */
input[type="date"].date-input {
    background: transparent;
    border: none;
    color: #f3f4f6;
    font-family: 'Inter', sans-serif;
    font-size: 0.95rem;
    padding: 5px;
    width: auto;
    cursor: pointer;
    color-scheme: dark; /* MAGICZNA LINIA: zmienia systemowy kalendarz na ciemny */
}

input[type="date"].date-input:focus {
    outline: none;
    color: #60a5fa;
}

/* Zapewnienie ciemnego kalendarza również w formularzu zlecenia */
#job-data {
    color-scheme: dark;
}

/* Ikona kalendarza (webkit) dla ciemnych/przezroczystych pól (np. filtr daty) */
input[type="date"].date-input::-webkit-calendar-picker-indicator {
    cursor: pointer;
    filter: invert(1) opacity(0.6); /* Biała ikona */
    transition: 0.2s;
}
input[type="date"].date-input::-webkit-calendar-picker-indicator:hover {
    opacity: 1;
}

/* Poprawka dla ikony kalendarza na jasnym tle (formularz zlecenia) */
#job-data::-webkit-calendar-picker-indicator {
    filter: none; /* Użyj domyślnej, ciemnej ikony systemowej */
}

/* Przycisk "Dodaj kolejną pozycję" - Nowoczesny styl */
.btn-small-secondary {
    width: 100%;
    background: rgba(55, 65, 81, 0.3); /* Przezroczyste tło */
    color: #9ca3af;
    border: 2px dashed #4b5563; /* Przerywana linia */
    padding: 12px;
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    margin-top: 15px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.btn-small-secondary:hover {
    background: rgba(59, 130, 246, 0.1);
    border-color: #3b82f6; /* Niebieski przy hover */
    color: #3b82f6;
}

.btn-small-secondary i {
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.btn-small-secondary:hover i {
    transform: rotate(90deg) scale(1.2);
}

/* Zapewnienie, że etykiety w grupach są czytelne */
.form-group label {
    display: block;
    width: 100%;
    text-align: left;
    margin-bottom: 5px;
    color: #aaa;
    font-size: 0.9rem;
}

/* Wiersz wyszukiwania (Input + Przycisk obok siebie) */
.search-bar-row {
    display: flex;
    gap: 10px;
    width: 100%;
    align-items: center; /* Wyrównanie w pionie */
}

/* Naprawa układu przycisków wyboru trybu (VIN/Tel) - dodanie odstępu */
.button-row-center {
    display: flex;
    justify-content: center;
    gap: 20px;
    width: 100%;
    margin-bottom: 25px;
}

/* Poprawka dla textarea, aby nie zmieniała szerokości */
textarea.form-input-unified {
    resize: vertical;
    min-height: 80px;
}

/* POZOSTAŁE */
.button-row { display: flex; gap: 10px; width: 100%; }

.action-buttons {
    display: flex;
    gap: 1rem;
    margin-top: 1.5rem;
}

.content { flex-grow: 1; display: flex; justify-content: center; align-items: center; flex-direction: column; }

@keyframes fadeIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }

@keyframes shake {
    0% { transform: translateX(0); }
    25% { transform: translateX(-5px); }
    50% { transform: translateX(5px); }
    75% { transform: translateX(-5px); }
    100% { transform: translateX(0); }
}

/* Animacja potrząsania przy błędzie logowania */
.shake {
    animation: shakeAnim 0.3s ease-in-out;
}

@keyframes shakeAnim {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-8px); }
    50% { transform: translateX(8px); }
    75% { transform: translateX(-8px); }
}

/* Upewnij się, że Twoje nowe sekcje mają poprawne tło */
#registration-section, #search-section {
    background: radial-gradient(circle at center, #1a1a1a 0%, #0a0a0a 100%) !important;
}

/* NOWE STYLE DLA EKRANU STARTOWEGO */
.start-card {
    background: rgba(22, 22, 22, 0.95);
    padding: 40px;
    border-radius: 16px;
    border: 1px solid #333;
    text-align: center;
    box-shadow: 0 10px 30px rgba(0,0,0,0.5);
    max-width: 400px;
    width: 90%;
    animation: fadeIn 0.5s ease-out;
}

.start-buttons-container {
    display: flex;
    flex-direction: column;
    gap: 15px;
    margin-top: 20px;
    width: 100%;
}

.form-section-label {
    color: #9ca3af;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 10px;
    border-bottom: 1px solid #374151;
    padding-bottom: 5px;
    margin-top: 5px;
}

/* --- UTILITY CLASSES (Wsparcie dla layoutu) --- */
.flex-row { display: flex; gap: 10px; width: 100%; align-items: center; }
.flex-1 { flex: 1; }
.flex-2 { flex: 2; }
.flex-3 { flex: 3; }

/* =========================================
   MEDIA QUERIES (RESPONSYWNOŚĆ NA TELEFONY)
   ========================================= */
@media (max-width: 768px) {
    /* 1. Nawigacja - pionowa */
    .top-nav {
        flex-direction: column;
        padding: 15px;
        gap: 15px;
    }
    
    .nav-links {
        display: flex;
        flex-wrap: wrap;
        justify-content: center;
        gap: 10px;
        width: 100%;
    }
    
    .nav-btn {
        flex: 1 1 40%; /* Przyciski zajmują ok połowę szerokości każdy */
        font-size: 0.85rem;
        padding: 10px;
        justify-content: center;
        white-space: nowrap;
    }

    /* 2. Karty i kontenery - na całą szerokość */
    .form-card, .login-card, .section-card, .modal-content, .card-large, .card-xl {
        width: 95% !important;
        max-width: none !important;
        padding: 20px !important;
        margin: 10px auto;
    }
    
    .content {
        padding: 10px;
        justify-content: flex-start;
    }

    /* 3. Formularze i Siatki (Grid) - zamiana na pion */
    .grid-2-col, .grid-2-col-asym, #specForm div {
        grid-template-columns: 1fr !important;
        gap: 0;
    }

    .form-group {
        margin-bottom: 10px;
    }
    
    /* Inputy i przyciski w jednej linii (np. szukanie) */
    .search-bar-row {
        flex-direction: column;
    }
    .btn-auto-width {
        width: 100% !important;
    }
    
    /* Wiersze w zleceniu (Opis + Cena) - jeden pod drugim */
    .job-item-row.flex-row {
        flex-direction: column;
        align-items: stretch;
        background: rgba(255,255,255,0.03);
        padding: 10px;
        border-radius: 8px;
        margin-bottom: 10px;
    }
    
    .job-item-row input {
        width: 100% !important;
        margin: 5px 0 !important;
    }

    /* 4. Przyciski akcji (Zapisz/Anuluj) - jeden pod drugim */
    .action-buttons {
        flex-direction: column;
    }
    .alert-expired {
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid #ef4444;
    color: #f87171;
    padding: 15px;
    border-radius: 8px;
    margin-bottom: 20px;
    text-align: center;
    font-size: 0.9rem;
    line-height: 1.5;
}
.alert-expired i {
    display: block;
    font-size: 2rem;
    margin-bottom: 10px;
}
}