/* Mobile fixes and responsive improvements */

/* Prevent horizontal scroll */
body {
    overflow-x: hidden;
}

/* Mobile navbar fixes - only for mobile screens */
@media (max-width: 768px) {
    .navbar-header {
        height: 70px !important;
        display: flex !important;
        align-items: center !important;
        justify-content: space-between !important; /* Space between hamburger and center group */
        width: 100% !important;
        position: relative !important;
        padding: 0 15px !important;
    }

    /* Hamburger dugme - positioned on the left */
    .navbar-toggle {
        position: relative !important;
        left: auto !important;
        top: auto !important;
        transform: none !important;
        margin: 0 !important;
        z-index: 1000 !important;
        border: none !important;
        background: transparent !important;
        padding: 8px 10px !important;
        flex-shrink: 0 !important; /* Don't shrink */
    }

    /* Center group container for logo and action buttons */
    .mobile-center-group {
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        gap: 15px !important;
        position: absolute !important;
        left: 50% !important;
        top: 50% !important;
        transform: translate(-50%, -50%) !important;
        z-index: 999 !important;
    }

    /* Logo styling */
    .navbar-brand,
    .navbar-brand-link {
        height: auto !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        padding: 0 !important;
        max-width: none !important;
        margin: 0 !important;
        position: relative !important;
    }

    .navbar-brand img {
        height: 40px !important;
        max-height: 40px !important;
        width: 40px !important;
        max-width: 40px !important;
    }
}

/* Override existing responsive styles that move hamburger incorrectly */
@media screen and (max-width: 350px) {
    .navbar-header {
        padding: 0 10px !important;
    }
    
    .mobile-center-group {
        gap: 10px !important; /* Smaller gap for very small screens */
    }
    
    .mobile-logo {
        width: 35px !important;
        height: 35px !important;
    }
    
    .mobile-login-btn,
    .mobile-cart-btn,
    .mobile-user-btn {
        width: 35px !important;
        height: 35px !important;
        border-radius: 17.5px !important;
    }
    
    .mobile-user-avatar {
        width: 20px !important;
        height: 20px !important;
        border-radius: 10px !important;
        font-size: 10px !important;
    }
}

/* Dodatni override za bootsnav specifične stilove */
@media (max-width: 768px) {
    /* Force correct positioning across all bootsnav variants */
    nav.navbar.bootsnav .navbar-toggle,
    nav.bootsnav .navbar-toggle,
    .navbar-toggle {
        position: absolute !important;
        left: 15px !important;
        top: 50% !important;
        transform: translateY(-50%) !important;
        margin: 0 !important;
        margin-right: 0 !important; /* Override default bootstrap margin */
        margin-left: 0 !important;
        float: none !important; /* Remove any float */
        z-index: 1001 !important;
        background: transparent !important;
        border: none !important;
        padding: 8px 12px !important;
    }

    /* Override default navbar brand styles for mobile layout */
    nav.navbar.bootsnav .navbar-brand,
    nav.bootsnav .navbar-brand,
    .navbar-brand,
    .navbar-brand-link {
        text-align: left !important; /* Changed to left alignment */
        display: flex !important;
        float: none !important;
        margin: 0 !important; /* Remove auto centering */
        padding: 0 !important; /* Remove padding */
    }

    /* Container adjustments for mobile */
    nav.navbar.bootsnav .container,
    nav.bootsnav .container {
        padding-left: 15px !important;
        padding-right: 15px !important;
    }

    /* Header positioning */
    nav.navbar.bootsnav .navbar-header,
    nav.bootsnav .navbar-header {
        position: relative !important;
        width: 100% !important;
        text-align: center !important;
        float: none !important;
        padding: 0 !important;
    }
}

/* JAČI CSS ZA PODIZANJE LOGO-A */
@media (min-width: 769px) {
    /* Specifičniji selektor da override-uje sve */
    nav.navbar.bootsnav .navbar-header a.navbar-brand,
    nav.navbar.bootsnav .navbar-header a.navbar-brand:hover,
    nav.navbar.bootsnav .navbar-header a.navbar-brand:focus {
        padding: 14px 0px !important; /* Umesto 34px, stavi 14px = 20px manje */
        position: relative !important;
        top: -10px !important; /* Dodatno podizanje */
    }
}

/* Logout form and button styling */
.logout-form {
    margin: 0;
    padding: 0;
}

.logout-btn {
    color: #333;
    text-decoration: none;
    padding: 3px 20px;
    text-align: left;
    width: 100%;
    border: none;
    background: none;
    cursor: pointer;
}

.logout-btn:hover {
    background-color: #f5f5f5;
}

/* ============ MOBILE LOGO STYLES ============ */

/* Show desktop brand on desktop, hide mobile elements */
.desktop-brand {
    display: block;
}

.mobile-logo {
    display: none;
}

.desktop-logo {
    display: inline;
}

/* Show mobile elements on mobile, hide desktop brand */
@media (max-width: 768px) {
    .desktop-brand {
        display: none !important;
    }
    
    .mobile-center-group {
        display: flex !important;
    }
    
    .desktop-logo {
        display: none !important;
    }
    
    .mobile-logo {
        display: inline !important;
        width: 40px !important;
        height: 40px !important;
        margin: 0 !important;
    }
}

/* ============ MOBILE ACTION BAR STYLES ============ */

/* Hide mobile elements on desktop */
.mobile-action-bar {
    display: none;
}

.mobile-center-group {
    display: none;
}

/* Show mobile action bar only on mobile devices */
@media (max-width: 768px) {
    .mobile-action-bar {
        display: flex !important;
        align-items: center;
        gap: 15px !important;
        position: relative !important;
        right: auto !important;
        top: auto !important;
        transform: none !important;
        z-index: 1000;
    }
    
    /* Mobile Login Button */
    .mobile-login-btn {
        display: flex;
        align-items: center;
        justify-content: center;
        width: 40px !important; /* Same size as logo */
        height: 40px !important; /* Same size as logo */
        border-radius: 20px; /* Adjusted for new size */
        background: rgba(40, 167, 69, 0.2);
        border: 1px solid rgba(40, 167, 69, 0.3);
        cursor: pointer;
        outline: none;
        box-shadow: none;
        transition: none;
    }
    
    .mobile-login-btn i {
        color: #28a745;
        font-size: 16px; /* Increased for better visibility */
    }
    
    .mobile-login-btn:hover,
    .mobile-login-btn:focus,
    .mobile-login-btn:active {
        background: rgba(40, 167, 69, 0.2) !important;
        border: 1px solid rgba(40, 167, 69, 0.3) !important;
        outline: none !important;
        box-shadow: none !important;
        transform: none !important;
    }
    
    /* Mobile Cart Button */
    .mobile-cart-btn {
        position: relative;
        display: flex;
        align-items: center;
        justify-content: center;
        width: 40px !important; /* Same size as logo */
        height: 40px !important; /* Same size as logo */
        border-radius: 20px; /* Adjusted for new size */
        background: rgba(0, 123, 255, 0.2);
        border: 1px solid rgba(0, 123, 255, 0.3);
        cursor: pointer;
        outline: none;
        box-shadow: none;
        transition: none;
    }
    
    .mobile-cart-icon {
        position: relative;
        width: 16px; /* Increased for better visibility */
        height: 16px; /* Increased for better visibility */
        display: flex;
        align-items: center;
        justify-content: center;
        color: #007bff;
    }
    
    .mobile-cart-icon::before {
        content: '';
        position: absolute;
        width: 100%;
        height: 100%;
        background: currentColor;
        mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='currentColor'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M3 3h2l.4 2M7 13h10l4-8H5.4m1.6 8L6 5H4m3 8a2 2 0 104 0 2 2 0 00-4 0zm10 0a2 2 0 104 0 2 2 0 00-4 0z'/%3E%3C/svg%3E") no-repeat center;
        mask-size: contain;
        -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='currentColor'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M3 3h2l.4 2M7 13h10l4-8H5.4m1.6 8L6 5H4m3 8a2 2 0 104 0 2 2 0 00-4 0zm10 0a2 2 0 104 0 2 2 0 00-4 0z'/%3E%3C/svg%3E") no-repeat center;
        -webkit-mask-size: contain;
    }
    
    .mobile-cart-btn:hover,
    .mobile-cart-btn:focus,
    .mobile-cart-btn:active {
        background: rgba(0, 123, 255, 0.2) !important;
        border: 1px solid rgba(0, 123, 255, 0.3) !important;
        outline: none !important;
        box-shadow: none !important;
        transform: none !important;
    }
    
    /* Mobile Cart Badge */
    .mobile-cart-badge {
        position: absolute;
        top: -6px;
        right: -6px;
        width: 18px;
        height: 18px;
        background: linear-gradient(135deg, #ff4757, #ff3742);
        color: white;
        font-size: 9px;
        font-weight: 700;
        border-radius: 9px;
        display: flex;
        align-items: center;
        justify-content: center;
        border: 2px solid rgba(255, 255, 255, 0.8);
        box-shadow: 0 2px 8px rgba(255, 71, 87, 0.4);
    }
    
    /* Mobile User Button */
    .mobile-user-btn {
        width: 40px !important; /* Same size as logo */
        height: 40px !important; /* Same size as logo */
        border-radius: 20px; /* Adjusted for new size */
        background: rgba(108, 117, 125, 0.2);
        border: 1px solid rgba(108, 117, 125, 0.3);
        cursor: pointer;
        outline: none;
        box-shadow: none;
        transition: none;
        display: flex;
        align-items: center;
        justify-content: center;
    }
    
    .mobile-user-avatar {
        width: 24px; /* Increased proportionally */
        height: 24px; /* Increased proportionally */
        border-radius: 12px;
        background: linear-gradient(135deg, #6c757d, #495057);
        display: flex;
        align-items: center;
        justify-content: center;
        color: white;
        font-size: 12px; /* Increased for better visibility */
        font-weight: 600;
    }
    
    .mobile-user-btn:hover,
    .mobile-user-btn:focus,
    .mobile-user-btn:active {
        background: rgba(108, 117, 125, 0.2) !important;
        border: 1px solid rgba(108, 117, 125, 0.3) !important;
        outline: none !important;
        box-shadow: none !important;
        transform: none !important;
    }
    
    /* Mobile User Dropdown */
    .mobile-user-dropdown {
        position: relative;
    }
    
    .mobile-dropdown-menu {
        position: absolute;
        top: calc(100% + 8px);
        right: 0;
        min-width: 160px;
        background: rgba(255, 255, 255, 0.95);
        backdrop-filter: blur(20px);
        border-radius: 12px;
        border: 1px solid rgba(255, 255, 255, 0.3);
        box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
        padding: 8px;
        opacity: 0;
        visibility: hidden;
        transform: translateY(-10px) scale(0.95);
        transition: all 0.3s ease;
        z-index: 1001;
    }
    
    .mobile-user-dropdown.active .mobile-dropdown-menu {
        opacity: 1;
        visibility: visible;
        transform: translateY(0) scale(1);
    }
    
    .mobile-dropdown-item {
        display: flex;
        align-items: center;
        padding: 8px 12px;
        border-radius: 8px;
        color: #495057;
        text-decoration: none;
        font-size: 13px;
        font-weight: 500;
        transition: all 0.2s ease;
        margin-bottom: 2px;
    }
    
    .mobile-dropdown-item:hover {
        background: rgba(0, 123, 255, 0.1);
        color: #007bff;
        text-decoration: none;
    }
    
    .mobile-dropdown-item i {
        margin-right: 8px;
        width: 14px;
        text-align: center;
        opacity: 0.7;
    }
    
    .mobile-logout-form {
        margin: 0;
        padding: 0;
        width: 100%;
    }
    
    .mobile-logout-btn {
        width: 100%;
        border: none;
        background: none;
        text-align: left;
        cursor: pointer;
        font-family: inherit;
        padding: 8px 12px;
        border-radius: 8px;
        color: #dc3545;
        font-size: 13px;
        font-weight: 500;
        transition: all 0.2s ease;
        display: flex;
        align-items: center;
        border-top: 1px solid rgba(0, 0, 0, 0.1);
        margin-top: 4px;
    }
    
    .mobile-logout-btn:hover {
        background: rgba(220, 53, 69, 0.1);
        color: #c82333;
    }
    
    .mobile-logout-btn i {
        margin-right: 8px;
        width: 14px;
        text-align: center;
        opacity: 0.7;
    }
}

