header {
    height: var(--header-h);
    background: var(--white);
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    overflow: visible;
}

.header-left {
    display: flex;
    align-items: center;
}

.header-right {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    height: 100%;
}

/* --- MENU ICON --- */
.menu-icon {
    font-size: 24px;
    cursor: pointer;
    color: var(--text-main);
    display: inline-block;
    transition: color 0.3s ease;
    padding: 0 0 0 30px;
}

/* --- LOGO --- */
.logo-container {
    text-decoration: none;
    display: flex;
    align-items: center;
}

.logo-text {
    font-size: 32px;
    font-weight: 800;
    color: var(--text-main);
    letter-spacing: -1.2px;
    text-transform: lowercase;
}

.logo-dot {
    color: var(--primary);
}

body.dark-mode .logo-dot {
    color: var(--primary);
}

/* --- DONATE BUTTON --- */
.button-donate {
    background: var(--donate-bg);
    color: var(--donate-text);
    border: none;
    height: 100%;
    padding: 0 45px;
    font-weight: 700;
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 2px;
    cursor: pointer;
    transition: background 0.3s;
}

.button-donate:hover {
    background: var(--primary);
}

/* --- USER ICON & DROPDOWN --- */
.user-container {
    position: relative;
    margin: 0 30px;
}

.user-icon-img {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    outline: 3px solid #e2e8f0;
    outline-offset: -1px;
    border: none;
    padding: 0;
    object-fit: cover;
    background: white;
    display: block;
    transition: all 0.2s ease;
}

.user-icon-img:hover {
    outline-color: var(--primary);
    transform: scale(1.1);
    cursor: pointer;
}

body.dark-mode .user-icon-img:hover {
    box-shadow: 0 0 15px var(--primary);
}

.dropdown {
    position: absolute;
    top: 60px;
    right: 0;
    background: var(--white);
    width: 220px;
    border-radius: 12px;
    display: flex;
    flex-direction: column;
    box-shadow: 0 0 0 1px var(--border-color-dropdown), 0 4px 15px rgba(0,0,0,0.05);
    overflow: hidden;

    /* efekt padanja */
    opacity: 0;
    transform: translateY(-16px);
    pointer-events: none;
    transition: opacity 0.25s ease, transform 0.25s cubic-bezier(0.2, 0, 0.2, 1);
    transform-origin: top right;
}

.dropdown.active {
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
}

.dropdown-item {
    padding: 16px 24px;
    font-size: 14px;
    font-weight: bold;
    color: var(--text-main);
    cursor: pointer;
}

.dropdown-item:hover {
    background: var(--bg);
    color: var(--primary);
}

/* --- DARK MODE TOGGLE (SWITCH) --- */
.switch {
    position: relative;
    display: inline-block;
    width: 36px;
    height: 20px;
}

.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #cbd5e1;
    transition: 0.4s;
    border-radius: 34px;
}

.slider:before {
    position: absolute;
    content: "";
    height: 14px;
    width: 14px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: 0.4s;
    border-radius: 50%;
}

input:checked + .slider {
    background-color: var(--primary);
}

input:checked + .slider:before {
    transform: translateX(16px);
}

/* --- OVERLAY --- */
#overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    z-index: 2000;
}

#overlay.active {
    display: block;
}

/* --- SIDEBAR --- */
.sidebar {
    position: fixed;
    top: 0;
    left: -320px;
    width: 320px;
    height: 100%;
    background: var(--white);
    box-shadow: 10px 0 30px rgba(0, 0, 0, 0.1);
    transition: 0.4s ease;
    z-index: 2001;
}

.sidebar.active {
    left: 0;
}

.sidebar-header {
    padding: 30px;
    border-bottom: 1px solid #f1f5f9;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.sidebar-menu {
    list-style: none;
    padding: 30px 20px;
    margin: 0;
}

.sidebar-menu li {
    position: relative;
    display: flex;
    align-items: center;
    padding: 18px 24px;
    border-radius: 12px;
    cursor: pointer;
    color: var(--sidebar-text);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    list-style: none;
}

.sidebar-menu li::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 0;
    height: 100%;
    background: linear-gradient(90deg, rgba(79, 70, 229, 0.1) 0%, rgba(79, 70, 229, 0.05) 100%);
    transition: width 0.3s ease;
    z-index: -1;
    border-radius: 12px;
}

.sidebar-menu li:hover {
    color: var(--primary);
    transform: translateX(5px);
}

.sidebar-menu li:hover::before {
    width: 100%;
}

.sidebar-menu li:hover::after {
    opacity: 1;
    right: 20px;
}

/* --- NAV MODE (active page highlight) --- */
.nav-mode {
    font-weight: 700 !important;
    margin-bottom: 5px;
    border: 1px solid transparent;
}

.nav-mode.active {
    background: rgba(79, 70, 229, 0.1);
    color: var(--primary);
    border-color: rgba(79, 70, 229, 0.2);
}

.nav-mode.active::after {
    content: '•';
    position: absolute;
    right: 20px;
    font-size: 20px;
}

/* --- MENU SEPARATOR --- */
.menu-separator {
    height: 1px;
    background: #e2e8f0;
    margin: 20px 0;
    opacity: 0.5;
}

/* --- MENU LABEL --- */
.menu-label {
    display: block;
    padding: 10px 24px;
    font-size: 11px;
    font-weight: 800;
    color: var(--text-muted);
    letter-spacing: 1px;
    text-transform: uppercase;
}

/* --- SUBJECT POPOUT --- */
.subject-popout {
    position: absolute;
    left: 100%;
    top: 0;
    width: 260px;
    background: var(--white);
    box-shadow: 15px 0 30px rgba(0, 0, 0, 0.1);
    border-radius: 0 12px 12px 12px;
    display: none;
    flex-direction: column;
    padding: 15px 0;
    border: 1px solid #f1f5f9;
    z-index: 1200;
}

.nav-mode:hover .subject-popout {
    display: flex;
}

/* --- SUBJECT ITEM --- */
.subject-item {
    padding: 12px 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: relative;
    transition: 0.2s;
    font-size: 14px;
    font-weight: 500;
    color: var(--sidebar-text);
    cursor: pointer;
}

.subject-item:hover {
    background: rgba(79, 70, 229, 0.05);
    color: var(--primary);
}

/* --- CHECKBOX CUSTOM --- */
.checkbox-custom {
    width: 20px;
    height: 20px;
    border: 2px solid #cbd5e1;
    border-radius: 50%;
    background: white;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: all 0.3s ease;
    margin: 0;
}

.checkbox-custom::after {
    content: '';
    width: 12px;
    height: 12px;
    background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="white" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round"><polyline points="20 6 9 17 4 12"></polyline></svg>');
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
    opacity: 0;
    transform: scale(0.5);
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.subject-item.selected .checkbox-custom {
    background-color: var(--primary);
    border-color: var(--primary);
    box-shadow: 0 0 8px rgba(79, 70, 229, 0.4);
}

.subject-item.selected .checkbox-custom::after {
    width: 19px;
    height: 19px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='20 6 9 17 4 12'%3E%3C/polyline%3E%3C/svg%3E");
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
    opacity: 1;
    transform: scale(0.6);
    display: block;
}

/* Sidebar li.selected (alternativni selector koji se koristio) */
.sidebar-menu li.selected .checkbox-custom {
    background: var(--primary);
    border-color: var(--primary);
    box-shadow: 0 0 10px rgba(79, 70, 229, 0.3);
}

.sidebar-menu li.selected .checkbox-custom::after {
    opacity: 1;
    transform: scale(1);
}

/* Skripta stranica: grade-nav-wrapper se scrollra s ostatkom stranice */
.grade-nav-wrapper {
    position: static !important;
}

/* --- ANIMACIJE --- */
@keyframes highlight-glow {
    0%   { background-color: transparent; }
    50%  { background-color: rgba(79, 70, 229, 0.4); }
    100% { background-color: transparent; }
}

.highlight-active {
    animation: highlight-glow 0.7s ease-in-out 3;
    color: var(--primary) !important;
    font-weight: 700 !important;
}

@keyframes pulse-menu {
    0%, 80%, 100% {
        transform: scale(1);
        opacity: 1;
        color: var(--text-main);
    }
    85%, 95% {
        transform: scale(1.7);
        color: var(--primary);
    }
    90% {
        transform: scale(1);
        color: var(--primary);
    }
}

.pulse-active {
    animation: pulse-menu 3s infinite;
}

/* --- DARK MODE --- */
body.dark-mode .subject-popout {
    background: #0f172a;
    border-color: #1e293b;
    box-shadow: 15px 0 30px rgba(0, 0, 0, 0.5);
}

body.dark-mode .subject-item:hover {
    background: rgba(255, 255, 255, 0.05);
}

body.dark-mode .checkbox-custom {
    background: #1e293b;
    border-color: #334155;
}

body.dark-mode .menu-label {
    color: var(--text-muted);
}

