/* =============================================================
   MOBILE OPTIMIZED CSS - www.computo.com.pe
   Computo Nacional - B2B Technology E-commerce (Peru)
   Version: 1.0 - June 2026
   Focus: Mobile-first UX for product search + WhatsApp contact
   ============================================================= */

/* ─── MOBILE VIEWPORT: max-width 768px ─── */
@media (max-width: 768px) {

    /* ============================================================
       A. HEADER MOBILE
       ============================================================ */
    
    /* Make header compact */
    .cn-store-header {
        position: sticky !important;
        top: 0 !important;
        z-index: 9999 !important;
    }
    
    /* Logo smaller and left-aligned */
    .cn-store-logo img {
        width: 120px !important;
        height: auto !important;
    }
    
    /* Search bar: prominent, full-width, taller for touch */
    .cn-store-search form {
        height: 44px !important;
        border-radius: 22px !important;
        box-shadow: 0 2px 8px rgba(0,0,0,.12) !important;
    }
    .cn-store-search input {
        height: 44px !important;
        font-size: 15px !important;
        padding: 0 12px !important;
    }
    .cn-store-search button {
        height: 44px !important;
        min-width: 48px !important;
        font-size: 18px !important;
    }
    .cn-store-search .cn-search-icon-left {
        min-width: 42px !important;
        font-size: 17px !important;
    }
    
    /* Categories bar: horizontal scroll, smaller text */
    .cn-store-cats {
        padding: 8px 12px !important;
        overflow-x: auto !important;
        -webkit-overflow-scrolling: touch !important;
        scrollbar-width: none !important;
    }
    .cn-store-cats::-webkit-scrollbar {
        display: none !important;
    }
    .cn-store-cats ul {
        flex-wrap: nowrap !important;
    }
    .cn-store-cats a {
        font-size: 12px !important;
        white-space: nowrap !important;
    }
    .cn-store-cats li + li:before {
        margin: 0 8px !important;
    }

    /* ============================================================
       B. SIDEBAR & BANNERS - HIDE ON MOBILE
       ============================================================ */
    
    /* Hide left sidebar completely on mobile */
    .cn-left-sidebar,
    aside.has_mega_menu,
    .cn-sidebar-box,
    .cn-sidebar-card-main,
    .cn-sidebar-card {
        display: none !important;
    }
    
    /* Hide lateral banners */
    .cn-sidebar-card,
    div[class*="sidebar-card"],
    div[class*="banner-lateral"] {
        display: none !important;
    }

    /* Make main content full width when sidebar hidden */
    .cn-page-row {
        display: block !important;
    }
    .cn-main-content {
        max-width: 100% !important;
        width: 100% !important;
        min-width: 0 !important;
        padding: 0 !important;
        margin: 0 !important;
    }
    
    /* Secondary page wrapper tighter padding */
    .secondary_page_wrapper {
        padding: 10px 10px 8px !important;
    }

    /* ============================================================
       C. FOOTER - HIDE ON MOBILE
       ============================================================ */
    
    .cn-main-footer,
    footer#footer,
    footer .cn-main-footer {
        display: none !important;
    }

    /* ============================================================
       D. HOMEPAGE - SLIDER & PRODUCTS
       ============================================================ */
    
    /* Banner/slider: auto height, touch friendly */
    .cn-home-main-banner {
        border-radius: 6px !important;
        height: auto !important;
        min-height: 140px !important;
    }
    .cn-home-main-banner img {
        height: auto !important;
        object-fit: contain !important;
    }
    #slider_index {
        margin: 0 0 8px !important;
    }
    
    /* Products grid: always 2 columns on mobile */
    .cn-home-products-5 .cn-products-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
        gap: 10px !important;
    }
    
    .cn-home-products-5 {
        margin-top: 8px !important;
    }
    
    .cn-home-products-5 .product_item {
        padding: 10px !important;
        border-radius: 8px !important;
    }
    
    /* Product image area */
    .cn-home-products-5 .image_wrap {
        height: 120px !important;
        margin-bottom: 8px !important;
    }
    .cn-home-products-5 .image_wrap img {
        max-height: 110px !important;
    }
    
    /* Product name */
    .cn-home-products-5 .description > a:first-child {
        font-size: 12px !important;
        min-height: auto !important;
        max-height: none !important;
        margin-bottom: 6px !important;
        -webkit-line-clamp: 2 !important;
    }
    
    /* Product meta */
    .cn-home-products-5 .product_meta {
        padding: 5px 6px !important;
        margin-bottom: 6px !important;
    }
    .cn-home-products-5 .product_category {
        font-size: 10px !important;
        grid-template-columns: 60px minmax(0, 1fr) !important;
    }
    
    /* Price */
    .cn-home-products-5 .product_price b {
        font-size: 14px !important;
    }
    .cn-home-products-5 .cn-igv {
        font-size: 10px !important;
    }
    
    /* Buttons: touch-friendly min 44px height */
    .cn-home-products-5 .btn-home-action {
        min-height: 44px !important;
        font-size: 12px !important;
        padding: 10px 6px !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
    }
    .cn-home-products-5 .centered_buttons {
        margin-top: 8px !important;
        gap: 5px !important;
    }

    /* Section title */
    .offset_title,
    h3.offset_title {
        font-size: 18px !important;
        margin-bottom: 12px !important;
    }

    /* ============================================================
       E. PRODUCT DETAIL PAGE
       ============================================================ */
    
    .cn-product-page-2026 {
        padding: 10px 10px 20px !important;
    }
    
    /* Breadcrumb compact */
    .cn-product-breadcrumb {
        font-size: 11px !important;
        margin-bottom: 10px !important;
        gap: 6px !important;
    }
    
    /* Main grid: single column */
    .cn-product-main-grid {
        grid-template-columns: 1fr !important;
        gap: 14px !important;
    }
    
    /* Gallery card */
    .cn-gallery-card {
        min-height: auto !important;
        padding: 14px 12px !important;
    }
    .cn-gallery-stage {
        height: 220px !important;
        margin: 36px 6px 6px !important;
    }
    .cn-gallery-stage img {
        max-height: 200px !important;
    }
    .cn-product-thumbs {
        grid-template-columns: repeat(4, 1fr) !important;
        gap: 8px !important;
    }
    .cn-product-thumb {
        height: 60px !important;
    }
    /* Hide 5th thumb on mobile */
    .cn-product-thumb:nth-child(5) {
        display: none !important;
    }
    
    /* Info card */
    .cn-info-card {
        min-height: auto !important;
        padding: 16px 14px !important;
    }
    .cn-info-header {
        grid-template-columns: 1fr !important;
    }
    .cn-product-title {
        font-size: 18px !important;
    }
    .cn-brand-text {
        font-size: 22px !important;
    }
    .cn-short-description {
        font-size: 13px !important;
    }
    
    /* Product specs table */
    .cn-product-row {
        grid-template-columns: 100px 1fr !important;
        font-size: 12.5px !important;
    }
    .cn-product-value {
        padding-left: 12px !important;
    }
    .cn-product-price {
        font-size: 20px !important;
    }
    
    /* Action buttons */
    .cn-product-actions {
        display: grid !important;
        grid-template-columns: 1fr !important;
        gap: 10px !important;
    }
    .cn-btn-quote,
    .cn-btn-whatsapp {
        width: 100% !important;
        min-width: 0 !important;
        height: 50px !important;
        font-size: 14px !important;
    }
    
    /* Lower grid */
    .cn-product-lower-grid {
        grid-template-columns: 1fr !important;
        gap: 14px !important;
    }
    .cn-tabs-card {
        padding: 0 12px 14px !important;
    }
    .cn-detail-tabs {
        grid-template-columns: 1fr 1fr !important;
    }
    .cn-detail-tab {
        font-size: 11px !important;
        min-height: 40px !important;
    }
    .cn-tab-content {
        max-height: 260px !important;
        font-size: 12.5px !important;
    }
    
    /* Benefits */
    .cn-side-benefits,
    .cn-bottom-benefits {
        grid-template-columns: 1fr !important;
        padding: 10px 14px !important;
    }
    .cn-side-benefit,
    .cn-bottom-benefit {
        border-right: 0 !important;
        border-bottom: 1px solid #dfe7f2 !important;
        padding: 12px 0 !important;
    }
    .cn-side-benefit:last-child,
    .cn-bottom-benefit:last-child {
        border-bottom: 0 !important;
    }
    
    /* Related products */
    .cn-related-grid {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 10px !important;
    }
    .cn-related-section {
        padding: 16px 14px !important;
    }

    /* ============================================================
       F. PRODUCT LISTING PAGE
       ============================================================ */
    
    #cn-catalog .cn-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
        gap: 10px !important;
    }
    
    #cn-catalog .cn-header {
        padding: 12px !important;
        flex-direction: column !important;
        align-items: flex-start !important;
    }
    #cn-catalog .cn-title h2 {
        font-size: 16px !important;
    }
    #cn-catalog .cn-tools {
        width: 100% !important;
    }
    #cn-catalog .cn-sort {
        width: 100% !important;
    }
    
    /* Cards compact */
    #cn-catalog .cn-img-wrap {
        height: 130px !important;
        padding: 10px !important;
    }
    #cn-catalog .cn-body {
        padding: 10px 10px 12px !important;
        gap: 7px !important;
    }
    #cn-catalog .cn-name {
        font-size: 11.5px !important;
        min-height: 30px !important;
    }
    #cn-catalog .cn-meta {
        padding: 6px 8px !important;
    }
    #cn-catalog .cn-meta-row {
        font-size: 10px !important;
        grid-template-columns: 68px minmax(0, 1fr) !important;
    }
    #cn-catalog .cn-price {
        font-size: 14px !important;
    }
    
    /* Action buttons touch-friendly */
    #cn-catalog .cn-btn-info,
    #cn-catalog .cn-btn-solid-blue,
    #cn-catalog .cn-btn-wa {
        min-height: 44px !important;
        font-size: 11px !important;
        padding: 10px 6px !important;
    }

    /* ============================================================
       G. LOGIN / REGISTER PAGE
       ============================================================ */
    
    .cn-access-page-wrap {
        padding: 0 !important;
    }
    .cn-access-heading {
        font-size: 24px !important;
    }
    .cn-access-intro {
        font-size: 13px !important;
    }
    .cn-access-grid {
        grid-template-columns: 1fr !important;
        gap: 16px !important;
    }
    .cn-access-card-header,
    .cn-access-card-body {
        padding: 16px 14px !important;
    }
    .cn-access-card-title {
        font-size: 22px !important;
    }
    .cn-form-grid {
        grid-template-columns: 1fr !important;
        gap: 12px !important;
    }
    .cn-form-span-2 {
        grid-column: span 1 !important;
    }
    .cn-form-control {
        height: 46px !important;
        font-size: 14px !important;
    }
    .cn-btn-primary {
        min-height: 48px !important;
        font-size: 15px !important;
    }

    /* ============================================================
       H. LIBRO DE RECLAMACIONES
       ============================================================ */
    
    .libro-container {
        padding: 14px !important;
        margin-bottom: 16px !important;
    }
    .libro-title-bar {
        padding: 12px 14px !important;
        flex-direction: column !important;
        text-align: center !important;
    }
    .libro-title-bar h2 {
        font-size: 17px !important;
    }
    .libro-section-title {
        font-size: 13px !important;
    }
    
    /* Make all form inputs full-width */
    .libro-container .row {
        margin-left: 0 !important;
        margin-right: 0 !important;
    }
    .libro-container .col-sm-6 {
        width: 100% !important;
        float: none !important;
        padding-left: 0 !important;
        padding-right: 0 !important;
    }
    .form-group-custom input[type="text"],
    .form-group-custom input[type="email"],
    .form-group-custom select,
    .form-group-custom textarea {
        font-size: 14px !important;
        padding: 10px 12px !important;
        min-height: 44px !important;
    }
    .radio-group-custom {
        flex-direction: column !important;
        gap: 10px !important;
    }
    .button-custom,
    .button-secondary {
        width: 100% !important;
        min-height: 48px !important;
        font-size: 14px !important;
        text-align: center !important;
        display: block !important;
        margin-bottom: 8px !important;
    }
    
    /* Receipt responsive */
    .receipt-header-row {
        flex-direction: column !important;
    }
    .receipt-sheet-code {
        min-width: auto !important;
    }
    .receipt-field-grid {
        grid-template-columns: 1fr !important;
    }
    .receipt-cell {
        border-right: none !important;
    }
    .receipt-cell strong {
        width: 100% !important;
        display: block !important;
        margin-bottom: 3px !important;
    }

    /* ============================================================
       I. CONTACT PAGE
       ============================================================ */
    
    .contactenos h1,
    .section_offset h1 {
        font-size: 22px !important;
    }
    
    /* Make contact form single column */
    .type_2 .row .col-sm-6,
    .type_2 .row .col-sm-5,
    .type_2 .row .col-sm-7 {
        width: 100% !important;
        float: none !important;
        padding-left: 0 !important;
        padding-right: 0 !important;
        margin-bottom: 12px !important;
    }
    .type_2 input,
    .type_2 textarea,
    .type_2 select {
        width: 100% !important;
        min-height: 44px !important;
        font-size: 14px !important;
    }
    .button_dark_grey.big_btn {
        width: 100% !important;
        min-height: 48px !important;
    }
    
    /* Map responsive */
    .proportional_frame iframe {
        width: 100% !important;
        height: 250px !important;
    }
    
    /* Contact table responsive */
    #style_table_contactos .table {
        display: block !important;
        width: 100% !important;
    }
    #style_table_contactos thead {
        display: none !important;
    }
    #style_table_contactos tbody,
    #style_table_contactos tr {
        display: block !important;
        width: 100% !important;
    }
    #style_table_contactos td {
        display: block !important;
        padding: 8px 12px !important;
        text-align: left !important;
        border-bottom: 1px solid #edf2f7 !important;
    }
    #style_table_contactos td:before {
        content: attr(data-title) ": ";
        font-weight: 700;
        color: #003366;
    }
    #style_table_contactos tr {
        margin-bottom: 12px !important;
        border: 1px solid #dbe7f3 !important;
        border-radius: 8px !important;
        overflow: hidden !important;
    }

    /* ============================================================
       J. QUOTATION / CART PAGE
       ============================================================ */
    
    .cn-quote-container {
        padding: 0 !important;
    }
    .cn-quote-title {
        font-size: 18px !important;
    }
    
    /* Quote table: scroll on mobile */
    .cn-quote-table {
        display: block !important;
        overflow-x: auto !important;
        -webkit-overflow-scrolling: touch !important;
        font-size: 12px !important;
    }
    .cn-quote-table thead,
    .cn-quote-table tbody,
    .cn-quote-table tr {
        display: table !important;
        width: 100% !important;
        table-layout: fixed !important;
    }
    /* Hide ref price column and action on very small */
    .cn-quote-table th:nth-child(4),
    .cn-quote-table td:nth-child(4),
    .cn-quote-table th:nth-child(1),
    .cn-quote-table td:nth-child(1) {
        display: none !important;
    }
    .cn-quote-layout {
        flex-direction: column !important;
    }
    .cn-quote-left,
    .cn-quote-right {
        flex: 1 1 100% !important;
        width: 100% !important;
    }
    .cn-quote-right {
        padding: 16px !important;
    }
    .cn-form-control {
        min-height: 44px !important;
    }

    /* ============================================================
       K. MIS COTIZACIONES PAGE
       ============================================================ */
    
    .cn-quote-page-card {
        padding: 16px 12px !important;
    }
    .cn-header-card {
        flex-direction: column !important;
        gap: 12px !important;
        margin-bottom: 20px !important;
    }
    .cn-header-card-text h2 {
        font-size: 20px !important;
    }
    .cn-header-card-text p {
        font-size: 13px !important;
    }
    .cn-header-card-illustration {
        display: none !important;
    }
    .cn-header-card-icon {
        width: 40px !important;
        height: 40px !important;
    }
    
    /* Table scroll wrapper */
    .cn-table-wrapper {
        overflow-x: auto !important;
        -webkit-overflow-scrolling: touch !important;
    }
    .cn-table {
        min-width: 700px !important;
        font-size: 13px !important;
    }
    .cn-table th,
    .cn-table td {
        padding: 12px 14px !important;
        font-size: 13px !important;
    }
    
    /* Detail grid single column */
    .cn-detail-grid {
        grid-template-columns: 1fr !important;
        gap: 16px !important;
    }
    
    /* Pagination */
    .cn-pagination-container {
        flex-direction: column !important;
        align-items: center !important;
        gap: 12px !important;
    }

    /* ============================================================
       L. GENERAL MOBILE FIXES
       ============================================================ */
    
    /* Prevent horizontal overflow */
    html, body {
        overflow-x: hidden !important;
    }
    .wide_layout {
        overflow-x: hidden !important;
    }
    
    /* Container full width */
    #container_wrapper,
    .container {
        width: 100% !important;
        max-width: 100% !important;
        padding-left: 0 !important;
        padding-right: 0 !important;
    }
    
    /* All Bootstrap rows fix */
    .row {
        margin-left: 0 !important;
        margin-right: 0 !important;
    }
    .col-xs-12, .col-sm-6, .col-sm-5, .col-sm-7 {
        padding-left: 8px !important;
        padding-right: 8px !important;
    }
    
    /* Tables general responsive */
    .table-responsive {
        overflow-x: auto !important;
        -webkit-overflow-scrolling: touch !important;
    }
    
    /* Breadcrumbs compact */
    .breadcrumbs {
        font-size: 11px !important;
        padding: 8px 12px !important;
    }

    /* ============================================================
       M. BOTTOM NAVIGATION BAR (FIXED)
       ============================================================ */
    
    .cn-mobile-bottom-nav {
        display: flex !important;
    }
    
    /* Add padding to body so content isn't hidden behind bottom nav */
    body {
        padding-bottom: 64px !important;
    }
}

/* ─── EXTRA SMALL: max-width 480px ─── */
@media (max-width: 480px) {
    
    /* Single column products on very small screens */
    .cn-home-products-5 .cn-products-grid {
        grid-template-columns: 1fr !important;
    }
    
    #cn-catalog .cn-grid {
        grid-template-columns: 1fr !important;
    }
    
    .cn-related-grid {
        grid-template-columns: 1fr !important;
    }
    
    .cn-store-logo img {
        width: 110px !important;
    }
    
    .cn-product-title {
        font-size: 16px !important;
    }
}

/* ============================================================
   N. WHATSAPP FLOATING BUTTON
   (Always visible, all viewports)
   ============================================================ */

.cn-whatsapp-fab {
    position: fixed !important;
    bottom: 80px;
    right: 18px;
    z-index: 99999 !important;
    display: flex;
    align-items: center;
    gap: 10px;
    background: #25D366;
    color: #fff !important;
    text-decoration: none !important;
    border-radius: 50px;
    padding: 12px 20px;
    font-family: Roboto, Arial, sans-serif;
    font-size: 14px;
    font-weight: 700;
    box-shadow: 0 6px 24px rgba(37, 211, 102, .4), 0 2px 8px rgba(0,0,0,.12);
    transition: transform .2s ease, box-shadow .2s ease;
    line-height: 1;
}
.cn-whatsapp-fab:hover {
    transform: scale(1.05) !important;
    box-shadow: 0 8px 30px rgba(37, 211, 102, .5), 0 4px 12px rgba(0,0,0,.15);
    color: #fff !important;
}
.cn-whatsapp-fab i,
.cn-whatsapp-fab .cn-wa-icon {
    font-size: 22px;
    line-height: 1;
}
.cn-whatsapp-fab .cn-wa-label {
    display: inline;
}

/* On mobile, position above bottom nav */
@media (max-width: 768px) {
    .cn-whatsapp-fab {
        bottom: 78px;
        right: 14px;
        padding: 10px 16px;
        font-size: 13px;
    }
}

/* On very small screens, icon-only */
@media (max-width: 400px) {
    .cn-whatsapp-fab .cn-wa-label {
        display: none;
    }
    .cn-whatsapp-fab {
        border-radius: 50%;
        width: 56px;
        height: 56px;
        padding: 0;
        align-items: center;
        justify-content: center;
    }
    .cn-whatsapp-fab i,
    .cn-whatsapp-fab .cn-wa-icon {
        font-size: 26px;
    }
}

/* ============================================================
   O. MOBILE BOTTOM NAVIGATION BAR
   ============================================================ */

.cn-mobile-bottom-nav {
    display: none;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: 58px;
    background: #061f56;
    z-index: 99998;
    box-shadow: 0 -4px 16px rgba(0,0,0,.18);
    align-items: center;
    justify-content: space-around;
    padding: 0 4px;
    font-family: Roboto, Arial, sans-serif;
}

.cn-mobile-bottom-nav a {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-decoration: none !important;
    color: rgba(255,255,255,.7) !important;
    font-size: 10px;
    font-weight: 700;
    gap: 3px;
    padding: 6px 4px;
    flex: 1;
    min-width: 0;
    transition: color .15s ease;
}

.cn-mobile-bottom-nav a:hover,
.cn-mobile-bottom-nav a:active,
.cn-mobile-bottom-nav a.active {
    color: #fff !important;
}

.cn-mobile-bottom-nav a i {
    font-size: 20px;
    line-height: 1;
}

.cn-mobile-bottom-nav a.cn-bnav-wa {
    color: #25D366 !important;
}
.cn-mobile-bottom-nav a.cn-bnav-wa i {
    font-size: 22px;
}

/* Desktop: hide bottom nav */
@media (min-width: 769px) {
    .cn-mobile-bottom-nav {
        display: none !important;
    }
}

/* ============================================================
   P. TOUCH OPTIMIZATION (ALL MOBILE)
   ============================================================ */

@media (max-width: 768px) {
    /* Minimum touch target sizes */
    button,
    a.cn-btn,
    .cn-btn-primary,
    .cn-btn-secondary,
    input[type="submit"],
    input[type="button"],
    .btn-home-action,
    .cn-btn-info,
    .cn-btn-solid-blue,
    .cn-btn-wa {
        min-height: 44px !important;
    }
    
    /* Form inputs comfortable height */
    input[type="text"],
    input[type="email"],
    input[type="password"],
    input[type="number"],
    input[type="tel"],
    select,
    textarea {
        min-height: 44px !important;
        font-size: 14px !important;
    }
    
    /* Improve tap target spacing */
    .cn-left-menu > li > a {
        min-height: 48px !important;
    }
}

/* ============================================================
   Q. SEARCH RESULTS PAGE
   ============================================================ */
@media (max-width: 768px) {
    .cn-section-products {
        padding: 0 !important;
    }
    
    /* Predictive search dropdown */
    #sugerencias-busqueda {
        left: 0 !important;
        right: 0 !important;
        width: 100% !important;
        max-width: 100% !important;
    }
}
