/* Dashboard CSS - Modern Responsive stílusok */

/* ===== ALAP STÍLUSOK ===== */
body {
    font-family: 'Inter', sans-serif;
    background-color: #f9fafb;
    color: #374151;
    overflow-x: hidden;
}

.dark body {
    background-color: #111827;
    color: #d1d5db;
}

/* ===== SCROLLBAR ===== */
::-webkit-scrollbar { 
    width: 8px; 
}

::-webkit-scrollbar-track { 
    background: #e5e7eb; 
}

::-webkit-scrollbar-thumb { 
    background: #9ca3af; 
    border-radius: 10px; 
}

.dark ::-webkit-scrollbar-track { 
    background: #1f2937; 
}

.dark ::-webkit-scrollbar-thumb { 
    background: #4b5563; 
}

.dark ::-webkit-scrollbar-thumb:hover { 
    background: #6b7280; 
}

/* ===== SIDEBAR ===== */
.sidebar-closed .nav-text,
.sidebar-closed .sidebar-header-text {
    display: none;
}

/* ===== ANIMÁCIÓK ===== */
@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.7; }
}

.animate-pulse-custom {
    animation: pulse 2s infinite;
}

.status-indicator {
    animation: pulse 2s infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

@keyframes slideInFromRight {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes slideInFromLeft {
    from {
        transform: translateX(-100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* Bell Animation */
@keyframes ring {
    0% { transform: rotate(0); }
    1% { transform: rotate(30deg); }
    3% { transform: rotate(-28deg); }
    5% { transform: rotate(34deg); }
    7% { transform: rotate(-32deg); }
    9% { transform: rotate(30deg); }
    11% { transform: rotate(-28deg); }
    13% { transform: rotate(26deg); }
    15% { transform: rotate(-24deg); }
    17% { transform: rotate(22deg); }
    19% { transform: rotate(-20deg); }
    21% { transform: rotate(18deg); }
    23% { transform: rotate(-16deg); }
    25% { transform: rotate(14deg); }
    27% { transform: rotate(-12deg); }
    29% { transform: rotate(10deg); }
    31% { transform: rotate(-8deg); }
    33% { transform: rotate(6deg); }
    35% { transform: rotate(-4deg); }
    37% { transform: rotate(2deg); }
    39% { transform: rotate(-1deg); }
    41% { transform: rotate(1deg); }
    43% { transform: rotate(0); }
    100% { transform: rotate(0); }
}

.bell {
    animation: ring 4s .7s ease-in-out infinite;
    transform-origin: 50% 4px;
}


/* ===== DARK MODE FIXES ===== */
.dark .text-gray-500 {
    color: #d1d5db !important;
}

/* ===== JQVMAP STÍLUSOK ===== */
.jqvmap-zoomin, .jqvmap-zoomout {
    color: #d1d5db !important;
    background-color: #4b5563 !important;
    width: 20px;
    height: 20px;
    cursor: pointer;
    line-height: 20px;
    padding: 0;
}

.dark .jqvmap-zoomin, .dark .jqvmap-zoomout {
    background-color: #202937 !important;
}

/* ===== LANGUAGE DROPDOWN ===== */
.language-dropdown {
    transition: all 0.2s ease-in-out;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px) scale(0.95);
    z-index: 9999;
}

.language-dropdown.show {
    opacity: 1;
    visibility: visible;
    transform: translateY(0) scale(1);
}

.language-item {
    transition: all 0.15s ease;
    cursor: pointer;
}

.language-item:hover {
    background-color: #f3f4f6;
}

.dark .language-item:hover {
    background-color: #374151;
}

.language-item.active {
    background-color: #fee2e2 !important;
    color: #dc2626 !important;
}

.dark .language-item.active {
    background-color: #7f1d1d !important;
    color: #fca5a5 !important;
}

.flag-icon {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    object-fit: cover;
}

.lang-chevron {
    transition: transform 0.2s ease;
}

/* ===== COMPONENTS ===== */
.service-card {
    transition: all 0.2s ease;
}

.service-card:hover {
    transform: translateY(-2px);
}

.chart-container {
    position: relative;
    height: 100%;
    width: 100%;
}

.refresh-indicator {
    position: fixed;
    bottom: 1rem;
    right: 1rem;
    background: rgba(31, 41, 55, 0.9);
    color: white;
    padding: 0.5rem 0.75rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    opacity: 0.75;
    z-index: 50;
}

.dark .refresh-indicator {
    background: rgba(55, 65, 81, 0.9);
}

.status-online {
    color: #10b981;
}

.status-offline {
    color: #ef4444;
}

.loading {
    opacity: 0.6;
    pointer-events: none;
}

.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    margin: -10px 0 0 -10px;
    border: 2px solid #f3f3f3;
    border-top: 2px solid #3498db;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

/* ===== MOBILE OVERLAY ===== */
.mobile-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 15;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.mobile-overlay.show {
    opacity: 1;
}

/* ===== MOBILE/DESKTOP UTILITIES ===== */
.mobile-only {
    display: none;
}
.desktop-only {
    display: block;
}


/* ===== MOBILE RESPONSIVE (< 768px) ===== */
@media (max-width: 767px) {
    /* Layout alapok */
    .flex {
        flex-direction: column;
    }
    
    /* Sidebar mobil viselkedés */
    #sidebar {
        position: fixed !important;
        top: 0;
        left: -100%;
        height: 100vh;
        z-index: 20;
        transition: left 0.3s ease;
        box-shadow: 2px 0 10px rgba(0, 0, 0, 0.1);
        overflow-y: auto; /* JAVÍTÁS: Menü görgethetővé tétele */
    }
    
    #sidebar.mobile-open {
        left: 0;
    }
    
    /* Main content mobil */
    .flex-1 {
        margin-left: 0 !important;
        width: 100% !important;
    }
    
    /* === HEADER MOBIL OPTIMALIZÁLÁS === */
    header {
        padding: 0 1rem !important;
        height: 60px !important;
        min-height: 60px;
        display: flex;
        align-items: center;
        justify-content: space-between;
        position: relative;
    }

    header .flex {
        flex-direction: row !important;
        justify-content: space-between;
        width: 100%;
        align-items: center;
    }

    /* Bal oldali gombok */
    header .header-left {
        display: flex;
        align-items: center;
        gap: 0.5rem;
    }

    /* Jobb oldali ikonok */
    header .header-right {
        display: flex;
        align-items: center;
        gap: 0.5rem;
    }

    /* Kereső konténer */
    header .search-container {
        display: none;
        position: absolute;
        top: 60px; /* Fejléc alatt */
        left: 0;
        width: 100%;
        padding: 1rem;
        background-color: #fff;
        box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
        z-index: 15; /* Sidebar felett, de overlay alatt */
    }

    .dark header .search-container {
        background-color: #1f2937; /* Sötét módhoz igazítva */
    }

    header .search-container.active {
        display: block;
    }

    header .search-container input {
        width: 100%;
    }
    
    /* Felhasználói menü és nyelvi dropdown pozicionálása */
    #user-menu, .language-dropdown {
        position: fixed !important;
        top: 65px !important;
        right: 1rem !important;
        left: auto !important;
        transform: none !important;
        width: 220px;
    }
    /* === HEADER MOBIL VÉGE === */
    
    /* Main content padding */
    main {
        padding: 1rem !important;
    }
    
    /* Grid rendszerek mobil */
    .grid {
        grid-template-columns: 1fr !important;
        gap: 1rem !important;
    }
    
    /* Service cards stack */
    .lg\:col-span-3,
    .lg\:col-span-2 {
        grid-column: span 1 !important;
    }

    /* JAVÍTÁS: Resource Distribution card túlcsordulás */
    .lg\:col-span-2:has(#resourceChart) .flex-grow {
        overflow-y: auto;
    }
    #resource-legend {
        padding-bottom: 0.5rem; /* Kis tér a görgetés végén */
    }
    #resource-legend span {
        font-size: 0.75rem !important; /* Jelmagyarázat betűméretének finomhangolása */
    }
    
    /* Chart magasságok mobil */
    .h-80 {
        height: 300px !important;
    }
    
    /* Geolokációs szekció mobil */
    .flex.flex-col.lg\:flex-row {
        flex-direction: column !important;
    }
    
    /* Min-width classes */
    [class*="min-w-["] {
        min-width: 100% !important;
    }
    
    /* Táblázatok horizontal scroll */
    .overflow-x-auto {
        -webkit-overflow-scrolling: touch;
    }
    
    /* Service cards kisebb padding */
    .service-card {
        padding: 1rem !important;
    }
    
    /* Font méretek mobil */
    .text-3xl {
        font-size: 1.5rem !important;
    }
    
    .text-xl {
        font-size: 1.125rem !important;
    }
    
    .text-lg {
        font-size: 1rem !important;
    }
    
    /* Mobile navigation helper */
    .mobile-nav-indicator {
        display: block;
        position: fixed;
        bottom: 1rem;
        left: 1rem;
        background: rgba(239, 68, 68, 0.9);
        color: white;
        padding: 0.5rem;
        border-radius: 50%;
        z-index: 25;
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
        animation: pulse 2s infinite;
    }
    
    /* Vector map mobil */
    #vmap {
        height: 250px !important;
        border-radius: 12px !important;
    }

    /* Helper class-ek felülírása mobilra */
    .mobile-only {
        display: block;
    }
    
    .desktop-only {
        display: none !important;
    }
}

/* ===== TABLET RESPONSIVE (768px - 1024px) ===== */
@media (min-width: 768px) and (max-width: 1023px) {
    /* Sidebar tablet méret */
    #sidebar {
        width: 200px;
    }
    
    /* Grid 2 oszlopos tablet */
    .grid.grid-cols-1.md\:grid-cols-2.lg\:grid-cols-4 {
        grid-template-columns: repeat(2, 1fr) !important;
    }
    
    .grid.grid-cols-1.md\:grid-cols-2.lg\:grid-cols-3 {
        grid-template-columns: repeat(2, 1fr) !important;
    }
    
    /* Charts tablet */
    .lg\:col-span-3 {
        grid-column: span 2 !important;
    }
    
    .lg\:col-span-2 {
        grid-column: span 2 !important;
    }
    
    /* Main padding tablet */
    main {
        padding: 1.5rem !important;
    }
    
    /* Font méretek tablet */
    .text-3xl {
        font-size: 2rem !important;
    }
}

/* ===== LARGE MOBILE (576px - 767px) ===== */
@media (min-width: 576px) and (max-width: 767px) {
    /* Stats cards 2 oszlopos */
    .grid.grid-cols-1.md\:grid-cols-2.lg\:grid-cols-4 {
        grid-template-columns: repeat(2, 1fr) !important;
    }
}

/* ===== EXTRA SMALL MOBILE (< 576px) ===== */
@media (max-width: 575px) {
    /* Még kisebb padding */
    main {
        padding: 0.75rem !important;
    }
    
    /* Service cards még kisebb */
    .service-card {
        padding: 0.75rem !important;
    }
    
    /* Még kisebb font méretek */
    .text-3xl {
        font-size: 1.25rem !important;
    }
    
    .text-nowrap {
        white-space: normal !important;
    }
    
    /* Header még kompaktabb */
    header {
        padding: 0 0.5rem !important;
        min-height: 50px;
        height: 50px !important;
    }
    
    /* Mobile nav indicator kisebb */
    .mobile-nav-indicator {
        bottom: 0.5rem;
        left: 0.5rem;
        padding: 0.375rem;
    }
    
    /* Refresh indicator pozíció */
    .refresh-indicator {
        bottom: 0.5rem;
        right: 0.5rem;
        padding: 0.25rem 0.5rem;
        font-size: 0.625rem;
    }
}

/* ===== LANDSCAPE MOBILE ===== */
@media (max-width: 767px) and (orientation: landscape) {
    /* Sidebar overlay landscape */
    #sidebar {
        width: 280px;
    }
    
    /* Charts kisebb magasság landscape */
    .h-80 {
        height: 250px !important;
    }
    
    /* Header még kompaktabb landscape */
    header {
        min-height: 50px;
        height: 50px !important;
        padding: 0 1rem !important;
    }
    
    /* Vector map landscape */
    #vmap {
        height: 200px !important;
    }
}

/* ===== PRINT STYLES ===== */
@media print {
    body {
        background-color: #fff !important;
    }

    .sidebar,
    .no-print,
    .mobile-overlay,
    .mobile-nav-indicator,
    .refresh-indicator,
    #sidebar-toggle,
    #theme-toggle,
    #fullscreen-toggle,
    #lang-toggle,
    .bell,
    #user-menu-button {
        display: none !important;
    }
    
    .flex-1 {
        margin-left: 0 !important;
        width: 100% !important;
    }
    
    main {
        padding: 0 !important;
    }
    
    .grid, .service-card, .bg-white {
        break-inside: avoid;
        box-shadow: none !important;
        border: 1px solid #ddd;
    }
    
    .service-card {
        margin-bottom: 1rem;
    }

    .dark {
        background-color: #fff !important;
        color: #000 !important;
    }
}

/* ===== DARK MODE ENHANCEMENTS ===== */
.dark .mobile-overlay {
    background: rgba(0, 0, 0, 0.7);
}

.dark .mobile-nav-indicator {
    background: rgba(55, 65, 81, 0.95);
}

/* ===== ACCESSIBILITY ===== */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}

/* ===== HIGH DPI DISPLAYS ===== */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
    .flag-icon {
        image-rendering: -webkit-optimize-contrast;
        image-rendering: crisp-edges;
    }
}

/* ===== FOCUS STATES FOR ACCESSIBILITY ===== */
button:focus-visible,
a:focus-visible,
input:focus-visible {
    outline: 2px solid #3b82f6;
    outline-offset: 2px;
}

.dark button:focus-visible,
.dark a:focus-visible,
.dark input:focus-visible {
    outline-color: #60a5fa;
}
