/**
 * XTREMEOFFICE - MOBILE RESPONSIVE v1
 * 
 * Laad dit bestand NA style.css in index.php:
 *   <link rel="stylesheet" href="mobile.css">
 *
 * Breakpoints:
 *   768px  = mobiel (telefoon)
 *   1024px = tablet portrait (sommige aanpassingen)
 *
 * Geen bestaande CSS overschreven - alles via @media queries
 */

/* ================================================================
   HAMBURGER MENU BUTTON (altijd verborgen op desktop)
   ================================================================ */
.mobile-hamburger {
    display: none;
    background: none;
    border: none;
    color: white;
    cursor: pointer;
    padding: 8px;
    border-radius: 6px;
    transition: background 0.2s;
    flex-shrink: 0;
}

.mobile-hamburger:hover {
    background: rgba(255,255,255,0.15);
}

.mobile-hamburger svg {
    display: block;
}

/* Mobile menu overlay */
.mobile-menu-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.5);
    z-index: 1100;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.mobile-menu-overlay.visible {
    opacity: 1;
}

/* Slide-in menu panel */
.mobile-menu {
    display: none;
    position: fixed;
    top: 0;
    right: -300px;
    width: 280px;
    height: 100%;
    background: white;
    z-index: 1200;
    box-shadow: -4px 0 20px rgba(0,0,0,0.2);
    transition: right 0.3s ease;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

.mobile-menu.open {
    right: 0;
}

.mobile-menu-header {
    background: linear-gradient(135deg, #8B3A9C, #6B2A7C);
    color: white;
    padding: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.mobile-menu-header h3 {
    font-size: 1.1em;
    margin: 0;
}

.mobile-menu-close {
    background: none;
    border: none;
    color: white;
    font-size: 1.5em;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 4px;
    line-height: 1;
}

.mobile-menu-close:hover {
    background: rgba(255,255,255,0.2);
}

.mobile-menu-links {
    list-style: none;
    padding: 0;
    margin: 0;
}

.mobile-menu-links li {
    border-bottom: 1px solid #f0f0f0;
}

.mobile-menu-links a {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px 20px;
    color: #333;
    text-decoration: none;
    font-size: 0.95em;
    transition: background 0.15s;
}

.mobile-menu-links a:hover {
    background: #f8f4fc;
    color: #8B3A9C;
    text-decoration: none;
}

.mobile-menu-links .menu-icon {
    width: 20px;
    flex-shrink: 0;
    text-align: center;
    color: #8B3A9C;
}

.mobile-menu-links .menu-icon svg {
    vertical-align: middle;
}

.mobile-menu-contact {
    padding: 20px;
    background: #f8f9fa;
    border-top: 1px solid #e9ecef;
}

.mobile-menu-contact a {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 0;
    color: #555;
    font-size: 0.9em;
    text-decoration: none;
}

.mobile-menu-contact a:hover {
    color: #8B3A9C;
}

.mobile-menu-contact svg {
    flex-shrink: 0;
    color: #8B3A9C;
}

/* Cart badge in menu */
.mobile-cart-badge {
    background: #ef4444;
    color: white;
    font-size: 0.75em;
    font-weight: 700;
    padding: 2px 7px;
    border-radius: 10px;
    margin-left: auto;
}


/* ================================================================
   MOBILE: 768px en kleiner
   ================================================================ */
@media (max-width: 768px) {

    /* --- HEADER: geen horizontale overflow --- */
    .header {
        overflow-x: hidden;          /* inhoud mag NOOIT buiten het scherm steken */
    }
    .header-inner {
        padding: 0 12px;             /* minder zijmarge zodat er meer ruimte is */
        box-sizing: border-box;
        width: 100%;
        max-width: 100%;
    }

    /* Rij: logo links, knoppen rechts, zoekbalk eronder op eigen volledige regel */
    .header-row {
        display: flex;
        flex-wrap: wrap;             /* zoekbalk mag doorbreken naar volgende regel */
        gap: 6px;
        padding: 8px 0;
        align-items: center;
        width: 100%;
        box-sizing: border-box;
    }

    /* Logo klein */
    .logo-link { flex-shrink: 0; }
    .logo-img  { height: 40px; }

    /* Zoekbalk: eigen volledige regel onderaan */
    .search-form {
        order: 3;
        flex: 1 1 100%;
        max-width: 100%;
        box-sizing: border-box;
    }

    /* Header rechts (knoppen): zo smal mogelijk, nooit overflow */
    .header-right {
        display: flex;
        align-items: center;
        gap: 2px;
        flex-shrink: 0;
        margin-left: auto;
        min-width: 0;
    }

    /* Verberg minder-relevante header-elementen */
    .header-contact { display: none !important; }
    .header-rating  { display: none !important; }
    .dex-btn span   { display: none; }

    /* Knoppen: icon-only, compact aanraakoppervlak */
    .header-actions {
        display: flex !important;
        gap: 2px;
        align-items: center;
        flex-shrink: 0;
    }
    .action-btn span:not(.cart-badge) { display: none !important; }
    .action-btn {
        padding: 8px !important;
        min-width: 40px;
        min-height: 40px;
        justify-content: center;
        flex-shrink: 0;
    }
    /* Dex-Points badge: alleen punten tonen, geen 'pts' label */
    .dex-points-btn {
        padding: 4px 7px !important;
        font-size: 0.72em !important;
        border-radius: 14px !important;
    }
    /* Dex chat-knop kleiner */
    .dex-btn {
        padding: 6px !important;
        flex-shrink: 0;
    }

    .mobile-hamburger {
        display: block;
    }
    .mobile-menu-overlay,
    .mobile-menu {
        display: block;
    }
    
    .search-input {
        padding: 10px 12px;
        font-size: 0.9em;
    }
    
    .search-btn {
        padding: 10px 14px;
        font-size: 0.85em;
    }
    
    .search-btn svg { display: block; }
    /* Verberg "Zoeken" tekst op mobiel, toon alleen icoon */
    .search-btn { gap: 0; padding: 10px 12px; }
    
    .dex-btn {
        padding: 4px;
        border-radius: 50%;
    }
    
    .dex-btn img {
        width: 32px;
        height: 32px;
    }
    
    /* Header-right: alleen Dex + hamburger */
    .header-right {
        gap: 8px;
        margin-left: auto;
    }
    
    .main-content {
        margin-top: 110px;
    }

    /* --- USP BALK --- */
    .usp-section {
        grid-template-columns: 1fr;
        gap: 8px;
        margin-bottom: 25px;
    }
    
    .usp-item {
        padding: 12px 14px;
        gap: 10px;
        border-radius: 8px;
    }
    
    .usp-icon {
        font-size: 1.3em;
    }
    
    .usp-item strong {
        font-size: 0.9em;
    }
    
    .usp-item span:not(.usp-icon) {
        font-size: 0.8em;
    }

    /* --- HOMEPAGE CATEGORIEËN: tekst-only lijst --- */
    .categories-section > h2 {
        font-size: 1.3em;
        margin-bottom: 15px;
    }
    
    .categories-row {
        grid-template-columns: 1fr !important;
        gap: 0 !important;
    }
    
    .category-column {
        background: none;
        border: none;
        border-bottom: 1px solid #e9ecef;
        border-radius: 0;
        padding: 0;
        position: relative;
    }
    
    .category-column:last-child {
        border-bottom: none;
    }
    
    .category-column h3 {
        min-height: auto;
        font-size: 1em;
        padding-bottom: 0;
        border-bottom: none;
        margin-bottom: 0;
        align-items: center;
    }
    
    /* Link vult hele rij */
    .category-column h3 a {
        display: flex;
        justify-content: space-between;
        align-items: center;
        width: 100%;
        padding: 14px 0;
        color: #333;
    }
    
    .category-column h3 a:hover {
        color: #8B3A9C;
        text-decoration: none;
    }
    
    .category-column h3 a::after {
        content: '›';
        color: #999;
        font-size: 1.4em;
        font-weight: 400;
        flex-shrink: 0;
        margin-left: 10px;
    }
    
    /* Verberg productcount en subcategorieën op mobiel */
    .cat-count {
        display: none;
    }
    
    .category-column ul {
        display: none;
    }

    /* --- POPULAIRE PRODUCTEN --- */
    .popular-grid {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 10px !important;
    }
    
    .popular-card {
        padding: 10px;
    }
    
    .popular-card img {
        height: 80px;
    }
    
    .popular-card .product-title {
        font-size: 0.8em;
        -webkit-line-clamp: 2;
    }
    
    .popular-card .price-excl {
        font-size: 0.95em;
    }

    /* --- DEX SPELLETJES --- */
    .dex-games-section {
        padding: 20px;
        margin-top: 30px;
    }

    /* --- MERKLOGO'S --- */
    .brands-grid {
        grid-template-columns: repeat(3, 1fr) !important;
        gap: 10px !important;
    }
    
    .brand-logo-card {
        padding: 8px;
    }

    /* --- RESULTATEN PAGINA --- */
    .results-page {
        padding: 12px;
    }
    
    .breadcrumbs {
        font-size: 0.8em;
        margin-bottom: 12px;
        overflow-x: auto;
        white-space: nowrap;
        -webkit-overflow-scrolling: touch;
    }
    
    .results-layout {
        grid-template-columns: 1fr !important;
        gap: 15px !important;
    }
    
    /* Filter sidebar: inklapbaar op mobiel */
    .filter-sidebar {
        position: static !important;
        padding: 15px;
        border-radius: 8px;
    }
    
    /* Maak filter inklapbaar */
    .filter-sidebar .filter-title {
        cursor: pointer;
        display: flex;
        justify-content: space-between;
        align-items: center;
    }
    
    .filter-sidebar .filter-title::after {
        content: '▾';
        font-size: 0.9em;
    }
    
    .filter-sidebar.collapsed .filter-title::after {
        content: '▸';
    }
    
    .filter-sidebar.collapsed .filter-group,
    .filter-sidebar.collapsed .reset-filters,
    .filter-sidebar.collapsed .btn-filter,
    .filter-sidebar.collapsed .price-inputs {
        display: none;
    }
    
    .results-title h1 {
        font-size: 1.2em;
    }
    
    .results-header {
        flex-direction: column;
        gap: 10px;
    }
    
    .sort-box {
        width: 100%;
    }
    
    .sort-select {
        flex: 1;
    }
    
    /* Producttabel: kaart-layout op mobiel */
    .products-table thead {
        display: none !important;
    }

    .products-table,
    .products-table tbody,
    .products-table tr,
    .products-table td {
        display: block !important;
        width: 100% !important;
    }
    
    .products-table tr.product-row {
        padding: 12px;
        margin-bottom: 8px;
        border: 1px solid #eee;
        border-radius: 10px;
        display: grid;
        grid-template-columns: 60px 1fr;
        grid-template-rows: auto auto;
        gap: 0 12px;
        background: white;
    }
    
    .products-table .col-image {
        grid-row: 1 / 3;
        padding: 0;
        display: flex;
        align-items: center;
        border-bottom: none;
    }
    
    .products-table .col-image img {
        width: 55px !important;
        height: 55px !important;
    }
    
    /* Productnaam + merk */
    .products-table td:nth-child(2) {
        padding: 4px 0;
        border-bottom: none;
    }
    
    .product-name {
        font-size: 0.9em;
        line-height: 1.3;
    }
    
    .product-meta {
        font-size: 0.78em;
    }
    
    /* Prijs + voorraad + bestelknop op één rij */
    .products-table .col-price,
    .products-table .col-stock,
    .products-table td:nth-child(5) {
        grid-column: 2;
        padding: 2px 0;
        border-bottom: none;
    }
    
    .products-table .col-price {
        grid-column: 1 / -1;
        display: flex;
        align-items: center;
        gap: 8px;
        padding-top: 8px;
        border-top: 1px solid #f0f0f0;
        margin-top: 4px;
    }
    
    .col-price .price-excl {
        font-size: 1.05em;
    }
    
    .col-price .price-label,
    .col-price .price-incl {
        font-size: 0.78em;
    }
    
    .products-table .col-stock {
        grid-column: 1 / -1;
        font-size: 0.82em;
        padding-top: 4px;
    }
    
    /* Bestelrij */
    .products-table td:nth-child(5) {
        grid-column: 1 / -1;
        display: flex;
        align-items: center;
        gap: 8px;
        padding-top: 8px;
    }
    
    .result-qty-input {
        width: 50px !important;
    }
    
    /* Paginering */
    .pagination {
        flex-wrap: wrap;
        gap: 6px;
        padding: 12px 0;
        position: relative;
        z-index: 10;
    }
    
    .page-link {
        padding: 10px 14px;
        font-size: 0.9em;
        min-height: 44px;
        min-width: 44px;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        -webkit-tap-highlight-color: rgba(139, 58, 156, 0.2);
        touch-action: manipulation;
    }

    /* --- PRODUCT PAGINA --- */
    .product-page {
        padding: 12px;
    }
    
    .product-layout {
        grid-template-columns: 1fr !important;
        gap: 20px !important;
    }
    
    .product-images {
        position: static !important;
    }
    
    .product-main-image {
        max-height: 280px;
    }
    
    .product-thumbs img {
        width: 50px;
        height: 50px;
    }
    
    .product-info h1 {
        font-size: 1.2em;
        line-height: 1.3;
    }
    
    .spec-table th,
    .spec-table td {
        padding: 8px 10px;
        font-size: 0.85em;
    }
    
    .price-box {
        padding: 15px;
    }
    
    .price-box .price-main {
        font-size: 1.8em;
    }
    
    /* Knoppen full-width */
    .product-actions .btn-add-cart,
    .product-actions .btn-quote,
    .product-actions .btn-check-stock {
        width: 100%;
        justify-content: center;
    }
    
    .product-actions {
        flex-direction: column;
    }
    
    .dex-card {
        flex-direction: column;
        text-align: center;
        padding: 18px;
    }
    
    .dex-card-image img {
        width: 80px;
    }
    
    .specs-list {
        grid-template-columns: 1fr !important;
    }

    /* --- WINKELWAGEN --- */
    .cart-page {
        padding: 8px;
        overflow-x: hidden;
        width: 100% !important;
        max-width: 100vw !important;
        box-sizing: border-box !important;
    }
    .cart-page .cart-layout,
    .cart-page .cart-items,
    .cart-page .cart-summary,
    .cart-page .summary-box,
    .cart-page .cart-desktop-only,
    .cart-page .cart-mobile-only,
    .cart-page .cart-suggestions-section {
        max-width: 100% !important;
        box-sizing: border-box !important;
        overflow-x: hidden;
    }
    
    .cart-layout {
        grid-template-columns: 1fr !important;
        gap: 12px !important;
    }
    
    /* Desktop tabel verbergen, mobile cards tonen */
    .cart-desktop-only {
        display: none !important;
    }
    .cart-mobile-only {
        display: block !important;
    }
    
    .summary-box {
        position: static !important;
        box-sizing: border-box;
    }
    
    .btn-checkout {
        width: 100%;
        text-align: center;
        justify-content: center;
    }
    
    .cart-actions-bottom {
        flex-direction: column;
        gap: 8px;
    }
    
    .cart-empty-dex {
        max-width: 160px;
    }

    /* --- CHECKOUT --- */
    .checkout-page {
        padding: 12px;
    }
    
    .checkout-layout {
        grid-template-columns: 1fr !important;
        gap: 15px !important;
    }
    
    .checkout-sidebar {
        order: -1;
    }
    
    .checkout-summary {
        position: static !important;
    }
    
    .checkout-section h2 {
        font-size: 1.1em;
    }
    
    .step-nr {
        width: 24px;
        height: 24px;
        font-size: 0.85em;
    }
    
    .address-card {
        padding: 12px;
    }
    
    .checkout-field input,
    .checkout-field textarea {
        font-size: 16px; /* Voorkomt zoom op iOS */
    }

    /* --- ACCOUNT --- */
    .account-page {
        padding: 12px;
    }
    
    .account-layout {
        grid-template-columns: 1fr !important;
        gap: 15px !important;
    }
    
    .account-sidebar {
        position: static !important;
    }
    
    .account-nav {
        display: flex;
        flex-wrap: nowrap;
        gap: 4px;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        padding-bottom: 4px;
    }
    
    .account-nav-item {
        flex: 0 0 auto;
        text-align: center;
        padding: 8px 10px !important;
        font-size: 0.8em;
        border-radius: 6px;
        white-space: nowrap;
    }
    
    .account-nav-item .nav-icon {
        display: block;
        font-size: 1.3em;
        margin-bottom: 2px;
    }
    
    .dash-card {
        padding: 12px;
    }
    
    .dash-icon {
        font-size: 1.5em;
    }

    /* --- LOGIN --- */
    .login-page {
        padding: 12px;
    }
    
    .login-panel,
    .register-panel {
        padding: 20px;
    }
    
    .login-grid {
        grid-template-columns: 1fr !important;
    }

    /* --- REVIEWS --- */
    .reviews-page {
        padding: 12px;
    }
    
    .review-cards {
        grid-template-columns: 1fr !important;
    }

    /* --- FOOTER --- */
    .footer-inner {
        grid-template-columns: 1fr !important;
        gap: 20px;
        padding: 25px 15px;
    }
    
    .footer-section h4 {
        font-size: 1em;
        margin-bottom: 10px;
    }
    
    .newsletter-form {
        flex-direction: column;
    }
    
    .newsletter-form input {
        font-size: 16px; /* Voorkomt zoom op iOS */
    }
    
    .footer-bottom {
        font-size: 0.8em;
        padding: 12px 15px;
    }

    /* --- MERKEN PAGINA --- */
    .merken-page {
        padding: 12px;
    }
    
    .merken-grid {
        grid-template-columns: 1fr 1fr !important;
    }
    
    .merken-alphabet {
        gap: 4px;
        padding: 10px;
    }
    
    .alpha-link {
        width: 28px;
        height: 28px;
        font-size: 0.75em;
    }

    /* --- CONTACT PAGINA --- */
    .contact-grid {
        grid-template-columns: 1fr !important;
    }
    
    .contact-form-block {
        padding: 18px;
    }
    
    .form-row {
        grid-template-columns: 1fr !important;
    }

    /* --- 404 PAGINA --- */
    .error-404 h1 { font-size: 3em; }
    .error-404-img { max-width: 220px; }
    .error-404-actions { flex-direction: column; align-items: center; }

    /* --- TOAST NOTIFICATIES --- */
    .xo-toast {
        left: 10px;
        right: 10px;
        bottom: 10px;
        max-width: none;
    }

    /* --- DEX CHAT --- */
    .dex-chat-widget {
        bottom: 10px !important;
        right: 10px !important;
        max-width: calc(100vw - 20px) !important;
        max-height: 70vh !important;
    }

    /* --- ALGEMEEN --- */
    /* Voorkom horizontale scroll op body-niveau, maar laat kinderen scrollen */
    body {
        overflow-x: hidden;
    }
    
    /* Verbeter touch targets - alleen specifieke interactieve elementen */
    .mobile-menu-links a,
    .btn-filter,
    .btn-checkout,
    .btn-add-cart,
    .page-link,
    .search-btn {
        min-height: 44px;
    }
    
    /* Fix iOS input zoom */
    input, select, textarea {
        font-size: 16px;
    }
}


/* ================================================================
   TABLET: 769px - 1024px
   ================================================================ */
@media (min-width: 769px) and (max-width: 1024px) {
    
    .categories-row {
        grid-template-columns: repeat(3, 1fr) !important;
    }
    
    .popular-grid {
        grid-template-columns: repeat(3, 1fr) !important;
    }
    
    .brands-grid {
        grid-template-columns: repeat(4, 1fr) !important;
    }

    .results-layout {
        grid-template-columns: 200px 1fr !important;
    }
}

/* ================================================================
   IOS ZOOM PREVENTIE — font-size minimaal 16px op alle inputs
   (iOS Safari zoomt automatisch in als input font-size < 16px)
   ================================================================ */
@media (max-width: 768px) {
    input[type="text"],
    input[type="email"],
    input[type="password"],
    input[type="number"],
    input[type="tel"],
    input[type="url"],
    input[type="search"],
    textarea,
    select {
        font-size: 16px !important;
    }

    /* Minimale raakoppervlakken (WCAG 2.5.5: 44x44px) */
    .account-nav-item {
        padding: 10px 14px !important;
        min-height: 44px;
    }
    .btn-checkout,
    .btn-save,
    .btn-auth,
    .btn-action,
    .qty-btn {
        min-height: 44px;
    }

    /* Zoekbalk: kortere placeholder op smal scherm */
    .search-input {
        font-size: 16px !important; /* voorkomt iOS zoom */
    }

    /* Checkout sidebar: geen sticky op mobiel (voorkomt onverwacht scroll-gedrag) */
    .checkout-sidebar {
        position: static !important;
    }
}
