/* ===========================
   MOBILE CSS - Estilos para <= 768px
   Solo se aplica en dispositivos moviles
=========================== */

@media (max-width: 768px) {

    /* ===========================
       CONTAINER
    ============================ */

    .container-fluid {
        padding-left: 12px !important;
        padding-right: 12px !important;
    }

    /* ===========================
       MOBILE HEADER
    ============================ */

    .mobile-header {
        display: flex;
        align-items: center;
        justify-content: space-between;
        padding: 8px 0;
        position: relative;
        min-height: 50px;
    }

    .mobile-header-content {
        display: flex;
        align-items: center;
        justify-content: center;
        position: relative;
        flex: 1;
    }

    .mobile-brand-logo {
        width: 60px;
        height: 60px;
        object-fit: contain;
        opacity: .12;
        position: absolute;
    }

    .mobile-brand-name {
        font-size: 1.2rem;
        font-weight: 800;
        color: #1e293b;
        position: relative;
        z-index: 1;
    }

    .mobile-header-actions {
        display: flex;
        align-items: center;
        gap: 8px;
        flex-shrink: 0;
    }

    .mobile-header-spacer {
        width: 48px;
        flex-shrink: 0;
    }

    .mobile-hamburger {
        position: relative;
        width: 40px;
        height: 40px;
        border: none;
        border-radius: 10px;
        background: #3b82f6;
        color: white;
        font-size: 1.1rem;
        display: flex;
        align-items: center;
        justify-content: center;
        cursor: pointer;
        flex-shrink: 0;
    }

    #btnMobileMenu .cart-badge {
        position: absolute;
        top: -6px;
        right: -6px;
        background: #ef4444;
        color: white;
        font-size: .6rem;
        font-weight: 700;
        min-width: 17px;
        height: 17px;
        border-radius: 50%;
        display: flex;
        align-items: center;
        justify-content: center;
        padding: 0 4px;
        z-index: 2;
    }

    .mobile-hamburger:active {
        transform: scale(0.95);
    }

    /* ===========================
       MOBILE SEARCH
    ============================ */

    .mobile-search-wrap {
        margin-bottom: 8px;
    }

    .mobile-search-wrap .search-box {
        width: 100%;
    }

    .mobile-search-wrap .search-box input {
        width: 100%;
    }

    .search-loading {
        display: flex;
        align-items: center;
        color: #3b82f6;
    }

    /* ===========================
       MOBILE TOOLBAR
    ============================ */

    .mobile-toolbar {
        display: flex;
        align-items: center;
        gap: 6px;
        padding: 6px 0;
        margin-bottom: 8px;
    }

    .mobile-sort-chip {
        border: 1.5px solid #e2e8f0;
        background: white;
        color: #64748b;
        font-size: .72rem;
        font-weight: 600;
        padding: 5px 10px;
        border-radius: 16px;
        cursor: pointer;
        transition: all .15s;
        display: inline-flex;
        align-items: center;
        gap: 4px;
    }

    .mobile-sort-chip:hover {
        border-color: #3b82f6;
        color: #3b82f6;
    }

    .mobile-sort-chip.active {
        background: #3b82f6;
        border-color: #3b82f6;
        color: white;
    }

    .mobile-filter-chip {
        border: 1.5px solid #e2e8f0;
        background: white;
        color: #64748b;
        width: 30px;
        height: 30px;
        border-radius: 50%;
        cursor: pointer;
        display: flex;
        align-items: center;
        justify-content: center;
        font-size: .85rem;
    }

    .mobile-view-toggle {
        display: flex;
        background: #f1f5f9;
        border-radius: 8px;
        padding: 2px;
    }

    .mobile-view-toggle .view-btn {
        padding: 5px 8px;
        font-size: .85rem;
    }

    /* ===========================
       WATERMARK
    ============================ */

    .watermark-container {
        display: flex;
        align-items: center;
        justify-content: center;
        min-height: 300px;
    }

    .watermark-logo {
        width: 150px;
        height: 150px;
        object-fit: contain;
        opacity: .06;
    }

    /* ===========================
       MOBILE MENU
    ============================ */

    .mobile-menu-overlay {
        position: fixed;
        inset: 0;
        background: rgba(0,0,0,.4);
        z-index: 1050;
        animation: fadeIn .2s;
    }

    .mobile-menu-sheet {
        position: fixed;
        top: 0;
        right: 0;
        width: 260px;
        height: 100%;
        background: white;
        z-index: 1060;
        box-shadow: -4px 0 20px rgba(0,0,0,.15);
        animation: slideIn .25s ease;
        overflow-y: auto;
    }

    @keyframes slideIn {
        from { transform: translateX(100%); }
        to { transform: translateX(0); }
    }

    .mobile-menu-header {
        display: flex;
        align-items: center;
        justify-content: space-between;
        padding: 16px;
        border-bottom: 1px solid #e2e8f0;
        font-weight: 700;
        font-size: 1.1rem;
    }

    .mobile-menu-body {
        padding: 12px;
    }

    .mobile-menu-item {
        display: flex;
        align-items: center;
        gap: 12px;
        width: 100%;
        padding: 12px 14px;
        border: none;
        background: transparent;
        border-radius: 10px;
        font-size: .9rem;
        font-weight: 500;
        color: #334155;
        cursor: pointer;
        text-align: left;
    }

    .mobile-menu-item:hover {
        background: #f1f5f9;
    }

    .mobile-menu-item i {
        font-size: 1.1rem;
        width: 24px;
        text-align: center;
        color: #64748b;
    }

    .mobile-menu-divider {
        height: 1px;
        background: #e2e8f0;
        margin: 8px 0;
    }

    .mobile-menu-section {
        padding: 8px 14px;
    }

    .mobile-menu-label {
        font-size: .72rem;
        font-weight: 700;
        color: #94a3b8;
        text-transform: uppercase;
        margin-bottom: 8px;
    }

    .mobile-menu-radio {
        display: flex;
        align-items: center;
        gap: 8px;
        padding: 8px 0;
        font-size: .85rem;
        font-weight: 600;
        color: #475569;
        cursor: pointer;
    }

    .mobile-menu-radio input {
        accent-color: #3b82f6;
    }

    .btn-icon-sm {
        width: 32px;
        height: 32px;
        border: none;
        border-radius: 8px;
        background: #f1f5f9;
        color: #475569;
        display: flex;
        align-items: center;
        justify-content: center;
        cursor: pointer;
    }

    /* ===========================
       MOBILE CARDS GRID
    ============================ */

    .mobile-cards-grid {
        display: grid;
        grid-template-columns: repeat(2, 1fr);
        gap: 8px;
    }

    .mobile-cards-grid .card-col {
        padding-left: 4px;
        padding-right: 4px;
    }

    /* ===========================
       CARD OVERRIDES MOBILE
    ============================ */

    .product-card .card-body {
        padding: 8px;
    }

    .product-name {
        font-size: .7rem;
        min-height: 28px;
        -webkit-line-clamp: 2;
        margin-bottom: 4px;
    }

    .card-price-row {
        display: flex;
        flex-direction: column;
        gap: 2px;
    }

    .card-price-row .price {
        font-size: .85rem;
        font-weight: 800;
        color: #16a34a;
    }

    .card-price-row .original-price {
        font-size: .65rem;
        color: #94a3b8;
        text-decoration: line-through;
    }

    .promo {
        color: #dc2626;
        font-weight: 700;
        font-size: .65rem;
        margin-bottom: 2px;
    }

    .card-meta {
        font-size: .6rem;
        color: #64748b;
        margin-bottom: 4px;
    }

    .btn-list-add {
        width: 28px;
        height: 28px;
        font-size: .75rem;
    }

    .card-img-wrapper {
        height: 110px;
    }

    .store-badge-wrapper {
        top: 6px;
        left: 6px;
    }

    .store-badge {
        font-size: .55rem;
        padding: 2px 6px;
    }

    .promo-badge {
        top: 4px;
        right: 4px;
        font-size: .5rem;
        padding: 2px 5px;
    }

    .cross-store-badge {
        font-size: .5rem;
        padding: 2px 5px;
    }

    /* ===========================
       TABLE MOBILE
    ============================ */

    .table th {
        font-size: .7rem;
        padding: 8px 10px;
    }

    .table td {
        font-size: .78rem;
        padding: 8px 10px;
    }

    .table-image {
        width: 36px;
        height: 36px;
    }

    .table-name {
        font-size: .75rem;
        max-width: 120px;
    }

    /* ===========================
       MODAL MOBILE
    ============================ */

    .modal-content {
        border-radius: 12px;
    }

    .modal-body {
        padding: 16px;
    }

    .product-detail {
        grid-template-columns: 1fr;
        gap: 16px;
    }

    .detail-image {
        min-height: 150px;
        padding: 10px;
    }

    .detail-name {
        font-size: 1rem;
    }

    .detail-meta {
        gap: 10px;
    }

    .meta-item {
        font-size: .78rem;
    }

    /* ===========================
       TOAST MOBILE
    ============================ */

    .toast-msg {
        bottom: 80px;
        right: 16px;
        left: 16px;
        text-align: center;
    }

    /* ===========================
       FILTROS MOBILE
    ============================ */

    .filter-section-title {
        font-size: .72rem;
        font-weight: 700;
        color: #94a3b8;
        text-transform: uppercase;
        margin-bottom: 6px;
    }

    /* ===========================
       LISTS OFFCANVAS MOBILE
    ============================ */

    .offcanvas {
        width: 100% !important;
    }

    .offcanvas-toolbar {
        display: flex;
        gap: 6px;
        padding: 10px 20px;
        border-bottom: 1px solid #e2e8f0;
        background: #f8fafc;
    }

    .toolbar-btn {
        display: inline-flex;
        align-items: center;
        gap: 6px;
        padding: 7px 14px;
        border: 1px solid #e2e8f0;
        border-radius: 8px;
        background: white;
        color: #475569;
        font-size: .78rem;
        font-weight: 600;
        cursor: pointer;
        text-decoration: none;
        transition: all .15s;
    }

    .toolbar-btn:hover {
        border-color: #3b82f6;
        color: #3b82f6;
        background: #eff6ff;
    }

    /* ===========================
       PRICE RANGE - HIDDEN ON MOBILE
    ============================ */

    .price-range-filter {
        display: none !important;
    }

    /* ===========================
       RESULTS COUNT - FULL WIDTH
    ============================ */

    .results-count {
        font-size: .78rem;
        font-weight: 600;
        color: #64748b;
    }
}

/* ===========================
   DARK MODE MOBILE
=========================== */

body.dark .mobile-brand-name { color: #e0e0e0; }
body.dark .mobile-hamburger { background: #e0e0e0; color: #0a0a0a; }
body.dark .mobile-menu-sheet { background: #161616; }
body.dark .mobile-menu-header { border-color: #222; color: #e0e0e0; }
body.dark .mobile-menu-item { color: #d4d4d4; }
body.dark .mobile-menu-item:hover { background: #1e1e1e; }
body.dark .mobile-menu-radio { color: #aaa; }
body.dark .mobile-sort-chip { background: #1e1e1e; border-color: #2a2a2a; color: #888; }
body.dark .mobile-sort-chip.active { background: #e0e0e0; color: #0a0a0a; }
body.dark .mobile-filter-chip { background: #1e1e1e; border-color: #2a2a2a; color: #888; }
body.dark .btn-icon-sm { background: #1e1e1e; color: #888; }
body.dark .mobile-menu-overlay { background: rgba(0,0,0,.6); }
body.dark .offcanvas-toolbar { background: #111; border-color: #222; }
body.dark .toolbar-btn { background: #1e1e1e; border-color: #2a2a2a; color: #aaa; }
body.dark .toolbar-btn:hover { border-color: #3b82f6; color: #3b82f6; background: #1a2030; }
body.dark .mobile-view-toggle { background: #1e1e1e; }
body.dark .mobile-view-toggle .view-btn { color: #666; }
body.dark .mobile-view-toggle .view-btn.active { background: #e0e0e0; color: #0a0a0a; }

/* ===========================
   MOBILE FILTER DIALOG - menos ancho
=========================== */

.mobile-filter-dialog {
    max-width: 320px;
}

/* ===========================
   MINIMAL LIST MODE (mobile table)
=========================== */

#tableBodyMobile .table-image { display: none; }
#tableBodyMobile .table-name-cell .table-name {
    font-size: .78rem;
    -webkit-line-clamp: 2;
    line-height: 1.25;
}
#tableBodyMobile .table-price { font-size: .8rem; white-space: nowrap; }
#tableBodyMobile .table-unitprice { font-size: .68rem; white-space: nowrap; }
#tableBodyMobile .table-discount { font-size: .7rem; white-space: nowrap; }
#tableBodyMobile td { padding: 7px 8px; }

/* ===========================
   FAB - mobile position
=========================== */

.fab {
    right: 14px;
    bottom: 14px;
}
.fab-main { width: 50px; height: 50px; font-size: 1.4rem; }

/* ===========================
   PRODUCT DYNAMIC AREA mobile
=========================== */

#productDynamicArea { max-height: 200px; }
#productActionBar { flex-wrap: wrap; }

/* ===========================
   DARK FAB
=========================== */

body.dark .fab-item { background: #1e1e1e; color: #d4d4d4; }
body.dark .fab-item:hover { background: #3b82f6; color: white; }
body.dark .modal-json-pre { background: #0d0d0d; }

/* ===========================
   NOTIFICACIONES (MOBILE)
   =========================== */
@media (max-width: 768px) {
    .notif-hours { grid-template-columns: repeat(6, 1fr); }
    .notif-item { flex-wrap: wrap; }
    .notif-item-body { min-width: calc(100% - 52px); }
    .notif-item-edit { width: 100%; margin-top: 4px; }
    .notif-rule-editor {
        width: 100%; max-width: 100%; top: auto; bottom: 0; height: 78vh;
        border-left: none; border-top: 1px solid #e4e4e7; border-radius: 14px 14px 0 0;
    }
    .notif-hist-when { display: none; }
}

/* Watchlist: en movil las reglas en linea se apilan en columna */
@media (max-width: 768px) {
    .wl-container { padding-left: 12px; padding-right: 12px; }
    .wl-panel { padding: 12px; }
    .wl-search, .wl-filter { width: 100%; }
    .wl-header .brand-name { font-size: 1rem; }
    .wl-item { flex-wrap: wrap; }
    .wl-item-main { flex-basis: calc(100% - 70px); }
    .wl-item-remove { align-self: center; }
    .wl-inline { gap: 8px; }
    .wl-switch { font-size: .74rem; }
    .wl-reset { margin-left: 0; }
    .wl-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .wl-unread-item { flex-wrap: wrap; }
    .wl-unread-price { margin-left: auto; }
    .notif-pairing-steps { font-size: .8rem; }
    .notif-grid { gap: 12px; }
}
