/* ---- DESKTOP: ocultar solo el boton hamburguesa ---- */
@media (min-width: 769px) {
    #hamburger,
    .navigation__button,
    .nav-overlay {
        display: none !important;
    }
}

/* ---- GLOBAL MOBILE FIXES ---- */
@media (max-width: 768px) {

    /* Prevent horizontal scroll */
    html, body {
        overflow-x: hidden;
        width: 100%;
    }

    /* Container adjustments */
    .container-fluid {
        padding-left: 12px;
        padding-right: 12px;
    }

    .content {
        padding: 0;
        width: 100%;
    }

    /* Cards general */
    .card {
        padding: 12px;
        border-radius: 8px;
        margin-bottom: 12px;
    }
    .card-body {
        padding: 8px;
    }
    .card h3 {
        font-size: 14px;
    }

    /* Green line separator */
    hr.green {
        margin: 10px 0;
    }

    /* ---- HEADER MOBILE ---- */
    .top {
        padding: 0;
        position: sticky;
        top: 0;
        z-index: 100;
    }
    .top-mobile {
        display: flex;
        align-items: center;
        justify-content: space-between;
        padding: 8px 12px;
    }
    .top-mobile h1 {
        margin: 0;
        padding: 5px 0;
    }
    .top-mobile h1 img {
        height: 32px;
        width: auto;
    }

    /* Navigation menu */
    .navigation__wrapper {
        display: flex;
        align-items: center;
        gap: 12px;
    }
    .navigation__wrapper label {
        display: flex;
        align-items: center;
    }
    .navigation__wrapper a,
    .navigation__wrapper button {
        color: #9FC131;
        font-size: 18px;
        padding: 4px;
        background: transparent;
        border: none;
        display: flex;
        align-items: center;
        justify-content: center;
    }
    .navigation__links {
        position: fixed;
        width: 280px;
        height: 100vh;
        left: -300px;
        top: 0;
        z-index: 200;
        transition: left 0.3s ease;
        background: #1a1a1a;
        list-style: none;
        padding: 0 0 80px 0;
        margin: 0;
        box-shadow: 4px 0 20px rgba(0,0,0,0.5);
        overflow-y: auto;
    }
    #hamburger:checked ~ .navigation__links {
        left: 0;
    }
    /* Overlay para cerrar menú al tocar fuera */
    .nav-overlay {
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        background: rgba(0,0,0,0.5);
        z-index: 199;
        cursor: default;
        opacity: 0;
        pointer-events: none;
        transition: opacity 0.3s ease;
    }
    #hamburger:checked ~ .nav-overlay {
        opacity: 1;
        pointer-events: auto;
    }

    /* Fix hamburger button visibility */
    #hamburger {
        visibility: hidden;
        position: absolute;
        width: 0;
        height: 0;
    }
    .navigation__button {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        width: 35px;
        height: 35px;
        cursor: pointer;
    }
    .navigation__button svg {
        width: 28px;
        height: 28px;
        display: block;
    }
    .navigation__links li {
        padding: 12px 20px;
        border-bottom: 1px solid #2a2a2a;
    }
    .navigation__links li a {
        color: #fff;
        text-decoration: none;
        font-size: 13px;
        display: flex;
        align-items: center;
        gap: 10px;
    }
    .navigation__links li a i {
        width: 20px;
        color: #9FC131;
    }
    /* Iconos SVG a verde y tamaño uniforme en menú móvil */
    .navigation__links .icon-01,
    .navigation__links .icon-03,
    .navigation__links .icon-04,
    .navigation__links .icon-store {
        filter: invert(48%) sepia(79%) saturate(500%) hue-rotate(45deg) brightness(105%);
        width: 16px !important;
        height: 16px !important;
        margin-right: 0 !important;
        margin-bottom: 0 !important;
    }
    .navigation__links .icon-02 {
        filter: invert(48%) sepia(79%) saturate(500%) hue-rotate(45deg) brightness(105%);
        width: 14px !important;
        height: 18px !important;
        margin-right: 0 !important;
        margin-bottom: 0 !important;
    }
    .navigation__links li a i.fa-solid,
    .navigation__links li a i.fas {
        font-size: 16px;
        width: 16px;
        text-align: center;
    }
    .usermobile {
        background: #111;
        padding: 20px;
        flex-direction: column;
        gap: 4px;
    }
    .usermobile img {
        width: 36px;
        height: 36px;
        margin-bottom: 8px;
    }
    .usermobile span {
        color: #fff;
        font-size: 14px;
    }

    /* ---- STORE2 (TIENDA) ---- */
    .store-product-card {
        flex-direction: column;
        align-items: center;
        padding: 14px;
        gap: 12px;
    }
    .store-product-img {
        width: 120px !important;
        min-width: 120px !important;
        height: 120px !important;
    }
    .store-product-name {
        font-size: 15px;
        text-align: center;
    }
    .store-category {
        text-align: center;
    }
    .store-prices {
        justify-content: center;
        gap: 8px;
    }
    .store-price-row {
        padding: 6px 10px;
        flex: 1;
        min-width: 0;
    }
    .store-price-label {
        font-size: 10px;
    }
    .store-price-value {
        font-size: 14px;
    }
    .store-order-controls {
        padding: 10px;
    }
    .store-controls-row {
        flex-direction: column;
        gap: 8px;
    }
    .store-select-um {
        width: 100% !important;
        min-width: unset !important;
        font-size: 14px !important;
    }
    .store-input-qty {
        width: 100% !important;
        font-size: 14px !important;
    }
    .store-total-value {
        font-size: 18px;
        width: 120px;
    }
    .store-calculations {
        justify-content: center;
    }
    .store-btn-cart {
        padding: 14px;
        font-size: 15px;
    }

    /* White right header */
    .white-right {
        display: flex;
        justify-content: space-between;
        align-items: center;
        flex-wrap: wrap;
        gap: 8px;
    }
    .white-right h3 {
        font-size: 14px;
        margin: 0;
    }
    .white-right a {
        font-size: 12px;
    }

    /* ---- ORDERS (MIS PEDIDOS) ---- */
    .order-card {
        padding: 14px;
        margin-bottom: 12px;
    }
    .order-card .card-title {
        font-size: 14px;
    }
    .order-card .payment-resume {
        display: grid !important;
        grid-template-columns: 60px 1fr auto;
        grid-template-rows: auto auto;
        gap: 8px 12px;
        padding: 10px 0;
    }
    .order-card .thumb {
        width: 60px !important;
        min-width: 60px !important;
        height: 60px !important;
        grid-row: 1;
        grid-column: 1;
    }
    .order-card .resume {
        grid-row: 1;
        grid-column: 2 / -1;
        min-width: 0;
    }
    .order-card .resume h4 {
        font-size: 14px;
        word-wrap: break-word;
        overflow-wrap: break-word;
    }
    .order-card .resume p {
        font-size: 11px;
    }
    .order-card .cost {
        grid-row: 2;
        grid-column: 1 / -1;
        border-left: none;
        padding-left: 0;
        padding-top: 8px;
        text-align: right;
    }
    .order-card .cost b {
        font-size: 16px;
    }
    .order-card .order-again {
        grid-column: 1 / -1;
        width: 100%;
        text-align: right;
    }
    .btn-rastrear {
        padding: 14px;
        font-size: 15px;
    }
    .status-badge {
        font-size: 11px;
        padding: 2px 8px;
    }

    /* ---- FINISH (CARRITO) ---- */
    .cart-wrapper,
    .pay-wrapper {
        max-width: 100% !important;
        padding: 12px !important;
    }
    .cart-item {
        flex-direction: row;
        flex-wrap: wrap;
        gap: 10px;
        padding: 12px;
    }
    .cart-item-img {
        width: 50px !important;
        min-width: 50px !important;
        height: 50px !important;
    }
    .cart-item-info {
        flex: 1;
        min-width: 0;
    }
    .cart-item-info h5 {
        font-size: 14px;
    }
    .cart-item-info p {
        font-size: 11px;
    }
    .cart-item-right {
        min-width: unset !important;
        padding-left: 8px;
    }
    .cart-total-row {
        flex-wrap: wrap;
    }

    /* ---- PAYMENT / CHECKOUT ---- */
    .pay-item-img {
        width: 44px !important;
        min-width: 44px !important;
        height: 44px !important;
    }
    .pay-method-card {
        padding: 12px;
    }
    .pay-method-card label {
        font-size: 13px;
    }

    /* Form elements - sin !important para permitir override por vista */
    .form-control,
    .form-select,
    select,
    input[type="text"],
    input[type="number"],
    input[type="email"],
    input[type="tel"],
    input[type="password"],
    textarea {
        font-size: 16px;
        padding: 10px;
        border-radius: 6px;
    }

    /* Buttons */
    .btn {
        padding: 12px 20px;
        font-size: 14px;
        width: 100%;
        text-align: center;
    }
    .btn.btn-white {
        padding: 12px 30px;
    }

    /* ---- HELLO-USER / CAMBIAR CIUDAD ---- */
    .col-md-4 {
        padding: 0 12px;
    }
    .user {
        padding: 20px 15px 0 15px;
        min-height: 100vh;
    }
    .user .big {
        font-size: 18px;
    }

    /* ---- MY ADDRESS ---- */
    .payment-resume {
        flex-wrap: wrap;
        gap: 8px;
        padding: 10px 0;
    }
    .payment-resume .thumb {
        width: 40px;
        min-width: 40px;
    }
    .payment-resume .resume {
        flex: 1;
        min-width: 0;
    }
    .payment-resume .resume h4 {
        font-size: 14px;
        word-wrap: break-word;
    }

    /* ---- MY PAYMENTS ---- */
    .edit-card,
    .edit {
        font-size: 12px;
        padding: 6px 10px;
    }

    /* ---- THANKS ---- */
    .card.green {
        position: relative !important;
        width: 100% !important;
        left: 0 !important;
        height: auto !important;
        min-height: 60vh;
        padding: 30px 15px;
        border-radius: 8px !important;
    }
    .card.green h2 {
        font-size: 18px;
    }
    .card.red {
        position: relative !important;
        width: 100% !important;
        left: 0 !important;
        height: auto !important;
    }

    /* ---- NEW-USER / ADD-ADDRESS ---- */
    .row-cols-md-2 > .col {
        padding: 0;
    }

    /* ---- TABLES (general) ---- */
    table {
        display: block;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        width: 100%;
    }
    table th,
    table td {
        white-space: nowrap;
        padding: 8px 10px;
        font-size: 12px;
    }

    /* ---- MODALS ---- */
    .modal-dialog {
        margin: 15px;
        max-width: calc(100% - 30px);
    }
    .modal-content {
        border-radius: 10px;
    }
    .modal-body h1 {
        font-size: 16px;
    }

    /* ---- RASTREO (tracking) ---- */
    .rastreo-header {
        flex-direction: column;
        gap: 8px;
        padding: 12px;
    }
    .rastreo-header h3 {
        font-size: 14px;
    }
    .info-panel {
        flex-direction: column;
        gap: 6px;
        padding: 10px 12px;
    }
    .info-item {
        font-size: 12px;
    }
    .bottom-bar {
        padding: 8px 12px;
        font-size: 11px;
    }
    #map {
        min-height: 350px;
    }

    /* ---- FOOTER ---- */
    footer {
        padding: 15px 12px;
    }
    footer .container-fluid {
        padding: 0;
    }
    footer .container-fluid p {
        font-size: 11px;
    }

    /* ---- UTILITY: hide sidebar on mobile ---- */
    .b-example-divider,
    .b-example-vr {
        display: none;
    }

    /* Ensure images don't overflow */
    img {
        max-width: 100%;
        height: auto;
    }
    .img-full {
        width: 100%;
    }
}

/* ---- SMALL PHONES (< 400px) ---- */
@media (max-width: 400px) {
    .store-product-img {
        width: 100px !important;
        min-width: 100px !important;
        height: 100px !important;
    }
    .order-card .thumb {
        width: 50px !important;
        min-width: 50px !important;
        height: 50px !important;
    }
    .order-card .cost {
        width: 100%;
        border-left: none;
        border-top: 1px solid #9FC131;
        padding-left: 0;
        padding-top: 8px;
        text-align: left;
    }
    .cart-item-img {
        width: 44px !important;
        min-width: 44px !important;
        height: 44px !important;
    }
    h4 {
        font-size: 14px;
    }
    .rastreo-header {
        padding: 10px;
    }
    .btn-regresar {
        font-size: 11px;
        padding: 6px 12px;
    }
}

/* ---- LANDSCAPE PHONE ---- */
@media (max-width: 768px) and (orientation: landscape) {
    #map {
        min-height: 250px;
    }
    .card.green {
        min-height: 50vh;
    }
}

/* ---- TABLET (769px - 1024px) ---- */
@media (min-width: 769px) and (max-width: 1024px) {
    .store-product-card {
        gap: 16px;
    }
    .store-product-img {
        width: 150px;
        min-width: 150px;
        height: 150px;
    }
    .container-fluid {
        padding-left: 20px;
        padding-right: 20px;
    }
}