/* ==========================================================================
   Kopogtató Alkalmazás - Fő Stíluslap
   Verzió: 1.1 (Reszponzív Header Javítással)
   ========================================================================== */

/* 
TARTALOMJEGYZÉK
--------------------
1. ALAPBEÁLLÍTÁSOK ÉS VÁLTOZÓK
2. ÁLTALÁNOS KOMPONENSEK
3. FŐ ELRENDEZÉSI ELEMEK
4. OLDALSPECIFIKUS STÍLUSOK
    4.1. Bejelentkezés és Kapcsolódó Oldalak
    4.2. Aktivista Felület (Térkép)
    4.3. Adminisztrátori Felület
5. KOMPONENS-SPECIFIKUS STÍLUSOK
    5.1. Adatfelvételi Varázsló
    5.2. Dashboard
    5.3. Modern Táblázat
6. RESZPONZÍV VISELKEDÉS (@media)
--------------------
*/

/* ==========================================================================
   1. ALAPBEÁLLÍTÁSOK ÉS VÁLTOZÓK
   ========================================================================== */

:root {
    --color-positive: #28a745;
    --color-negative: #dc3545;
    --color-neutral: #007bff;
    --color-unavailable: #6c757d;
    --color-rejected: #343a40;
}

html {
    box-sizing: border-box;
}
*, *:before, *:after {
    box-sizing: inherit;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    margin: 0;
    background-color: #f4f6f9;
    color: #212529;
    line-height: 1.5;
}

/* ==========================================================================
   2. ÁLTALÁNOS KOMPONENSEK
   ========================================================================== */

/* Gombok */
.btn {
    display: inline-block;
    padding: 10px 16px;
    border-radius: 4px;
    text-decoration: none;
    font-size: 14px;
    font-weight: bold;
    cursor: pointer;
    border: none;
    transition: background-color 0.2s ease;
}
.btn-flat { background-color: var(--color-neutral); color: white; }
.btn-flat:hover { background-color: #0056b3; }
.btn-secondary { background-color: #6c757d; color: white; }
.btn-secondary:hover { background-color: #5a6268; }
.btn-logout { background-color: #dc3545; color: white; }
.btn-logout:hover { background-color: #c82333; }
.btn-sm { padding: 5px 10px; font-size: 12px; }

/* Űrlapok */
form .form-group { margin-bottom: 15px; }
form label { display: block; margin-bottom: 5px; font-weight: 500; }
form input, form select, form textarea { width: 100%; padding: 10px; box-sizing: border-box; border: 1px solid #ccc; border-radius: 4px; }
.autocomplete-container { position: relative; }
.autocomplete-items { position: absolute; border: 1px solid #d4d4d4; z-index: 1010; top: 100%; left: 0; right: 0; background-color: #fff; }
.autocomplete-items div { padding: 10px; cursor: pointer; border-bottom: 1px solid #d4d4d4; }
.autocomplete-items div:hover { background-color: #e9e9e9; }
.help-text { font-size: 0.9em; color: #6c757d; background-color: #f8f9fa; padding: 10px; border-radius: 4px; margin-top: 0; }

/* Üzenetdobozok (Alert) */
.alert { padding: 1rem; margin-bottom: 1rem; border: 1px solid transparent; border-radius: .25rem; }
.alert-success { color: #155724; background-color: #d4edda; border-color: #c3e6cb; }
.alert-danger { color: #721c24; background-color: #f8d7da; border-color: #f5c6cb; }
.alert-danger p { margin: 0; }

/* ==========================================================================
   3. FŐ ELRENDEZÉSI ELEMEK
   ========================================================================== */

header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 20px;
    background: #fff;
    border-bottom: 1px solid #dee2e6;
}
header .logo {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: bold;
}
header .logo img { height: 40px; }

main { position: relative; }

.modal { display: none; position: fixed; z-index: 1020; left: 0; top: 0; width: 100%; height: 100%; overflow: auto; background-color: rgba(0,0,0,0.5); }
.modal-content { background-color: #fefefe; margin: 5% auto; padding: 20px; border: 1px solid #888; width: 90%; max-width: 500px; border-radius: 5px; }
.close-btn { color: #aaa; float: right; font-size: 28px; font-weight: bold; cursor: pointer; }

/* ==========================================================================
   4. OLDALSPECIFIKUS STÍLUSOK
   ========================================================================== */

/* 4.1. Bejelentkezés és Kapcsolódó Oldalak */
.login-page-wrapper { display: flex; flex-direction: column; justify-content: center; align-items: center; min-height: 100vh; background-color: #f0f2f5; padding: 20px; }
.login-box { width: 100%; max-width: 400px; background: #fff; padding: 2rem 2.5rem; box-shadow: 0 4px 12px rgba(0,0,0,0.1); border-radius: 8px; text-align: center; }
.login-header { margin-bottom: 1.5rem; padding-bottom: 1.5rem; border-bottom: 1px solid #e9ecef; }
.login-header .login-logo { max-width: 100px; height: auto; margin-bottom: 1rem; }
.login-header h1 { font-size: 1.4rem; margin: 0 0 0.25rem 0; color: #212529; }
.login-header p { font-size: 0.95rem; color: #6c757d; margin: 0; }
#login-form h2 { font-size: 1.2rem; font-weight: 600; color: #343a40; margin-top: 0; margin-bottom: 1rem; text-align: center; }
#error-message { color: #dc3545; background-color: #f8d7da; border: 1px solid #f5c6cb; border-radius: 4px; padding: 10px; margin-bottom: 1rem; text-align: center; min-height: 1.2em; display: none; }
#error-message:not(:empty) { display: block; }
.form-links { text-align: center; margin-top: 1.5rem; padding-top: 1.5rem; border-top: 1px solid #e9ecef; font-size: 0.9em; }
.form-links a { color: #007bff; text-decoration: none; display: block; margin-bottom: 0.5rem; transition: text-decoration 0.2s ease; }
.form-links a:hover { text-decoration: underline; }
.form-links a:last-child { margin-bottom: 0; }

/* 4.2. Aktivista Felület (Térkép) */
#map { height: calc(100vh - 61px); width: 100%; }
.welcome-message { color: #555; font-weight: 500; }
.fab { position: fixed; bottom: 30px; right: 30px; width: 60px; height: 60px; border-radius: 50%; background: var(--color-neutral); color: white; font-size: 30px; border: none; cursor: pointer; box-shadow: 0 4px 8px rgba(0,0,0,0.2); z-index: 1000; }

/* 4.3. Adminisztrátori Felület */
.admin-wrapper { display: flex; }
.sidebar { width: 220px; background-color: #343a40; color: white; min-height: 100vh; padding: 15px; flex-shrink: 0; }
.sidebar h3 { text-align: center; border-bottom: 1px solid #495057; padding-bottom: 10px; margin-top: 0; }
.sidebar nav ul { list-style: none; padding: 0; margin: 0; }
.sidebar nav a { display: block; padding: 10px 15px; color: #ced4da; text-decoration: none; border-radius: 4px; }
.sidebar nav a:hover { background-color: #495057; color: white; }
.admin-content { flex-grow: 1; padding: 20px; }
.admin-content h1, .admin-content h2 { border-bottom: 1px solid #ddd; padding-bottom: 10px; margin-bottom: 20px; }
.admin-main-header { display: none; }
.filter-bar { background: white; padding: 15px; border-radius: 5px; box-shadow: 0 1px 3px rgba(0,0,0,0.1); margin-bottom: 20px; }
.filter-bar form { display: flex; flex-wrap: wrap; gap: 15px; align-items: flex-end; }
.filter-group { flex: 1 1 150px; min-width: 150px; }
.filter-group.filter-buttons { flex-grow: 0; display: flex; gap: 10px; }
.filter-bar select, .filter-bar input[type="date"], .filter-bar button { width: 100%; padding: 10px; font-size: 14px; border: 1px solid #ccc; border-radius: 4px; }
/* Kiegészítés a filter-bar-hoz */
.filter-group label {
    display: block;
    font-size: 12px;
    font-weight: 500;
    margin-bottom: 4px;
    color: #6c757d;
}
/* ==========================================================================
   5. KOMPONENS-SPECIFIKUS STÍLUSOK
   ========================================================================== */

/* 5.1. Adatfelvételi Varázsló */
#new-visit-modal .wizard-step { display: none; }
#new-visit-modal .wizard-step.active { display: block; }
.message-box { padding: 15px; margin-bottom: 20px; border-radius: 4px; border: 1px solid; font-weight: 500; display: none; }
.message-box.error { background-color: #f8d7da; border-color: #f5c6cb; color: #721c24; }
.message-box.warning { background-color: #fff3cd; border-color: #ffeeba; color: #856404; }
.message-box.info { background-color: #d1ecf1; border-color: #bee5eb; color: #0c5460; }
.choice-buttons { display: flex; flex-direction: column; gap: 10px; margin-top: 1rem; margin-bottom: 1rem; }
.choice-buttons .btn { width: 100%; padding: 12px; }
.address-summary { background-color: #e9ecef; padding: 10px 15px; border-radius: 4px; margin-bottom: 1.5rem; font-weight: 500; color: #495057; text-align: center; }
.wizard-step .form-actions { margin-top: 20px; display: flex; justify-content: space-between; gap: 10px; }
.wizard-step .form-actions .btn { flex-grow: 1; }
.wizard-step .form-actions .btn.back-btn { flex-grow: 0; min-width: 100px; }
.wizard-step .form-actions .btn:only-child { margin-left: auto; margin-right: auto; flex-grow: 0; min-width: 200px; }

/* 5.2. Dashboard */
.dashboard-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 20px; margin-bottom: 30px; }
.stat-cards.dashboard-grid { grid-template-columns: repeat(5, 1fr); }
.card { background: white; padding: 20px; border-radius: 5px; box-shadow: 0 1px 3px rgba(0,0,0,0.1); flex-grow: 1; text-align: center; }
.card .number { font-size: 2.5em; font-weight: bold; }
.card .label { font-size: 1em; color: #6c757d; }
.card.text-left { text-align: left; }
.card .label { margin-bottom: 5px; font-size: 0.9em; }
.chart-container {
    background: white;
    padding: 20px;
    border-radius: 5px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    display: flex;
    flex-direction: column;
}

.chart-container h2 {
    font-size: 1rem;
    text-align: center;
    margin-top: 0;
    margin-bottom: 15px;
    border: none;
    font-weight: 500;
    flex-shrink: 0;
}

.chart-container .canvas-wrapper {
    position: relative;
    width: 100%;
    height: 100%; 
}

.dashboard-grid .chart-container.total-pie {
    height: 300px; 
}
.dashboard-grid .chart-container.daily-bar {
    height: 300px;
}

#city-charts-container .chart-container {
    height: 280px; 
}
#stats-content-area .chart-container.total-pie {
    height: 300px;
}
#stats-content-area .chart-container.daily-bar {
    height: 300px;
}

.wide-chart {
    grid-column: span 2; 
}

/* 5.3. Modern Táblázat */
.report-actions { margin-top: 20px; margin-bottom: 20px; }
.table-container { overflow-x: auto; background: #ffffff; border: 1px solid #e9ecef; border-radius: 8px; box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05); }
.modern-table { width: 100%; border-collapse: collapse; font-size: 14px; color: #343a40; }
.modern-table thead th { background-color: #f8f9fa; color: #6c757d; font-weight: 600; text-align: left; padding: 16px 20px; text-transform: uppercase; font-size: 12px; letter-spacing: 0.5px; border-bottom: 2px solid #dee2e6; }
.modern-table tbody td { padding: 14px 20px; border-bottom: 1px solid #e9ecef; vertical-align: middle; }
.modern-table tbody tr:nth-of-type(even) { background-color: #fdfdfd; }
.modern-table tbody tr:hover { background-color: #f1f7ff; }
.modern-table tbody tr:last-of-type td { border-bottom: none; }
.status-badge { padding: 5px 10px; border-radius: 16px; font-size: 12px; font-weight: 600; color: #fff; white-space: nowrap; display: inline-block; }
.status-pozitv { background-color: var(--color-positive); }
.status-negatv { background-color: var(--color-negative); }
.status-semleges { background-color: var(--color-neutral); }
.status-nemelrhet { background-color: #545b62; }
.status-elutast { background-color: var(--color-rejected); }
.megjegyzes-cella { font-style: italic; color: #6c757d; max-width: 250px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; cursor: help; }
.megjegyzes-cella:hover { white-space: normal; overflow: visible; background-color: #fff; box-shadow: 0 0 10px rgba(0,0,0,0.1); position: relative; z-index: 10; }
#stats-content-area label { font-weight: 500; margin-right: 10px; }
#city-select { min-width: 250px; padding: 8px; }
.bar-chart-in-table-wrapper { position: relative; height: 30px; width: 100%; }
#street-list-ul { list-style: none; padding: 0; max-height: 60vh; overflow-y: auto; }
#street-list-ul li { padding: 8px; border-bottom: 1px solid #eee; }
#street-list-ul li:last-child { border-bottom: none; }

/* ==========================================================================
   6. RESZPONZÍV VISELKEDÉS
   ========================================================================== */

/* ---- Aktivista felület reszponzív menüje (Javított) ---- */

.hamburger-menu {
    display: none;
}
.header-nav {
    display: flex;
    align-items: center;
    gap: 15px;
}

@media (max-width: 768px) {
    .hamburger-menu {
        display: block;
        font-size: 30px;
        cursor: pointer;
        background: none;
        border: none;
        z-index: 1100;
    }
    
    .header-nav {
        display: none; 
        position: absolute;
        top: 60px;
        right: 10px;
        background: white;
        box-shadow: 0 4px 8px rgba(0,0,0,0.15);
        border-radius: 5px;
        padding: 10px;
        width: 220px;
        z-index: 1050;
        
        flex-direction: column;
        align-items: stretch;
        gap: 8px;
    }

    .header-nav.show {
        display: flex; 
    }
    
    .header-nav .welcome-message {
        text-align: center;
        padding: 10px;
        border-bottom: 1px solid #eee;
        margin-bottom: 5px;
    }
    
    .header-nav .btn {
        width: 100%;
        text-align: center;
    }
    
    .modern-table {
        font-size: 13px;
    }
    
    .modern-table thead th,
    .modern-table tbody td {
        padding: 10px 5px; 
        white-space: nowrap;
    }
}


/* ---- Admin felület reszponzív viselkedése ---- */
@media (max-width: 768px) {
    .admin-wrapper {
        flex-direction: column;
    }
    .sidebar {
        position: fixed;
        left: -250px;
        width: 250px;
        height: 100%;
        z-index: 1200;
        transition: left 0.3s ease;
    }
    .sidebar.show {
        left: 0;
    }
    .admin-content {
        padding: 10px;
    }
    .admin-main-header {
        display: flex;
        align-items: center;
        padding: 0 10px;
        background-color: #fff;
        border-bottom: 1px solid #ddd;
        margin: -10px -10px 10px -10px;
    }
    .admin-main-header .hamburger-menu {
        display: block; 
    }
    .overlay {
        display: none;
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        background: rgba(0,0,0,0.5);
        z-index: 1150;
    }
    .overlay.show {
        display: block;
    }
}

/* ---- Dashboard reszponzivitás ---- */
@media (max-width: 1200px) {
    .stat-cards.dashboard-grid {
        grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    }
}
@media (max-width: 992px) {
    .wide-chart {
        grid-column: span 1;
    }
}

/* ==========================================================================
   JAVÍTÁS: Adatfelvételi Modális Ablak Pozicionálása
   ========================================================================== */

#new-visit-modal .modal-content {
    margin-top: 80px;
    margin-bottom: 20px;
    max-height: calc(100vh - 100px); 
    overflow-y: auto;
}

/* ==========================================================================
   TÉRKÉPI IKONOK STÍLUSAI
   ========================================================================== */

.leaflet-div-icon {
    background: transparent;
    border: none;
}

.condo-marker-icon {
    background-color: var(--color-neutral); 
    width: 14px !important;
    height: 14px !important;
    border-radius: 2px;
    border: 1px solid white;
    box-shadow: 0 0 5px rgba(0,0,0,0.5);
}

/* ---- Társasház Részletező Lista Stílusai ---- */

.details-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.details-list li {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: center;
    padding: 12px 0;
    border-bottom: 1px solid #e9ecef;
}
.details-list li:last-child {
    border-bottom: none;
}

.details-list .detail-apartment {
    font-weight: 600;
    color: #343a40;
}

.details-list .detail-status {
    font-weight: 500;
}

.details-list .detail-meta {
    width: 100%;
    font-size: 0.8em;
    color: #6c757d;
    text-align: right;
    margin-top: 4px;
}

.form-group-checkbox {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 20px;
    background-color: #f8f9fa;
    padding: 10px;
    border-radius: 4px;
}
.form-group-checkbox input[type="checkbox"] {
    width: auto;
    height: auto;
    margin: 0;
}
.form-group-checkbox label {
    margin-bottom: 0;
    font-weight: normal;
    cursor: pointer;
}

.visited-apartments-container {
    margin-bottom: 20px;
    border: 1px solid #dee2e6;
    border-radius: 4px;
}
.visited-apartments-container h4 {
    margin: 0;
    padding: 10px 15px;
    background-color: #f8f9fa;
    font-size: 0.9em;
    font-weight: 600;
    border-bottom: 1px solid #dee2e6;
}
#visited-apartments-list {
    list-style: none;
    padding: 0 15px;
    margin: 0;
    max-height: 150px; 
    overflow-y: auto;
}
#visited-apartments-list li {
    padding: 8px 0;
    font-size: 0.9em;
    border-bottom: 1px solid #e9ecef;
    display: flex;
    justify-content: space-between;
}
#visited-apartments-list li:last-child {
    border-bottom: none;
}
#visited-apartments-list .status-text {
    font-weight: 500;
}

.modern-table .type-column {
    width: 20px; 
    text-align: center;
    padding-left: 5px;
    padding-right: 5px;
    color: #6c757d;
}

/* ---- Információs Oldal Stílusai ---- */
.info-page-container {
    padding: 20px;
    max-width: 1200px;
    margin: 0 auto;
}

/* ---- Lapozó (Pagination) Stílusok ---- */
.pagination-wrapper {
    display: flex;
    justify-content: center;
    margin-top: 20px;
}
.pagination {
    display: flex;
    list-style: none;
    padding: 0;
    margin: 0;
    border-radius: 4px;
    overflow: hidden;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}
.pagination .page-item .page-link,
.pagination .page-item span.page-link {
    display: block;
    padding: 8px 14px;
    background: #fff;
    border: none;
    border-left: 1px solid #dee2e6;
    color: var(--color-neutral);
    cursor: pointer;
    font-size: 14px;
    transition: background-color 0.2s ease;
}
.pagination .page-item:first-child .page-link {
    border-left: none;
}
.pagination .page-item .page-link:hover {
    background-color: #e9ecef;
}
.pagination .page-item.active .page-link {
    background-color: var(--color-neutral);
    color: white;
    cursor: default;
}
.pagination .page-item.disabled .page-link,
.pagination .page-item.disabled span.page-link {
    color: #6c757d;
    cursor: not-allowed;
    background-color: #f8f9fa;
}

/* ==========================================================================
   GLOBÁLIS ÉRTESÍTÉSI SÁV (TOAST)
   ========================================================================== */

#global-notification-container {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 9999;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
}

.notification-toast {
    padding: 12px 20px;
    border-radius: 6px;
    color: #fff;
    font-weight: 500;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    opacity: 0;
    transform: translateY(-20px);
    transition: opacity 0.3s ease, transform 0.3s ease;
    min-width: 250px;
    text-align: center;
}
.notification-toast.show {
    opacity: 1;
    transform: translateY(0);
}
.notification-toast.success {
    background-color: #28a745;
}
.notification-toast.error {
    background-color: #dc3545;
}
.notification-toast.info {
    background-color: #17a2b8;
}

/* ==========================================================================
   TÉRKÉP BETÖLTŐ KÉPERNYŐ
   ========================================================================== */

#map-loader {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: calc(100vh - 61px);
    background-color: #f4f6f9;
    z-index: 2000; 
    
    display: flex;
    justify-content: center;
    align-items: center;
    
    /* MÓDOSÍTÁS: Eltávolítjuk az animációt a gyorsabb eltűnés érdekében */
    /* transition: opacity 0.5s ease; */
}

/* MÓDOSÍTÁS: A `.hidden` osztály most már a `display: none;`-t használja a hiba végleges javításához */
#map-loader.hidden {
    display: none;
}

.loader-content {
    text-align: center;
}

.loader-content p {
    font-weight: 500;
    color: #6c757d;
    margin-top: 15px;
}

.loader-spinner {
    border: 5px solid #e0e0e0; 
    border-top: 5px solid var(--color-neutral); 
    border-radius: 50%;
    width: 40px;
    height: 40px;
    animation: spin 1s linear infinite;
    margin: 0 auto;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Stílusok a csoportosított admin részletező listához */
.details-list.grouped > .apartment-group {
    display: block;
    padding: 10px 0;
    border-bottom: 1px solid #eee;
}

.details-list.grouped > .apartment-group:last-child {
    border-bottom: none;
}

.detail-apartment-header {
    font-weight: bold;
    color: #333;
    display: block;
    margin-bottom: 8px;
}

.nested-visit-list {
    list-style: none;
    padding-left: 20px;
    margin: 0;
}

.nested-visit-item {
    padding: 4px 0;
    font-size: 0.9em;
}

.visit-details-line {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
}
/* ==========================================================================
   Kódkereső Oldal Stílusai (Javított)
   ========================================================================== */

#code-search-input {
    font-size: 1.2rem;
    padding-top: 14px;
    padding-bottom: 14px;
}

@media (max-width: 768px) {
    #code-search-input {
        /* Az !important biztosítja, hogy ez a szabály felülírja a .filter-bar input szabályát */
        font-size: 1.5rem !important;
        padding-top: 16px !important;
        padding-bottom: 16px !important;
    }
}