/* Custom User Menu Styles */
.custom-user-menu {
    position: relative;
    display: inline-block;
}

.user-menu-trigger {
    display: flex;
    align-items: center;
    font-size: 12px !important;
    gap: 8px;
    padding: 8px 16px;
    background: transparent;
    border: 1px solid #e0e0e0;
    border-radius: 30px !important;
    cursor: pointer;
    transition: all 0.3s ease;
}

.user-menu-trigger:hover {
    background: #f5f5f5;
    border-color: #999;
}

.user-menu-trigger .user-icon {
    color: #333;
}

.username {
    font-size: 12px;
    font-weight: 500;
    color: #333;
}

.dropdown-arrow {
    transition: transform 0.3s ease;
}

.dropdown-trigger.active .dropdown-arrow {
    transform: rotate(180deg);
}

/* Avatar styling */
.user-menu-trigger .avatar {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    object-fit: cover;
}

/* Dropdown Menu */
.dropdown-menu {
    position: absolute;
    top: 100%;
    right: 0;
    min-width: 220px;
    background: white;
    border: 1px solid #e0e0e0;
    border-radius: 30px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.1);
    opacity: 0;
    visibility: hidden;
    font-size: 12px;
    transform: translateY(10px);
    transition: all 0.3s ease;
    z-index: 1000;
    margin-top: 8px;
    font-size: 12px !important;
}

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

.dropdown-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    color: #333 !important;
    text-decoration: none;
    transition: background 0.3s ease;
}

.dropdown-item:hover {
    background: #f8fafc !important;
}

.dropdown-item svg {
    flex-shrink: 0;
}

.dropdown-divider {
    height: 1px;
    background: #e0e0e0;
    margin: 8px 0;
}

/* Modal Styles */
/* Povećaj z-index za modal da bude iznad svega */
.custom-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    z-index: 999999; /* Povećano sa 9999 */
    align-items: center;
    justify-content: center;
}

/* Osiguraj da je modal content također visoko */
.modal-content {
    background: white;
    border-radius: 12px;
    padding: 30px;
    max-width: 450px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    position: relative;
    z-index: 1000000; /* Dodato */
    animation: modalSlideIn 0.3s ease;
}

/* Popravi pozicioniranje za off-canvas */
.elementor-off-canvas-wrapper {
    z-index: 99998 !important; /* Niže od modala */
}

/* Osiguraj da je trigger klikabilan u off-canvasu */
.custom-user-menu .user-menu-trigger {
    position: relative;
    z-index: 1;
    cursor: pointer;
    pointer-events: auto !important; /* Forsiraj klikabilnost */
}

.custom-modal.show {
    display: flex;
}



@keyframes modalSlideIn {
    from {
        transform: translateY(-50px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.close-modal {
    position: absolute;
    top: 15px;
    right: 20px;
    font-size: 28px;
    font-weight: bold;
    color: #999;
    cursor: pointer;
    transition: color 0.3s ease;
}

.close-modal:hover {
    color: #333;
}

/* Social Login Section */
.social-login-section {
    text-align: center;
    margin-bottom: 25px;
}

.social-login-section h5 {
    font-size: 17px !important;
    margin-bottom: 15px;
}

.social-buttons {
    display: flex;
    gap: 12px;
    justify-content: center;
}

.social-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 8px;
    border: 1px solid #e0e0e0;
    border-radius: 30px;
    background: white;
    cursor: pointer;
    font-size: 14px  ;
    font-color: #333 !important;
    font-weight: 500;
    transition: all 0.3s ease;
    flex: 1;
}

.social-btn:hover {
    background: #f5f5f5;
    border-color: #999;
}

.google-btn {
    color: #333;
}

.facebook-btn {
    color: #1877F2;
}

.separator {
    display: flex;
    align-items: center;
    text-align: center;
    margin: 20px 0;
}

.separator::before,
.separator::after {
    content: '';
    flex: 1;
    border-bottom: 1px solid #e0e0e0;
}

.separator span {
    padding: 0 10px;
    color: #999;
    font-size: 14px;
}

/* Auth Tabs */
.auth-tabs {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
    border-bottom: 1px solid #e0e0e0;
    padding-bottom: 10px;
}

.tab-btn {
    flex: 1;
    padding: 10px;
    background: transparent;
    border: none;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    color: #999;
    transition: all 0.2s ease;
    border-radius: 30px;
}

.tab-btn.active {
    color: #333;
    background: #f0f0f0;
}

/* Auth Forms */
.auth-form {
    display: none;
}

.auth-form.active {
    display: block;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 5px;
    font-size: 14px;
    color: #666;
}

.form-group input[type="text"],
.form-group input[type="email"],
.form-group input[type="password"] {
    width: 100%;
    padding: 10px 15px;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    font-size: 14px;
    transition: border-color 0.3s ease;
}

.form-group input:focus {
    outline: none;
    border-color: #999;
}

.remember-me {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.remember-me label {
    display: flex;
    align-items: center;
    gap: 5px;
    margin: 0;
    cursor: pointer;
}

.remember-me input[type="checkbox"] {
    width: auto;
    margin-right: 5px;
}

.forgot-password {
    color: #666;
    text-decoration: none;
    font-size: 14px;
}

.forgot-password:hover {
    text-decoration: underline;
}

.auth-submit-btn {
    width: 100%;
    padding: 10px;
    background: #333;
    color: white;
    border: none;
    border-radius: 30px !important;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.3s ease;
}

.auth-submit-btn:hover {
    background: #555;
}

.form-message {
    margin-top: 15px;
    padding: 10px;
    border-radius: 5px;
    font-size: 14px;
    text-align: center;
}

.form-message.success {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.form-message.error {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

/* Responsive */
@media (max-width: 768px) {
    .modal-content {
        padding: 20px;
        width: 95%;
    }
    
    .social-buttons {
        flex-direction: column;
    }
    
    .dropdown-menu {
        position: fixed;
        top: auto;
        bottom: 0;
        left: 0;
        right: 0;
        width: 100%;
        border-radius: 20px 20px 0 0;
        transform: translateY(100%);
    }
    
    .dropdown-menu.show {
        transform: translateY(0);
    }
}



/* Off-canvas specifični stilovi - POPRAVLJENI */
.offcanvas-version {
    width: 100%;
    position: relative;
}

.offcanvas-dropdown-menu {
    position: absolute;
    top: 100%;  /* Promijenjeno sa bottom: 100% */
    left: 0;
    right: 0;
    margin-top: 8px;  /* Promijenjeno sa margin-bottom */
    animation: slideDown 0.3s ease;
    z-index: 999999;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.offcanvas-dropdown-menu a {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    color: #333;
    text-decoration: none;
    transition: background 0.3s ease;
}

.offcanvas-dropdown-menu a:hover {
    background: #f5f5f5;
}

/* Osiguraj da dropdown ne bude preklopljen */
.custom-user-menu.logged-in.offcanvas-version {
    position: relative;
    z-index: 1000;
}


/* APSOLUTNO FORSIRANJE MODALA ZA MOBILNE */
@media (max-width: 768px) {
    #loginModal,
    .custom-modal {
        display: none !important;
        position: fixed !important;
        top: 0 !important;
        left: 0 !important;
        width: 100% !important;
        height: 100% !important;
        background: rgba(0, 0, 0, 0.7) !important;
        z-index: 999999999 !important;
        align-items: center !important;
        justify-content: center !important;
        margin: 0 !important;
        padding: 0 !important;
        pointer-events: auto !important;
    }
    
    #loginModal[style*="display: flex"],
    .custom-modal[style*="display: flex"] {
        display: flex !important;
    }

    #loginModal {
    position: fixed !important;
    z-index: 999999 !important;
    top: 0 !important;
    left: 0 !important;
    width: 100% !important;
    height: 100% !important;
}
    
    .modal-content {
        background: white !important;
        border-radius: 12px !important;
        padding: 30px !important;
        max-width: 90% !important;
        width: 90% !important;
        max-height: 80vh !important;
        overflow-y: auto !important;
        position: relative !important;
        z-index: 1000000000 !important;
        box-shadow: 0 10px 40px rgba(0,0,0,0.3) !important;
    }
}


/* APSOLUTNO FORSIRANJE MODALA ZA MOBILNE */
@media (max-width: 435px) {
    #loginModal,
    .custom-modal {
        display: none !important;
        position: fixed !important;
        top: 0 !important;
        left: 0 !important;
        width: 100% !important;
        height: 100% !important;
        background: rgba(0, 0, 0, 0.7) !important;
        z-index: 999999999 !important;
        align-items: center !important;
        justify-content: center !important;
        margin: 0 !important;
        padding: 0 !important;
        pointer-events: auto !important;
    }
    
    #loginModal[style*="display: flex"],
    .custom-modal[style*="display: flex"] {
        display: flex !important;
    }
    
    .modal-content {
        background: white !important;
        border-radius: 12px !important;
        padding: 30px !important;
        max-width: 90% !important;
        width: 90% !important;
        max-height: 80vh !important;
        overflow-y: auto !important;
        position: relative !important;
        z-index: 1000000000 !important;
        box-shadow: 0 10px 40px rgba(0,0,0,0.3) !important;
    }
}




/* ============================================= */
/* FINAL FIX ZA MOBILNI MODAL - OVO SIGURNO RADI */
/* ============================================= */

@media (max-width: 768px) {
    /* Potpuno resetovanje modala za mobilne */
    #loginModal,
    .custom-modal {
        display: none !important;
        position: fixed !important;
        top: 0 !important;
        left: 0 !important;
        width: 100% !important;
        height: 100% !important;
        background: rgba(0, 0, 0, 0.8) !important;
        z-index: 9999999999 !important;
        align-items: center !important;
        justify-content: center !important;
        margin: 0 !important;
        padding: 0 !important;
    }

    /* Kada je modal otvoren */
    #loginModal[style*="display: flex"],
    #loginModal[style*="display:flex"],
    .custom-modal[style*="display: flex"],
    .custom-modal[style*="display:flex"] {
        display: flex !important;
    }

    /* Modal content */
    #loginModal .modal-content,
    .custom-modal .modal-content {
        background: white !important;
        border-radius: 15px !important;
        padding: 25px !important;
        max-width: 90% !important;
        width: 400px !important;
        max-height: 80vh !important;
        overflow-y: auto !important;
        position: relative !important;
        box-shadow: 0 20px 60px rgba(0,0,0,0.3) !important;
        margin: 20px !important;
        display: block !important;
        visibility: visible !important;
        opacity: 1 !important;
    }

    /* Sve forme i dugmad unutar modala */
    .modal-content * {
        display: block !important;
        visibility: visible !important;
        opacity: 1 !important;
    }

    /* Social buttons */
    .social-buttons {
        display: flex !important;
        gap: 10px !important;
        justify-content: center !important;
        margin: 15px 0 !important;
    }

    .social-btn {
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        padding: 10px 15px !important;
        border: 1px solid #ddd !important;
        border-radius: 30px !important;
        background: white !important;
        cursor: pointer !important;
        font-size: 14px !important;
    }

    /* Input polja */
    .form-group input {
        width: 100% !important;
        padding: 12px !important;
        margin: 5px 0 !important;
        border: 1px solid #ddd !important;
        border-radius: 8px !important;
        font-size: 15px !important;
    }

    /* Submit dugme */
    .auth-submit-btn {
        width: 100% !important;
        padding: 10px !important;
        background: #333 !important;
        color: white !important;
        border: none !important;
        border-radius: 30px !important;
        font-size: 14px !important;
        cursor: pointer !important;
        margin-top: 10px !important;
    }

    /* Tabs */
    .auth-tabs {
        display: flex !important;
        gap: 10px !important;
        margin-bottom: 20px !important;
        border-bottom: 1px solid #eee !important;
        padding-bottom: 10px !important;
    }

    .tab-btn {
        flex: 1 !important;
        padding: 10px !important;
        background: transparent !important;
        border: none !important;
        cursor: pointer !important;
        font-size: 14px !important;
    }

    .tab-btn.active {
        background: #f0f0f0 !important;
        border-radius: 30px !important;
    }

    /* Close dugme */
    .close-modal {
        position: absolute !important;
        top: 10px !important;
        right: 15px !important;
        font-size: 28px !important;
        cursor: pointer !important;
        color: #999 !important;
        z-index: 10 !important;
    }
}
