/* assets/css/main.css */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

body {
    background-color: var(--bg-color);
    color: var(--text-color);
    transition: background-color 0.3s, color 0.3s; /* Płynne przejście */
}

/* --- LOGOWANIE --- */
.login-bg {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    background: linear-gradient(135deg, var(--primary-color), #00a2ff);
    padding: 1rem; /* Margines na małych telefonach */
}

.login-container {
    padding: 2.5rem 1.5rem;
    border-radius: 12px;
    box-shadow: 10px 10px 25px rgba(0,0,0,0.4);
    width: 100%;
    max-width: 420px;
    background-image: linear-gradient(rgba(255, 255, 255, 0.5), rgba(255, 255, 255, 0.4)), url('../../assets/img/background-log.png');
    background-position-x: center;
    background-position-y: center;
    background-size: cover;
}
.login-container img {
    width: 70px;
}
.login-header {
    margin-bottom: 20px;
}
.logo {
    display: flex;
    align-items: center;
    gap: 20px;
    margin-bottom: 20px;
}
.login-header h1 { color: var(--primary-color); font-size: 3rem; }
.login-header p {
    color: #191970;
    font-weight: bold;
    font-size: 1.3rem;
}
.form-group { margin-bottom: 1.5rem; }
.floating-group {
    position: relative;
    margin-bottom: 1.8rem !important; /* Większy odstęp na etykietę */
}
.floating-group img {
    width: 25px;
}

/* Kontener dla hasła, żeby ikona była w środku */
.password-wrapper {
    position: relative;
    width: 100%;
}

.floating-group input {
    width: 100%;
    padding: 1rem;
    border: 2px solid var(--primary-color); /* Mocniejsza ramka dla stylu Android */
    border-radius: 8px;
    font-size: 1.1rem;
    background-color: rgba(255, 255, 255, 0.6); /* Półprzezroczyste tło */
    outline: none;
    transition: all 0.4s ease;
}

/* Styl etykiety, która udaje placeholder */
.floating-group label {
    position: absolute;
    left: 1rem;
    top: 1rem;
    padding: 0 5px;
    color: #555;
    font-weight: normal;
    pointer-events: none; /* Kliknięcie przelatuje do inputa */
    transition: all 0.2s ease;
    background-color: transparent; /* Na początku przezroczysta */
}

/* --- MAGIA: Animacja do góry --- */
/* Gdy input ma focus LUB gdy NIE jest pusty (placeholder-shown nieaktywny) */
.floating-group input:focus + label,
.floating-group input:not(:placeholder-shown) + label {
    top: -25px;
    left: 10px;
    font-size: 0.85rem;
    font-weight: bold;
    color: #191970;
    background-color: transparent;
    padding: 0 10px;
    border-radius: 5px;
}

/* Specjalna poprawka dla ikony oka */
#togglePassword {
    position: absolute;
    right: 10px;
    top: 56%;
    transform: translateY(-50%);
    background: none;
    border: none;
    cursor: pointer;
    font-size: 1.2rem;
    z-index: 5;
}

/* Efekt po kliknięciu w input */
.floating-group input:focus {
    background-color: rgba(255, 255, 255, 0.6);
    box-shadow: 0 0 8px rgba(0, 86, 179, 0.2);
}

input:-webkit-autofill {
    /* Powoduje, że kolor tła przeglądarki nigdy nie "wskoczy" */
    transition: background-color 600000s ease-in-out 0s;
}

/* Duży przycisk */
.btn {
    display: inline-block;
    padding: 1rem 1.5rem;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 1.1rem;
    font-weight: bold;
    text-decoration: none;
    text-align: center;
    transition: background 0.3s;
}
.btn-primary { background-color: var(--primary-color); color: #fff; width: 100%; }
.btn-primary:hover { background-color: #004494; }
.btn-success { background-color: var(--secondary-color); color: var(--primary-color); box-shadow: 4px 4px 10px rgba(40, 167, 69, 0.72); }
.alert { padding: 1rem; margin-bottom: 1.5rem; border-radius: 6px; text-align: center; font-weight: bold;}
.alert-danger { background-color: #f8d7da; color: #721c24; border: 1px solid #f5c6cb; }
.alert-success { background-color: #bdc3c7; color: #007900;; border: 1px solid #f5c6cb;}
/* --- NAWIGACJA (HEADER) --- */
.navbar {
    background-color: var(--navbar-bg);
    color: var(--navbar-text);
    padding: 0 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    min-height: 70px;
}

.navbar-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
}

.navbar-brand {
    font-size: 3rem;
    font-weight: bold;
    color: var(--navbar-text);
    text-decoration: none;
}

.navbar-collapse {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    gap: 1.5rem;
}

.navbar-menu {
    list-style: none;
    display: flex;
    gap: 1.5rem;
    margin-left: 2rem;
}

.navbar-menu li a {
    color: #bdc3c7;
    text-decoration: none;
    font-weight: 500;
    padding: 1.5rem 0;
    display: block;
    transition: color 0.3s;
}

.navbar-menu li a:hover { color: #fff; }

.navbar-user {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.btn-logout {
    background-color: var(--danger-color);
    color: white;
    padding: 0.6rem 1.2rem;
    border-radius: 6px;
    text-decoration: none;
    font-weight: bold;
}

/* Przycisk Hamburger Menu (Domyślnie ukryty na PC) */
.mobile-menu-btn {
    display: none;
    background: none;
    border: none;
    cursor: pointer;
    padding: 10px;
}
.mobile-menu-btn span {
    display: block;
    width: 25px;
    height: 3px;
    background-color: white;
    margin: 5px 0;
    transition: 0.3s;
}

/* --- KONTENER GŁÓWNY --- */
.main-content {
    padding: 2rem;
    max-width: 1200px;
    margin: 0 auto;
}
.card {
    background: var(--card-bg); /* Zamiast #fff */
    color: var(--text-color);
    border-radius: 10px;
    padding: 2rem;
    box-shadow: 0 4px 6px rgba(0,0,0,0.05);
    margin-bottom: 1.5rem;
}

.grid-3 {
    display: grid;
    /* To automatycznie układa kafelki: na PC 3 w rzędzie, na tel 1 w rzędzie */
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 1.5rem;
}

.dashboard-header { 
    display: flex; 
    justify-content: space-between; 
    align-items: center; 
    margin-bottom: 20px; 
    flex-wrap: wrap; 
    gap: 15px; 
}
    
.kpi-grid { 
    display: grid; 
    grid-template-columns: 
    repeat(auto-fit, minmax(220px, 1fr)); 
    gap: 20px; 
    margin-bottom: 30px; 
}
.kpi-card { 
    background: var(--bg-color); 
    padding: 25px 20px; 
    border-radius: 10px; 
    box-shadow: 0 4px 6px var(--box-shadow); 
    border-left: 5px solid var(--primary-color); 
    text-align: center; 
    display: flex; 
    flex-direction: column; 
    justify-content: center;
}
.kpi-card h3 { 
    margin: 0; 
    font-size: 1.1rem; 
    color: var(--secondary-text-color); 
    font-weight: 600; 
    text-transform: uppercase; 
    letter-spacing: 0.5px;
}
.kpi-card .number {
    font-size: 2.5rem; 
    font-weight: bold; 
    color: var(--text-color); 
    margin: 10px 0 5px 0; 
    line-height: 1; 
}
.kpi-card .sub-text { 
    font-size: 0.9rem; 
    color: var(--secondary-text-color); 
}
    
.modules-grid { 
    display: grid; 
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); 
    gap: 20px; 
}
.module-card { 
    background: var(--bg-color); 
    padding: 25px; 
    border-radius: 10px; 
    box-shadow: 0 4px 6px var(--box-shadow); 
    text-align: center; 
    transition: transform 0.2s, box-shadow 0.2s; 
    text-decoration: none; 
    color: inherit; 
    display: block; 
    border: 1px solid #eee; 
}
.module-card:hover { 
    transform: translateY(-5px); 
    box-shadow: 0 8px 15px var(--box-shadow); 
    border-color: #ddd; 
}
.module-icon { 
    font-size: 3rem; 
    margin-bottom: 15px; 
}
.module-title { 
    font-size: 1.3rem; 
    font-weight: bold; 
    margin-bottom: 10px; 
    color: var(--text-color); 
}
.module-desc { 
    font-size: 0.95rem; 
    color: var(--secondary-text-color); 
}

.hero-search { 
    background: linear-gradient(135deg, #007bff, #0056b3); 
    padding: 40px 20px; 
    border-radius: 10px; 
    text-align: center; 
    color: white; 
    margin-bottom: 30px; 
    box-shadow: 0 5px 15px rgba(0,123,255,0.3); 
}
.hero-search h2 { 
    margin: 0 0 20px 0; 
    font-size: 2rem; 
}
    
.search-bar-wrapper { 
    position: relative; 
    max-width: 900px; 
    margin: 0 auto; 
    display: flex; 
    gap: 10px; 
}
.hero-input { 
    flex: 1; 
    padding: 18px 25px;
    background: var(--bg-color);
    color: var(--text-color); 
    font-size: 1.3rem; 
    border: none; 
    border-radius: 50px; 
    box-shadow: 0 4px 15px var(--box-shadow); 
    text-transform: uppercase; 
    font-weight: bold; 
    text-align: center; 
    box-sizing: border-box; 
    width: 100%;
}
.hero-input:focus { 
    outline: none; 
    box-shadow: 0 4px 20px var(--box-shadow); 
}
    
.btn-scan { 
    background: #28a745; 
    color: white; 
    border: none; 
    border-radius: 50px; 
    padding: 0 25px; 
    font-size: 1.2rem; 
    font-weight: bold; 
    cursor: pointer; 
    box-shadow: 0 4px 15px var(--box-shadow); 
    transition: 0.2s; 
    display: flex; 
    align-items: center; 
    gap: 8px; 
}
.btn-scan:hover { 
    background: #218838; 
    transform: scale(1.05); 
}

#liveSearchResults { 
    position: absolute; 
    top: 90%; 
    left: 26px;
    right: 26px; 
    background: var(--bg-color); 
    border-radius: 0 0 10px 10px; 
    box-shadow: 0 10px 25px var(--box-shadow); 
    margin-top: 5px; 
    z-index: 100; 
    text-align: left; 
    display: none; 
    overflow: hidden; 
    border: 1px solid #ddd; 
}
.search-result-item { 
    padding: 15px 20px; 
    border-bottom: 1px solid #eee; 
    display: flex; 
    justify-content: space-between; 
    align-items: center; 
    cursor: pointer; 
    text-decoration: none; 
    color: var(--text-color); 
    transition: background 0.2s; 
}
.search-result-item:hover { 
    background-color: var(--secondary-color); 
}
.search-plate { 
    font-size: 1.2rem; 
    font-weight: bold; 
    color: #007bff; 
}
.search-loc { 
    font-size: 0.95rem; 
    color: #dc3545; 
    font-weight: bold; 
    background: var(--secondary-color); 
    padding: 4px 10px; 
    border-radius: 20px; 
}
    
/* Sekcja Pojemności i Aktywności */
.dashboard-bottom { 
    display: grid; 
    grid-template-columns: 1fr 1fr; 
    gap: 20px; 
    margin-top: 30px; 
}

/* ========================================= */
/* MEDIA QUERIES - MAGIA DLA TELEFONÓW (MOBILE) */
/* ========================================= */
@media (max-width: 850px) {
    .login-container h1 {
        font-size: 2.5rem;
    }
    .navbar {
        flex-direction: column;
        padding: 1rem;
    }
    
    .mobile-menu-btn {
        display: block; /* Pokazujemy przycisk hamburgera */
    }
    
    .navbar-collapse {
        display: none; /* Ukrywamy menu domyślnie na telefonie */
        flex-direction: column;
        width: 100%;
        text-align: center;
    }
    
    .navbar-collapse.active {
        display: flex; /* Klasa dodawana przez JS */
    }
    
    .navbar-menu {
        flex-direction: column;
        margin-left: 0;
        gap: 0;
        width: 100%;
    }
    .navbar-menu li {
        border-bottom: 1px solid var(--input-border);
        width: 100%;
    }
    
    .navbar-menu li a {
        padding: 1rem; /* Duży obszar kliknięcia dla palca */
    }
    
    .navbar-user {
        flex-direction: column;
        width: 100%;
        margin-top: 1rem;
        gap: 1rem;
    }
    
    .user-greeting {
        display: block;
        margin-bottom: 0.5rem;
    }

    .btn-logout {
        width: 100%; /* Duży przycisk wylogowania */
        display: block;
    }

    .main-content {
        padding: 1rem; /* Mniejsze marginesy boczne na małym ekranie */
    }
    
    .card {
        padding: 1.5rem; /* Odrobinę węższe karty żeby oszczędzić miejsce */
    }
    .dashboard-bottom { 
        grid-template-columns: 1fr; 
    }
    .search-bar-wrapper {
        flex-direction: column; /* Układa elementy w pionie */
        gap: 15px; /* Nieco większy odstęp między inputem a przyciskiem */
    }

    .hero-input {
        width: 100%; /* Upewniamy się, że zajmuje całą szerokość */
    }

    .btn-scan {
        width: 100%; /* Przycisk rozciąga się na całą szerokość */
        justify-content: center; /* Wyśrodkowanie ikony i tekstu wewnątrz */
        padding: 15px; /* Większy obszar kliknięcia na telefonie */
    }

    /* Poprawka pozycjonowania wyników wyszukiwania na żywo */
    #liveSearchResults {
        right: 0 !important; /* Wyniki muszą teraz zajmować całą szerokość */
        width: 100%;
        left: 0;
        border-radius: 10px;
    }
}

/* --- FORMULARZE --- */
.form-control {
    background-color: var(--input-bg); /* Zamiast #fff */
    color: var(--text-color);
    border: 1px solid var(--input-border);
    width: 100%;
    padding: 0.8rem;
    border: 1px solid #ccc;
    border-radius: 6px;
    font-size: 1rem;
}

.form-control:focus {
    border-color: var(--primary-color);
    outline: none;
    box-shadow: 0 0 5px rgba(0, 86, 179, 0.3);
}

/* --- GLOBALNY MODAL --- */
.modal-overlay {
    display: flex;
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background-color: rgba(0, 0, 0, 0.6);
    z-index: 9999;
    align-items: center; justify-content: center;
    animation: modalFadeIn 0.2s;
}
.modal-box {
    background-color: var(--bg-color);
    width: 90%; max-width: 450px;
    border-radius: 8px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.3);
    overflow: hidden;
}
.modal-header { background-color: #ffc107; color: #000; padding: 15px 20px; }
.modal-header h3 { margin: 0; font-size: 1.2rem; }
.modal-body { padding: 20px; font-size: 1.1rem; }
.modal-footer { padding: 15px 20px; background-color: var(--bg-color); display: flex; justify-content: flex-end; gap: 10px; border-top: 1px solid #dee2e6; }
.btn-secondary { background-color: #6c757d; color: var(--bg-color); }

.tooltip {
    position: fixed;
    background-color: grey;
    color: #fff;
    padding: 5px;
    display: none;
}

.panel-card { 
        background: var(--bg-color); 
        padding: 25px; 
        border-radius: 10px; 
        box-shadow: 0 4px 6px rgba(0,0,0,0.05); 
        border: 1px solid #eee; 
    }
    .panel-title { 
        font-size: 1.2rem; 
        font-weight: bold; 
        color: var(--text-color); 
        border-bottom: 2px solid #eee; 
        padding-bottom: 10px; 
        margin-bottom: 20px; 
        display: flex; 
        align-items: center; 
        gap: 10px;
    }
    
    /* Progress Bar */
    .progress-bg { 
        background: var(--secondary-color); 
        border-radius: 10px; 
        height: 30px; 
        width: 100%; 
        overflow: hidden; 
        position: relative; 
        margin-bottom: 10px;
    }
    .progress-fill { 
        height: 100%; 
        transition: width 0.5s ease; 
        display: flex; 
        align-items: center; 
        justify-content: flex-end; 
        padding-right: 15px; 
        color: white; 
        font-weight: bold; 
        text-shadow: 1px 1px 2px rgba(0,0,0,0.5);
    }
    
    /* Ostatnia aktywność */
    .activity-list { 
        list-style: none; 
        padding: 0; 
        margin: 0; 
    }
    .activity-item { 
        display: flex; 
        justify-content: space-between; 
        padding: 12px 0; 
        border-bottom: 1px solid #eee; 
        font-size: 0.95rem;
    }
    .activity-item:last-child { 
        border-bottom: none; 
    }
    .act-time { 
        color: var(--secondary-text-color); 
        font-size: 0.85rem; 
        min-width: 120px;
    }
    .act-desc { 
        flex: 1; 
        color: var(--text-color); 
    }
    .act-plate { 
        font-weight: bold; 
        color: var(--primary-color); 
    }

    /* Modal skanera */
    #scannerModal { 
        display: none; 
        position: fixed; 
        top: 0; 
        left: 0; 
        width: 100%; 
        height: 100%; 
        background: rgba(0,0,0,0.9); 
        z-index: 99999; 
        flex-direction: column; 
        align-items: center; 
        justify-content: center; 
    }
    #reader { 
        width: 100%; 
        max-width: 500px; 
        background: white;
        border-radius: 10px; 
        overflow: hidden; 
    }
.container-spinner {
    margin-top: 100px;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
}
.dots-spinner {
    position: relative;
    width: 40px;
    height: 40px;
}
.dots-spinner div {
    position: absolute;   /* KLUCZOWE */
    top: 50%;
    left: 50%;
    width: 10px;
    height: 10px;
    background: var(--primary-color);
    border-radius: 50%;
    transform-origin: -15px 0;
    animation: spin 1.2s linear infinite;
}

/* ustawienie kropek + opóźnienia + rozmiar */
.dots-spinner div:nth-child(1) { transform: rotate(0deg);   animation-delay: 0s;   }
.dots-spinner div:nth-child(2) { transform: rotate(45deg);  animation-delay: 0.1s; width: 9px; height: 9px; }
.dots-spinner div:nth-child(3) { transform: rotate(90deg);  animation-delay: 0.2s; width: 8px; height: 8px; }
.dots-spinner div:nth-child(4) { transform: rotate(135deg); animation-delay: 0.3s; width: 7px; height: 7px; }
.dots-spinner div:nth-child(5) { transform: rotate(180deg); animation-delay: 0.4s; width: 6px; height: 6px; }
.dots-spinner div:nth-child(6) { transform: rotate(225deg); animation-delay: 0.5s; width: 7px; height: 7px; }
.dots-spinner div:nth-child(7) { transform: rotate(270deg); animation-delay: 0.6s; width: 8px; height: 8px; }
.dots-spinner div:nth-child(8) { transform: rotate(315deg); animation-delay: 0.7s; width: 9px; height: 9px; }

.form-input { background: var(--card-bg); color: var(--text-color); width: 100%; padding: 8px; border: 1px solid #ced4da; border-radius: 4px; box-sizing: border-box; }
.form-input:focus { border-color: #80bdff; outline: none; box-shadow: 0 0 0 0.2rem rgba(0,123,255,.25); }
.break { flex-basis: 100%; height: 0; margin: 0; }

@keyframes spin {
  0% {
    transform: rotate(0deg) translateX(15px);
    opacity: 1;
  }
  100% {
    transform: rotate(360deg) translateX(15px);
    opacity: 0.3;
  }
}

@keyframes modalFadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}