:root {
    --bg-main: #f0f2f5;        /* Világos, barátságos háttér */
    --bg-content: #ffffff;     /* Fehér kártyák */
    --sidebar-bg: #ffffff;     /* Fehér oldalsáv */
    --primary: #361468;        /* Professzionális kék */
    --primary-light: #efeffb;  /* Halvány kék kiemelés */
    --primary-hover: #4f258e;
    --text-main: #2d3436;      /* Sötétszürke szöveg */
    --text-dim: #636e72;       /* Halványabb szürke szöveg */
    --border-color: #dcdde1;   /* Vonalak színe */
    --success: #05c46b;        /* Barátságos zöld */
    --danger: #ff5e57;         /* Lágy piros */
    --warning: #ffa801;        /* Narancs a mentéshez */
}

/* --- ALAP BEÁLLÍTÁSOK --- */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    background-color: var(--bg-main);
    color: var(--text-main);
    line-height: 1.6;
    overflow-x: hidden; 
}

/* --- SÖTÉT MÓD VÁLTOZÓK --- */
body.dark-mode {
    --bg-main: #121212;        /* Sötét háttér */
    --bg-content: #1e1e1e;     /* Sötét kártyák */
    --text-main: #e0e0e0;      /* Világos szöveg */
    --text-dim: #a0a0a0;
    --border-color: #333333;
    
    --primary: #824edc;        /* Világosabb, élénk lila */
    --primary-hover: #c7a8ff;  /* Még világosabb hover állapot */
    --primary-light: rgba(179, 136, 255, 0.15); /* Finom átlátszó lila kiemelésekhez */
}

/* --- PAGE LOADER --- */
#KISKA-page-loader {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background-color: var(--bg-main);
    z-index: 999999;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    transition: opacity 0.5s ease, visibility 0.5s ease;
}

#KISKA-page-loader.hidden {
    opacity: 0;
    visibility: hidden;
}

#KISKA-page-loader .spinner {
    width: 60px;
    height: 60px;
    border: 6px solid rgba(54, 20, 104, 0.1);
    border-top: 6px solid var(--primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 20px;
}

#KISKA-page-loader p {
    color: var(--primary);
    font-weight: bold;
    font-size: 1.2rem;
    letter-spacing: 2px;
    text-transform: uppercase;
    animation: pulse 1.5s infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

/* --- APP ELRENDEZÉS --- */
.app-container {
    display: flex;
    min-height: 100vh;
    width: 100%;
    background-color: var(--bg-main);
    overflow-x: hidden;
}

.main-content {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    transition: margin-left 0.3s ease;
}

.main-content.full-width {
    width: 100%;
}

/* --- SIDEBAR --- */
.sidebar {
    width: 260px;
    background-color: var(--bg-content);
    color: var(--text-main);
    display: flex;
    flex-direction: column;
    height: 100vh;
    position: fixed;
    left: 0;
    top: 0;
    z-index: 1000;
    border-right: 1px solid rgba(0,0,0,0.1);
    box-shadow: 2px 0 10px rgba(0,0,0,0.05);
    transition: transform 0.3s ease;
}

.main-content.has-sidebar {
    margin-left: 260px;
    padding: 20px;
}

.sidebar-header {
    padding: 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    border-bottom: 1px solid rgba(0,0,0,0.1);
}

.logo-dark {
    display: none;
}

body.dark-mode .logo-light {
    display: none;
}

body.dark-mode .logo-dark {
    display: block;
}

.user-info {
    margin-top: 15px;
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: bold;
    color: var(--primary);
}

.nav-menu {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    padding: 20px 0;
}

.menu-items a, .logout-link {
    display: flex;
    align-items: center;
    padding: 15px 25px;
    color: var(--text-main);
    text-decoration: none;
    font-size: 1rem;
    font-weight: 600;
    transition: all 0.2s ease;
    background: none;
    width: 100%;
    cursor: pointer;
    text-align: left;

    border-top: none;
    border-right: none;
    border-bottom: none;
    border-left: 4px solid transparent;
}

.menu-items a i, .logout-link i {
    margin-right: 15px;
    font-size: 1.2rem;
    color: var(--text-dim);
}

.menu-items a:hover, .menu-items a.active {
    background-color: rgba(93, 43, 145, 0.05);
    color: var(--primary);
    border-left: 4px solid var(--primary);
}

.menu-items a.active {
    background-color: rgba(93, 43, 145, 0.1);
}

.menu-items a:hover i, .menu-items a.active i {
    color: var(--primary);
}

.nav-divider-with-text {
    display: flex;
    align-items: center;
    color: var(--text-dim, #636e72);
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    font-weight: 800;
    margin: 15px 20px 10px 20px;
    user-select: none;
}

.nav-divider-with-text::after {
    content: '';
    flex: 1;
    border-bottom: 1px solid var(--border-color, #dcdde1);
    margin-left: 15px;
}

body.dark-mode .nav-divider-with-text {
    color: rgba(255, 255, 255, 0.4);
}

body.dark-mode .nav-divider-with-text::after {
    border-bottom-color: rgba(255, 255, 255, 0.1);
}

.nav-divider {
    margin-top: auto;
    align-self: center;
    height: 1px;
    width: 90%;
    background-color: var(--border-color);
    margin-bottom: 10px;
}

.logout-link, .logout-link i {
    color: var(--danger) !important;
    flex-shrink: 0;
}

.logout-link:hover {
    color: var(--danger);
    border-left-color: var(--danger);
    background-color: rgba(255, 94, 87, 0.1);
}

.logout-link:hover i {
    color: var(--danger);
}

/* --- TOPBAR --- */
.topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 30px;
    background-color: var(--bg-content);
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    z-index: 99;
    box-shadow: 0 2px 10px rgba(0,0,0,0.02);
    border-radius: 5px;
    margin-bottom: 20px;
}

/* --- DÁTUM WIDGET --- */
.kiska-date-widget {
    display: flex;
    align-items: center;
    gap: 12px;
    background-color: var(--bg-content);
    border: 1px solid var(--border-color);
    border-radius: 15px;
    padding: 6px 20px 6px 6px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.02);
    transition: all 0.3s ease;
}

.kiska-date-widget:hover {
    box-shadow: 0 4px 12px rgba(0,0,0,0.05);
}

.widget-icon {
    width: 40px;
    height: 40px;
    background-color: var(--primary-light);
    color: var(--primary);
    border-radius: 12px;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 1.1rem;
}

.widget-content {
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.widget-top {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 2px;
}

.widget-day {
    font-size: 0.75rem;
    font-weight: 800;
    color: var(--text-dim);
    letter-spacing: 0.5px;
}


.widget-nameday {
    background-color: var(--primary-light);
    color: var(--primary);
    font-size: 0.65rem;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 20px;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    letter-spacing: 0.5px;
}

.widget-nameday i {
    font-size: 0.6rem;
}

/* "2026. 05. 05." felirat */
.widget-bottom {
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--text-main);
    line-height: 1.1;
}

/* Sötét mód finomhangolás */
body.dark-mode .widget-icon,
body.dark-mode .widget-nameday {
    background-color: rgba(93, 43, 145, 0.2);
    color: #d1b3ff;
}

.topbar-right {
    display: flex;
    align-items: center;
    gap: 15px;
}

.icon-btn {
    background: none;
    border: none;
    font-size: 1.3rem;
    color: var(--text-dim);
    cursor: pointer;
    position: relative;
    transition: color 0.2s ease, transform 0.2s ease;
    padding: 8px;
    border-radius: 10px;
}

.icon-btn:hover {
    color: var(--primary);
    background-color: rgba(93, 43, 145, 0.05);
}

.notification-btn .badge {
    position: absolute;
    top: 0px;
    right: 0px;
    background-color: var(--danger);
    color: white;
    font-size: 0.7rem;
    font-weight: bold;
    padding: 2px 5px;
    border-radius: 10px;
    border: 2px solid var(--bg-content);
}

.user-dropdown-container {
    position: relative;
    margin-left: 15px;
}

.profile-avatar-btn {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    background-color: var(--primary);
    color: white;
    border: none;
    font-size: 1.2rem;
    font-weight: bold;
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: transform 0.2s, box-shadow 0.2s;
}

.profile-avatar-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 10px rgba(54, 20, 104, 0.3);
}

.profile-avatar-btn.chars-1,
.profile-avatar-btn.chars-2 {
    font-size: 1.1rem;
}

.profile-avatar-btn.chars-3 {
    font-size: 0.95rem;
}

.profile-avatar-btn.chars-4,
.profile-avatar-btn.chars-5 {
    font-size: 0.65rem;
    letter-spacing: -0.5px;
}

.profile-dropdown-menu {
    position: absolute;
    top: 60px;
    right: 0;
    width: 240px;
    background-color: var(--bg-content);
    border-radius: 12px;
    border: 1px solid var(--border-color);
    box-shadow: 0 10px 25px rgba(0,0,0,0.1);
    display: flex;
    flex-direction: column;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.2s ease-out;
    z-index: 1000;
}

.profile-dropdown-menu.active {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.dropdown-header {
    padding: 15px 20px;
    display: flex;
    flex-direction: column;
    gap: 5px;
    color: var(--text-main);
}

.role-badge {
    align-self: flex-start;
    background-color: var(--primary-light);
    color: var(--primary);
    font-size: 0.7rem;
    padding: 2px 8px;
    border-radius: 10px;
    text-transform: uppercase;
    font-weight: bold;
    letter-spacing: 1px;
}

.dropdown-divider {
    height: 1px;
    background-color: var(--border-color);
}

.profile-dropdown-menu a, .dropdown-logout-btn {
    padding: 12px 20px;
    color: var(--text-main);
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 0.95rem;
    font-weight: 500;
    transition: background 0.2s, color 0.2s;
    background: none;
    border: none;
    width: 100%;
    cursor: pointer;
    text-align: left;
}

.profile-dropdown-menu a i, .dropdown-logout-btn i {
    font-size: 1.1rem;
    color: var(--text-dim);
}

.profile-dropdown-menu a:hover {
    background-color: rgba(0,0,0,0.03);
    color: var(--primary);
}

.profile-dropdown-menu a:hover i {
    color: var(--primary);
}

.dropdown-logout-btn {
    color: var(--danger);
    border-bottom-left-radius: 12px;
    border-bottom-right-radius: 12px;
}

.dropdown-logout-btn i {
    color: var(--danger);
}

.dropdown-logout-btn:hover {
    background-color: rgba(255, 94, 87, 0.1);
}

.role-status-wrapper {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-top: 6px;
}

.user-status {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    transition: color 0.3s ease;
}

.status-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background-color: var(--text-dim);
    box-shadow: 0 0 0 2px var(--bg-content);
    transition: background-color 0.3s ease;
}

/* Állapot színek */
.user-status.online .status-dot { 
    background-color: var(--success); 
    box-shadow: 0 0 0 2px var(--bg-content), 0 0 8px rgba(5, 196, 107, 0.4);
}
.user-status.online { color: var(--success); }

.user-status.idle .status-dot { background-color: var(--warning); }
.user-status.idle { color: var(--warning); }

.user-status.offline .status-dot { background-color: var(--text-dim); }
.user-status.offline { color: var(--text-dim); }

/* --- GLOBÁLIS primary-btn INTERAKCIÓ --- */
.primary-btn {
    background-color: var(--primary);
    color: white;
    border: none;
    padding: 18px 45px;
    font-size: 1.1rem;
    border-radius: 15px;
    cursor: pointer;
    font-weight: bold;
    letter-spacing: 1.5px;
    text-transform: uppercase;
    box-shadow: 0 10px 20px rgba(54, 20, 104, 0.2);
    transition: all 0.15s ease;
    display: inline-block;
    text-align: center;
    text-decoration: none;
}

.primary-btn:hover {
    background-color: var(--primary-hover);
    box-shadow: 0 15px 25px rgba(54, 20, 104, 0.3);
}

.primary-btn:active {
    transform: translateY(0) scale(0.96) !important;
    filter: brightness(0.85);
    box-shadow: 0 5px 10px rgba(54, 20, 104, 0.2);
}

/* --- GLOBÁLIS secondary-btn INTERAKCIÓ --- */
.secondary-btn {
    background-color: var(--primary);
    color: white;
    border: none;
    padding: 10px 24px;
    font-size: 0.9rem;
    border-radius: 10px;
    cursor: pointer;
    font-weight: bold;
    letter-spacing: 1px;
    text-transform: uppercase;
    box-shadow: 0 5px 12px rgba(54, 20, 104, 0.15);
    transition: all 0.15s ease;
    display: inline-block;
    text-align: center;
    text-decoration: none;
}

.secondary-btn:hover {
    background-color: var(--primary-hover);
    box-shadow: 0 8px 16px rgba(54, 20, 104, 0.25);
}

.secondary-btn:active {
    transform: translateY(0) scale(0.96) !important;
    filter: brightness(0.85);
    box-shadow: 0 3px 6px rgba(54, 20, 104, 0.2);
}

/* Narancs */
.primary-btn.btn-color-orange, .secondary-btn.btn-color-orange {
    background-color: var(--warning);
    box-shadow: 0 8px 15px rgba(255, 168, 1, 0.2);
    color: #1a1a1a; /* Sötét szöveg a jó olvashatóságért */
}
.primary-btn.btn-color-orange:hover, .secondary-btn.btn-color-orange:hover {
    background-color: #e69800;
    box-shadow: 0 12px 20px rgba(255, 168, 1, 0.3);
}

/* Zöld */
.primary-btn.btn-color-green, .secondary-btn.btn-color-green {
    background-color: var(--success);
    box-shadow: 0 8px 15px rgba(5, 196, 107, 0.2);
}
.primary-btn.btn-color-green:hover, .secondary-btn.btn-color-green:hover {
    background-color: #04a85c;
    box-shadow: 0 12px 20px rgba(5, 196, 107, 0.3);
}

/* Sárga */
.primary-btn.btn-color-yellow, .secondary-btn.btn-color-yellow {
    background-color: #f1c40f; 
    color: #1a1a1a; 
    box-shadow: 0 8px 15px rgba(241, 196, 15, 0.2);
}
.primary-btn.btn-color-yellow:hover, .secondary-btn.btn-color-yellow:hover {
    background-color: #d4ac0d;
    box-shadow: 0 12px 20px rgba(241, 196, 15, 0.3);
}

/* Kék */
.primary-btn.btn-color-blue, .secondary-btn.btn-color-blue {
    background-color: #0984e3;
    box-shadow: 0 8px 15px rgba(9, 132, 227, 0.2);
}
.primary-btn.btn-color-blue:hover, .secondary-btn.btn-color-blue:hover {
    background-color: #074e8c;
    box-shadow: 0 12px 20px rgba(9, 132, 227, 0.3);
}

/* Szürke */
.primary-btn.btn-color-gray, .secondary-btn.btn-color-gray {
    background-color: var(--text-dim);
    box-shadow: 0 8px 15px rgba(99, 110, 114, 0.2);
}
.primary-btn.btn-color-gray:hover, .secondary-btn.btn-color-gray:hover {
    background-color: var(--text-main);
    box-shadow: 0 12px 20px rgba(45, 52, 54, 0.3);
}

/* Letiltott állapot */
.btn-disabled {
    opacity: 0.65 !important;
    cursor: not-allowed !important;
    transform: scale(0.98) !important; /* Mintha eleve be lenne nyomva */
    box-shadow: none !important; /* Eltűnik az árnyék, hogy ne tűnjön kattinthatónak */
    pointer-events: none !important; /* A böngésző nem engedi lekattintani */
    filter: grayscale(30%) brightness(0.85) !important; /* Picit tompább, sötétebb lesz a színe */
}

/* --- ÉRTESÍTÉSEK (TOAST) --- */
#toast-container {
    position: fixed;
    top: 75px;
    right: 20px;
    z-index: 1111111 !important;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.toast {
    min-width: 280px;
    background-color: var(--bg-content);
    color: var(--text-main);
    padding: 15px 20px;
    border-radius: 8px;
    border-left: 5px solid var(--primary);
    box-shadow: 0 5px 15px rgba(0,0,0,0.4);
    display: flex;
    justify-content: space-between;
    align-items: center;
    animation: slideIn 0.3s ease-out forwards;
    position: relative;
}

.toast.success { border-left-color: var(--success); }
.toast.error { border-left-color: var(--danger); }
.toast.warning { border-left-color: var(--warning); }

.toast .close-btn {
    cursor: pointer;
    font-size: 1.2rem;
    color: var(--text-dim);
    margin-left: 15px;
    transition: 0.2s;
}

.toast .close-btn:hover { color: white; }

@keyframes slideIn {
    from { transform: translateX(100%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

.toast.fade-out {
    animation: fadeOut 0.5s ease-out forwards;
}

@keyframes fadeOut {
    to { transform: translateX(100%); opacity: 0; }
}

body.dark-mode .menu-items a:hover, 
body.dark-mode .menu-items a.active {
    background-color: var(--primary-light);
    border-left-color: var(--primary);
}

/* --- RESZPONSZÍV MOBIL NÉZET --- */
.mobile-only { display: none; }
.mobile-menu-open { display: none; }

@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
    }
    
    .sidebar.active {
        transform: translateX(0);
    }
    
    .main-content.has-sidebar {
        margin-left: 0;
        padding: 10px;
    }

    .mobile-only {
        display: block;
        background: none;
        border: none;
        font-size: 1.5rem;
        position: absolute;
        top: 20px;
        right: 20px;
        color: var(--text-dim);
    }

    .mobile-menu-open {
        display: block;
        position: fixed;
        top: 15px;
        left: 15px;
        z-index: 999;
        background-color: var(--primary);
        color: white;
        border: none;
        padding: 10px 15px;
        border-radius: 5px;
        box-shadow: 0 2px 5px rgba(0,0,0,0.2);
    }
}