/**
 * Mobile Optimization Styles
 * Optimizacija za mobilne uređaje (max-width: 767px)
 */

/* ============================================
   GLOBAL LANGUAGE SWITCHER STYLES
   (Applies to all screen sizes)
   ============================================ */

/* Mobile Language Switcher - Global styles */
.mobile-lang-switcher {
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
    margin-bottom: 0;
    padding-bottom: 0;
}

/* Override main.css styles for language switcher */
.side-mobile-menu ul li.mobile-lang-switcher a {
    display: inline-block !important;
    padding: 0.5rem 1rem !important;
    border-bottom: none !important;
}

.mobile-lang-switcher a {
    display: inline-block !important;
}

.language-switcher-mobile {
    display: flex !important;
    flex-direction: row !important;
    flex-wrap: nowrap !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 8px !important;
    padding: 1rem 1.5rem !important;
    min-height: 44px;
    width: 100% !important;
    box-sizing: border-box !important;
}

.language-switcher-mobile .lang-link-mobile {
    color: #101a23 !important;
    text-decoration: none !important;
    font-size: 16px !important;
    font-weight: 700 !important;
    text-transform: uppercase !important;
    padding: 0.5rem 1rem !important;
    transition: all 0.3s ease;
    border-radius: 4px;
    display: inline-block !important;
    white-space: nowrap !important;
    flex-shrink: 0 !important;
    border-bottom: none !important;
    position: relative !important;
}

.language-switcher-mobile .lang-link-mobile:hover {
    color: #23a036 !important;
    padding-left: 5px;
}

.language-switcher-mobile .lang-link-mobile.active {
    color: #23a036 !important;
    font-weight: 700 !important;
}

.language-switcher-mobile .lang-separator {
    color: rgba(16, 26, 35, 0.5) !important;
    font-size: 16px !important;
    user-select: none !important;
    white-space: nowrap !important;
    flex-shrink: 0 !important;
    display: inline-block !important;
    margin: 0 !important;
    padding: 0 !important;
}

/* ============================================
   GLOBAL MOBILE STYLES
   ============================================ */

@media (max-width: 767px) {
    /* Container optimization */
    .container {
        padding-left: 15px;
        padding-right: 15px;
    }

    /* Typography optimization */
    body {
        font-size: 14px;
        line-height: 1.6;
    }

    h1 {
        font-size: 1.75rem;
        line-height: 1.3;
        margin-bottom: 1rem;
    }

    h2 {
        font-size: 1.5rem;
        line-height: 1.3;
        margin-bottom: 0.875rem;
    }

    h3 {
        font-size: 1.25rem;
        line-height: 1.3;
        margin-bottom: 0.75rem;
    }

    h4 {
        font-size: 1.125rem;
        line-height: 1.3;
        margin-bottom: 0.625rem;
    }

    h5 {
        font-size: 1rem;
        line-height: 1.3;
        margin-bottom: 0.5rem;
    }

    h6 {
        font-size: 0.875rem;
        line-height: 1.3;
        margin-bottom: 0.5rem;
    }

    p {
        font-size: 14px;
        line-height: 1.6;
        margin-bottom: 1rem;
    }

    /* Spacing optimization */
    .pt-120 {
        padding-top: 40px !important;
    }

    .pb-90 {
        padding-bottom: 40px !important;
    }

    .pt-90 {
        padding-top: 30px !important;
    }

    .pb-60 {
        padding-bottom: 30px !important;
    }

    .pt-60 {
        padding-top: 20px !important;
    }

    .pb-40 {
        padding-bottom: 20px !important;
    }

    .pt-40 {
        padding-top: 15px !important;
    }

    .pb-30 {
        padding-bottom: 15px !important;
    }

    .pt-30 {
        padding-top: 10px !important;
    }

    .mb-50 {
        margin-bottom: 25px !important;
    }

    .mb-40 {
        margin-bottom: 20px !important;
    }

    .mb-30 {
        margin-bottom: 15px !important;
    }

    .mt-50 {
        margin-top: 25px !important;
    }

    .mt-40 {
        margin-top: 20px !important;
    }

    .mt-30 {
        margin-top: 15px !important;
    }
}

/* ============================================
   NAVIGATION MOBILE OPTIMIZATION
   ============================================ */

@media (max-width: 767px) {
    /* Header top */
    .header-top {
        padding: 0.5rem 0;
    }

    .logo-img {
        max-height: 45px;
        width: auto;
    }

    /* Hamburger button - ensure it's visible and clickable */
    .mobile-menu-toggle {
        display: flex !important;
        visibility: visible !important;
        opacity: 1 !important;
        z-index: 10001 !important;
    }

    .hamburger-btn {
        display: flex !important;
        visibility: visible !important;
        opacity: 1 !important;
        cursor: pointer !important;
        z-index: 10001 !important;
        position: relative !important;
        pointer-events: auto !important;
        touch-action: manipulation !important;
    }

    /* Sidebar optimization */
    .slide-bar {
        width: 100%;
        max-width: 320px;
    }

    .side-mobile-menu ul li a {
        font-size: 16px;
        padding: 1rem 1.5rem;
        min-height: 44px; /* Touch target */
        display: flex;
        align-items: center;
    }

    .side-mobile-menu ul li.has-dropdown > a {
        padding-right: 3rem;
    }

    /* Mobile Language Switcher */
    .mobile-lang-switcher {
        border-bottom: 1px solid rgba(0, 0, 0, 0.05);
        margin-bottom: 0;
        padding-bottom: 0;
    }

    .mobile-lang-switcher a {
        display: inline-block !important;
    }

    .language-switcher-mobile {
        display: flex !important;
        flex-direction: row !important;
        flex-wrap: nowrap !important;
        align-items: center !important;
        justify-content: center !important;
        gap: 8px !important;
        padding: 1rem 1.5rem !important;
        min-height: 44px; /* Touch target */
        width: 100% !important;
    }

    .language-switcher-mobile .lang-link-mobile {
        color: #101a23 !important;
        text-decoration: none;
        font-size: 16px;
        font-weight: 700;
        text-transform: uppercase;
        padding: 0.5rem 1rem;
        transition: all 0.3s ease;
        border-radius: 4px;
        display: inline-block !important;
        white-space: nowrap !important;
        flex-shrink: 0 !important;
    }

    .language-switcher-mobile .lang-link-mobile:hover {
        color: #23a036 !important;
        padding-left: 5px;
    }

    .language-switcher-mobile .lang-link-mobile.active {
        color: #23a036 !important;
        font-weight: 700;
    }

    .language-switcher-mobile .lang-separator {
        color: rgba(16, 26, 35, 0.5) !important;
        font-size: 16px;
        user-select: none;
        white-space: nowrap !important;
        flex-shrink: 0 !important;
        display: inline-block !important;
    }
}

/* Additional global styles to ensure switcher stays horizontal on all pages */
.side-mobile-menu ul li.mobile-lang-switcher {
    display: list-item !important;
}

.side-mobile-menu ul li.mobile-lang-switcher .language-switcher-mobile {
    display: flex !important;
    flex-direction: row !important;
    flex-wrap: nowrap !important;
}

.side-mobile-menu ul li.mobile-lang-switcher .language-switcher-mobile * {
    flex-shrink: 0 !important;
    white-space: nowrap !important;
}

/* Specific styles for home-page-2 (product pages) - Higher specificity */
body.home-page-2 .side-mobile-menu ul li.mobile-lang-switcher {
    display: list-item !important;
    width: 100% !important;
}

body.home-page-2 .side-mobile-menu ul li.mobile-lang-switcher a {
    display: inline-block !important;
    padding: 0.5rem 1rem !important;
    border-bottom: none !important;
    width: auto !important;
}

body.home-page-2 .side-mobile-menu ul li.mobile-lang-switcher .language-switcher-mobile {
    display: flex !important;
    flex-direction: row !important;
    flex-wrap: nowrap !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 8px !important;
    padding: 1rem 1.5rem !important;
    width: 100% !important;
    box-sizing: border-box !important;
    overflow: visible !important;
}

body.home-page-2 .side-mobile-menu ul li.mobile-lang-switcher .language-switcher-mobile .lang-link-mobile {
    display: inline-block !important;
    white-space: nowrap !important;
    flex-shrink: 0 !important;
    flex-grow: 0 !important;
    border-bottom: none !important;
    width: auto !important;
    min-width: auto !important;
    max-width: none !important;
}

body.home-page-2 .side-mobile-menu ul li.mobile-lang-switcher .language-switcher-mobile .lang-separator {
    display: inline-block !important;
    white-space: nowrap !important;
    flex-shrink: 0 !important;
    flex-grow: 0 !important;
    margin: 0 !important;
    padding: 0 !important;
    width: auto !important;
    min-width: auto !important;
    max-width: none !important;
}

    .close-mobile-menu a {
        width: 44px;
        height: 44px;
        display: flex;
        align-items: center;
        justify-content: center;
        font-size: 24px;
    }

    /* Offset sidebar */
    .offset-widget {
        padding: 1.5rem 1.5rem;
    }

    .offset-widget .widget-title {
        font-size: 1.125rem;
        margin-bottom: 0.75rem;
    }

    .offset-widget p {
        font-size: 14px;
        line-height: 1.6;
    }
}

/* ============================================
   PRODUCTS PAGE MOBILE OPTIMIZATION
   ============================================ */

@media (max-width: 767px) {
    /* Product grid - 1 column on mobile */
    .product-grids .row {
        margin-left: -10px;
        margin-right: -10px;
    }

    .product-grids .col-xl-3,
    .product-grids .col-md-6,
    .product-grids .col-lg-4 {
        flex: 0 0 100%;
        max-width: 100%;
        padding-left: 10px;
        padding-right: 10px;
        margin-bottom: 20px;
    }

    /* Product card optimization */
    .product-wrap-3 {
        margin-bottom: 20px !important;
    }

    .product-wrap-3 .product-thumb {
        height: 200px;
        overflow: hidden;
    }

    .product-wrap-3 .product-thumb img {
        width: 100%;
        height: 100%;
        object-fit: cover;
    }

    .product-wrap-3 .product-content {
        padding: 1rem;
    }

    .product-wrap-3 .product-content h4 {
        font-size: 1rem;
        line-height: 1.3;
        margin-bottom: 0.5rem;
    }

    .product-wrap-3 .product-content p {
        font-size: 14px;
        line-height: 1.4;
        margin-bottom: 0;
    }

    /* Category title */
    .product-area h3 {
        font-size: 1.25rem;
        margin-top: 30px;
        margin-bottom: 20px;
    }

    .product-area h3:first-child {
        margin-top: 10px;
    }

    /* Breadcrumb */
    .breadcrumb-area {
        padding-top: 20px !important;
        padding-bottom: 15px !important;
    }

    .breadcrumb-content .title {
        font-size: 1.5rem;
    }
}

/* ============================================
   PRODUCT DETAIL PAGE MOBILE OPTIMIZATION
   ============================================ */

@media (max-width: 767px) {
    /* Product detail area */
    .product-details-area {
        padding-top: 20px !important;
        padding-bottom: 20px !important;
    }

    .product-details-content h2 {
        font-size: 1.5rem;
        margin-bottom: 1rem;
    }

    .product-details-content p {
        font-size: 14px;
        line-height: 1.6;
        margin-bottom: 1rem;
    }

    /* Product images */
    .product-thumb-main {
        margin-bottom: 15px;
    }

    .product-thumb-main img {
        width: 100%;
        height: auto;
        border-radius: 8px;
    }

    /* Specifications table */
    .product-specifications table {
        width: 100%;
        font-size: 14px;
    }

    .product-specifications table th,
    .product-specifications table td {
        padding: 0.75rem 0.5rem;
        font-size: 14px;
    }

    /* Similar products */
    .product-area {
        padding-top: 20px !important;
        padding-bottom: 30px !important;
    }

    .product-area .section-title {
        font-size: 1.25rem;
        margin-bottom: 20px;
    }

    .product-area .row {
        margin-left: -10px;
        margin-right: -10px;
    }

    .product-area .col-xl-3,
    .product-area .col-md-6,
    .product-area .col-lg-4 {
        flex: 0 0 100%;
        max-width: 100%;
        padding-left: 10px;
        padding-right: 10px;
        margin-bottom: 20px;
    }
}

/* ============================================
   FORMS MOBILE OPTIMIZATION
   ============================================ */

@media (max-width: 767px) {
    /* Form inputs */
    input[type="text"],
    input[type="email"],
    input[type="tel"],
    input[type="number"],
    textarea,
    select {
        font-size: 16px; /* Prevents zoom on iOS */
        padding: 12px 15px;
        min-height: 44px; /* Touch target */
        border-radius: 4px;
    }

    textarea {
        min-height: 120px;
        padding: 12px 15px;
    }

    /* Buttons */
    .btn,
    button,
    input[type="submit"] {
        min-height: 44px;
        padding: 12px 24px;
        font-size: 16px;
        border-radius: 4px;
        touch-action: manipulation; /* Prevents double-tap zoom */
    }

    /* Form groups */
    .form-group {
        margin-bottom: 1.5rem;
    }

    .form-label {
        font-size: 14px;
        margin-bottom: 0.5rem;
        display: block;
    }
}

/* ============================================
   TABLES MOBILE OPTIMIZATION
   ============================================ */

@media (max-width: 767px) {
    /* Table wrapper for horizontal scroll */
    .table-responsive {
        display: block;
        width: 100%;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    table {
        min-width: 600px; /* Minimum width for readability */
        font-size: 14px;
    }

    table th,
    table td {
        padding: 0.75rem 0.5rem;
        white-space: nowrap;
    }

    /* Stack layout alternative (if needed) */
    .table-stack {
        display: block;
    }

    .table-stack thead {
        display: none;
    }

    .table-stack tbody,
    .table-stack tr,
    .table-stack td {
        display: block;
        width: 100%;
    }

    .table-stack tr {
        margin-bottom: 1rem;
        border: 1px solid #ddd;
        border-radius: 4px;
        padding: 1rem;
    }

    .table-stack td {
        border: none;
        padding: 0.5rem 0;
        text-align: left;
    }

    .table-stack td:before {
        content: attr(data-label) ": ";
        font-weight: bold;
        display: inline-block;
        width: 40%;
    }
}

/* ============================================
   IMAGES MOBILE OPTIMIZATION
   ============================================ */

@media (max-width: 767px) {
    /* Responsive images */
    img {
        max-width: 100%;
        height: auto;
        display: block;
    }

    /* Image containers */
    .product-thumb,
    .product-image,
    .category-image {
        width: 100%;
        overflow: hidden;
    }

    /* Product main image */
    .product-main-image img,
    #product-main-img {
        width: 100%;
        height: auto;
        max-height: 400px;
        object-fit: contain;
    }

    /* Product thumbnails */
    .product-thumbnails {
        margin-top: 15px;
    }

    .product-thumb-item {
        width: 60px !important;
        height: 60px !important;
    }

    .product-thumb-item img {
        width: 100%;
        height: 100%;
        object-fit: cover;
    }

    /* Lazy loading placeholder */
    img[data-src],
    img[loading="lazy"] {
        background-color: #f0f0f0;
        min-height: 200px;
    }

    /* Loading state */
    img[data-src] {
        opacity: 0.5;
        transition: opacity 0.3s;
    }

    img[data-src].loaded {
        opacity: 1;
    }
}

/* ============================================
   CONTACT PAGE MOBILE OPTIMIZATION
   ============================================ */

@media (max-width: 767px) {
    .contact-area {
        padding-top: 20px !important;
        padding-bottom: 30px !important;
    }

    .contact-info-item {
        margin-bottom: 1.5rem;
        padding: 1rem;
    }

    .contact-info-item .icon {
        font-size: 24px;
        margin-bottom: 0.75rem;
    }

    .contact-info-item h4 {
        font-size: 1.125rem;
        margin-bottom: 0.5rem;
    }

    .contact-info-item p {
        font-size: 14px;
    }

    /* Google Maps */
    .contact-map {
        height: 300px;
        margin-bottom: 2rem;
    }
}

/* ============================================
   ABOUT PAGE MOBILE OPTIMIZATION
   ============================================ */

@media (max-width: 767px) {
    .about-area {
        padding-top: 20px !important;
        padding-bottom: 30px !important;
    }

    .about-content h2 {
        font-size: 1.5rem;
        margin-bottom: 1rem;
    }

    .about-content p {
        font-size: 14px;
        line-height: 1.6;
        margin-bottom: 1rem;
    }
}

/* ============================================
   FOOTER MOBILE OPTIMIZATION
   ============================================ */

@media (max-width: 767px) {
    .footer-area {
        padding-top: 40px !important;
        padding-bottom: 20px !important;
    }

    .footer-widget {
        margin-bottom: 2rem;
    }

    .footer-widget .widget-title {
        font-size: 1.125rem;
        margin-bottom: 1rem;
    }

    .footer-widget p,
    .footer-widget li {
        font-size: 14px;
        line-height: 1.6;
    }

    .footer-bottom {
        padding-top: 1.5rem;
        padding-bottom: 1.5rem;
        text-align: center;
    }

    .footer-bottom p {
        font-size: 12px;
    }
}

/* ============================================
   CATEGORY PAGES MOBILE OPTIMIZATION
   ============================================ */

@media (max-width: 767px) {
    /* Table optimization for category pages */
    .table-responsive {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    table {
        font-size: 13px;
    }

    table th,
    table td {
        padding: 0.5rem 0.25rem;
    }

    /* Product name column */
    table th:first-child,
    table td:first-child {
        min-width: 150px;
    }

    /* Button in table */
    table .btn {
        padding: 8px 16px;
        font-size: 13px;
        min-height: 36px;
    }
}

/* ============================================
   PERFORMANCE OPTIMIZATIONS
   ============================================ */

@media (max-width: 767px) {
    /* Reduce animations on mobile */
    * {
        animation-duration: 0.3s !important;
        transition-duration: 0.3s !important;
    }

    /* Disable hover effects on touch devices */
    @media (hover: none) {
        a:hover,
        button:hover {
            opacity: 1;
        }
    }

    /* Optimize scrolling */
    * {
        -webkit-overflow-scrolling: touch;
    }
}

/* ============================================
   UTILITY CLASSES FOR MOBILE
   ============================================ */

@media (max-width: 767px) {
    .mobile-hide {
        display: none !important;
    }

    .mobile-show {
        display: block !important;
    }

    .mobile-text-center {
        text-align: center !important;
    }

    .mobile-full-width {
        width: 100% !important;
    }

    .mobile-no-padding {
        padding: 0 !important;
    }

    .mobile-no-margin {
        margin: 0 !important;
    }
}

/* ============================================
   RESPONSIVE VIDEO OPTIMIZATION
   ============================================ */

/* Responsive Video Container */
.video-container-responsive {
    width: 100%;
    max-width: 100%;
    margin: 0 auto;
    padding: 15px;
    background: #000;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    position: relative;
    overflow: hidden;
}

.responsive-video {
    width: 100%;
    height: auto;
    max-width: 100%;
    display: block;
    margin: 0 auto;
    background: #000;
}

/* Mobile optimizations for video */
@media (max-width: 767px) {
    .video-container-responsive {
        padding: 10px;
        border-radius: 4px;
        margin: 10px 0;
    }
    
    .responsive-video {
        max-height: 50vh; /* Limit height on mobile */
        min-height: 200px;
        width: 100%;
    }
    
    /* Ensure video controls are touch-friendly */
    .responsive-video::-webkit-media-controls-panel {
        background-color: rgba(0, 0, 0, 0.7);
    }
    
    .responsive-video::-webkit-media-controls-play-button,
    .responsive-video::-webkit-media-controls-volume-slider,
    .responsive-video::-webkit-media-controls-timeline {
        min-width: 44px; /* Touch target size */
        min-height: 44px;
    }
    
    /* Fullscreen button */
    .responsive-video::-webkit-media-controls-fullscreen-button {
        min-width: 44px;
        min-height: 44px;
    }
}

/* Tablet optimizations */
@media (min-width: 768px) and (max-width: 991px) {
    .video-container-responsive {
        padding: 20px;
        max-width: 90%;
    }
    
    .responsive-video {
        max-height: 60vh;
    }
}

/* Desktop - maintain aspect ratio */
@media (min-width: 992px) {
    .video-container-responsive {
        padding: 20px;
        max-width: 800px; /* Limit max width on desktop */
    }
    
    .responsive-video {
        max-height: 600px;
    }
}

/* ============================================
   PRODUCT TABS MOBILE OPTIMIZATION
   ============================================ */

@media (max-width: 767px) {
    /* Review tabs wrapper */
    .review-tab-wrapper {
        margin-top: 20px;
    }
    
    /* Tab navigation */
    .review-tab {
        display: flex;
        flex-direction: column;
        gap: 10px;
        margin-bottom: 20px;
    }
    
    .review-tab a {
        padding: 12px 20px;
        font-size: 14px;
        min-height: 44px; /* Touch target */
        display: flex;
        align-items: center;
        justify-content: center;
        border-radius: 4px;
        text-align: center;
        border: 1px solid #e5e5e5;
        background: #f8f9fa;
        color: #333;
        transition: all 0.3s;
    }
    
    .review-tab a.active,
    .review-tab a.show {
        background: #234969;
        color: #fff;
        border-color: #234969;
    }
    
    /* Tab content */
    .review-tab-content {
        margin-top: 20px;
    }
    
    .tab-pane {
        padding: 15px 0;
    }
    
    .tab-pane p {
        font-size: 14px;
        line-height: 1.6;
    }
}

/* Tablet - horizontal tabs */
@media (min-width: 768px) and (max-width: 991px) {
    .review-tab {
        display: flex;
        flex-wrap: wrap;
        gap: 10px;
    }
    
    .review-tab a {
        padding: 12px 20px;
        font-size: 15px;
        min-height: 44px;
    }
    
    /* Certificates responsive */
    .certificates-area {
        padding-top: 40px !important;
        padding-bottom: 40px !important;
    }
    
    .section-title h3 {
        font-size: 24px !important;
        margin-bottom: 30px !important;
    }
    
    .certificate-thumb {
        min-height: 150px !important;
        padding: 20px 15px !important;
    }
    
    .certificate-icon,
    .certificate-image {
        max-height: 120px !important;
    }
    
    .certificate-placeholder {
        font-size: 40px !important;
    }
    
    .certificate-title {
        font-size: 14px !important;
    }
    
    .certificates-area .mt-50 {
        margin-top: 30px !important;
    }
}
