/*
 * FC Web - ajustes de experiencia movil.
 * No redefine familias tipograficas: conserva Chillax/Roboto tal como estan.
 * Se carga despues de las hojas principales para poder sobrescribir solo el layout movil.
 */

/* El contador del carrito usa el acento de la marca, no el azul de Bootstrap. */
.shopping-car-icon .badge {
    background-color: #e94f13 !important;
    color: #ffffff !important;
}

@media (max-width: 767.98px) {
    :root {
        --fc-accent: #e94f13;
        --fc-accent-soft: rgba(233, 79, 19, 0.08);
        --fc-ink: #111111;
        --fc-muted: #6b7280;
        --fc-line: #e5e7eb;
        --fc-surface: #ffffff;
        --fc-radius: 16px;
        --fc-nav-height: 64px;
    }

    html {
        -webkit-text-size-adjust: 100%;
    }

    body {
        padding-bottom: calc(var(--fc-nav-height) + env(safe-area-inset-bottom, 0px));
        overflow-x: hidden;
    }

    main {
        overflow-x: hidden;
    }

    .container,
    .container-fluid {
        padding-left: 16px;
        padding-right: 16px;
    }

    /* ---------- Login / registro ---------- */
    main.bg-auth {
        min-height: calc(100vh - var(--fc-nav-height) - env(safe-area-inset-bottom, 0px));
        background-color: #dcdcdc;
    }

    .auth-content {
        height: auto;
        min-height: calc(100vh - 150px);
        margin-top: 0;
        padding: 16px 16px 32px;
        background-color: #dcdcdc;
    }

    .auth-content > img {
        display: none;
    }

    .auth-content:not(.register) .container {
        position: static;
        padding-left: 0;
        padding-right: 0;
    }

    .auth-content .row {
        height: auto !important;
        min-height: 0;
        justify-content: flex-start !important;
    }

    .auth-content .card {
        overflow: hidden;
        margin: 0 auto;
        border-radius: 16px;
    }

    .auth-content .card .card-body {
        padding: 16px;
    }

    .auth-content .card .form-control {
        height: 48px;
    }

    .auth-content .card .btn {
        min-height: 48px;
    }

    .auth-content .card .form-group.row > [class*="col-"] {
        flex: 0 0 100%;
        max-width: 100%;
    }

    .auth-content .text-section,
    .auth-content h1.text-section,
    .auth-content h5.text-section {
        display: none;
    }

    /* ---------- Header ---------- */
    #navbar {
        position: sticky;
        top: 0;
        z-index: 1030;
        padding: 8px 0 !important;
    }

    #navbar .container-fluid {
        padding-left: 12px;
        padding-right: 12px;
    }

    #navbar .first-content-wrapper {
        width: 100%;
        gap: 8px;
    }

    #navbar .first-content-wrapper .navbar-brand {
        flex: 0 0 auto;
        width: auto;
        max-width: 112px;
    }

    #navbar .first-content-wrapper .navbar-brand svg {
        width: 100%;
        height: auto;
    }

    #btn-menu {
        min-height: 40px;
        padding: 8px 4px;
        font-size: 13px;
        white-space: nowrap;
    }

    #btn-menu svg {
        width: 18px;
        height: 18px;
    }

    #navbar .first-content-wrapper .search-form {
        margin-right: 0;
    }

    #navbar .first-content-wrapper .search-form.open {
        position: absolute;
        top: 100%;
        left: 12px;
        right: 12px;
        z-index: 1050;
        width: auto;
        padding: 8px;
        overflow: visible;
        border-radius: 14px;
        background: #000;
        box-shadow: 0 16px 32px rgba(0, 0, 0, 0.18);
    }

    #navbar .first-content-wrapper .search-form.open .form-control {
        height: 44px;
        padding: 0 16px;
        border-radius: 999px;
        background: #fff;
        color: var(--fc-ink);
    }

    #suggestions {
        top: calc(100% + 8px) !important;
        left: 12px;
        right: 12px;
        width: auto !important;
        max-height: 60vh;
        overflow-y: auto;
        border-radius: 12px;
    }

    .h-search-btn {
        width: 40px;
        height: 40px;
        padding: 8px;
        flex: 0 0 40px;
    }

    .h-auth-buttons svg {
        width: 24px;
        height: 24px;
    }

    .h-select-coin {
        width: 76px;
    }

    .h-select-coin .form-control {
        height: 40px;
        font-size: 13px;
    }

    /* El bloque de vendedor fijo se reserva para escritorio. */
    .datos-vendedor {
        display: none !important;
    }

    /* ---------- Mega menu ---------- */
    .mega-menu {
        position: fixed !important;
        top: auto !important;
        right: 0;
        bottom: calc(var(--fc-nav-height) + env(safe-area-inset-bottom, 0px));
        left: 0;
        width: 100% !important;
        max-height: calc(100vh - 140px);
        overflow-y: auto;
        border-radius: var(--fc-radius) var(--fc-radius) 0 0;
        box-shadow: 0 -12px 32px rgba(0, 0, 0, 0.12);
    }

    /* ---------- Tarjetas de producto ---------- */
    .ficha-resumen {
        margin-bottom: 12px;
    }

    .ficha-resumen .card {
        overflow: hidden;
        border: 1px solid var(--fc-line);
        border-radius: var(--fc-radius);
        box-shadow: 0 8px 20px rgba(17, 17, 17, 0.06);
    }

    .ficha-resumen .card .card-body {
        padding: 12px;
    }

    .ficha-resumen .list-group-item {
        padding: 8px 12px;
        border-color: var(--fc-line);
        font-size: 13px;
        line-height: 1.35;
    }

    .ficha-resumen .list-group-item.title {
        min-height: 38px;
        font-weight: 500;
    }

    .ficha-resumen .price-row {
        display: flex;
        align-items: baseline;
        justify-content: space-between;
        gap: 8px;
    }

    .ficha-resumen .price-label {
        display: block;
        font-size: 11px;
        font-weight: 400;
        color: var(--fc-muted);
        letter-spacing: 0.02em;
        text-transform: uppercase;
    }

    .ficha-resumen .price-value {
        display: block;
        font-size: 20px;
        font-weight: 700;
        line-height: 1.1;
        color: var(--fc-ink);
    }

    .ficha-resumen .price-value-ves {
        font-size: 15px;
        font-weight: 600;
    }

    .ficha-resumen .fc-guest-price {
        color: var(--fc-muted);
        font-size: 12px;
    }

    .ficha-resumen .fc-guest-price a {
        color: var(--fc-accent);
        font-weight: 600;
    }

    .ficha-resumen .overlay2 {
        opacity: 1 !important;
        transition: none;
    }

    /* CTA siempre visible en movil; deja de depender del hover y no tapa el precio. */
    .imag-container {
        position: relative;
    }

    .imag-container .overlay2 {
        position: static !important;
        display: flex;
        flex-direction: column;
        justify-content: center;
        width: 100%;
        padding: 0 12px 12px;
        color: inherit;
        background: transparent;
    }

    .imag-container .overlay2 .btn {
        min-height: 44px;
        margin: 0;
        border-radius: 12px;
        font-size: 15px;
    }

    /* ---------- Carruseles ---------- */
    .recent-carousel .lista-vendidos > .ficha-resumen,
    .offerts-carousel .row > .ficha-resumen {
        flex: 0 0 50%;
        max-width: 50%;
    }

    .recent-content,
    .offerts-content {
        padding-left: 4px;
        padding-right: 4px;
    }

    .chevron-left,
    .chevron-right {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        width: 40px;
        height: 40px;
    }

    .owl-theme .owl-dots {
        margin-top: 8px;
    }

    .owl-theme .owl-dots .owl-dot span {
        width: 6px;
        height: 6px;
        margin: 4px;
    }

    /* ---------- Secciones y jerarquia ---------- */
    section,
    .top-products-section,
    .category-section {
        padding-top: 32px;
        padding-bottom: 32px;
    }

    h1 {
        font-size: 26px;
        line-height: 1.2;
    }

    h2 {
        font-size: 22px;
        line-height: 1.25;
    }

    h3 {
        font-size: 18px;
        line-height: 1.3;
    }

    h4 {
        font-size: 16px;
        line-height: 1.35;
    }

    p,
    li {
        font-size: 14px;
        line-height: 1.5;
    }

    .btn {
        min-height: 44px;
    }

    /* ---------- Tablas ---------- */
    .table-responsive-mobile,
    .table-responsive {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    #datostabla {
        font-size: 13px;
    }

    #datostabla th,
    #datostabla td {
        padding: 10px 8px;
        white-space: nowrap;
        vertical-align: middle;
    }

    .dataTables_wrapper .pagination .page-link {
        border-color: var(--fc-line);
        color: var(--fc-ink);
    }

    .dataTables_wrapper .pagination .page-item.active .page-link {
        border-color: var(--fc-accent);
        background-color: var(--fc-accent);
        color: #ffffff;
    }

    .dataTables_wrapper .dataTables_filter input:focus,
    .dataTables_wrapper .dataTables_length select:focus {
        border-color: var(--fc-accent);
        box-shadow: 0 0 0 0.2rem var(--fc-accent-soft);
        outline: none;
    }

    table.dataTable.dtr-inline.collapsed > tbody > tr[role="row"] > td.dtr-control:before,
    table.dataTable.dtr-inline.collapsed > tbody > tr[role="row"] > th.dtr-control:before {
        border-color: #ffffff;
        background-color: var(--fc-accent);
    }

    table.dataTable.dtr-inline.collapsed > tbody > tr.parent > td.dtr-control:before,
    table.dataTable.dtr-inline.collapsed > tbody > tr.parent > th.dtr-control:before {
        background-color: var(--fc-muted);
    }

    table.dataTable tbody > tr.selected,
    table.dataTable tbody > tr > .selected {
        background-color: var(--fc-accent-soft) !important;
        color: var(--fc-ink) !important;
    }

    .pagination .page-link {
        border-color: var(--fc-line);
        color: var(--fc-ink);
    }

    .pagination .page-item.active .page-link {
        border-color: var(--fc-accent);
        background-color: var(--fc-accent);
        color: #ffffff;
    }

    .pagination .page-link:focus {
        box-shadow: 0 0 0 0.2rem var(--fc-accent-soft);
    }

    /* ---------- Navegacion inferior ---------- */
    .fc-mobile-nav {
        position: fixed;
        right: 0;
        bottom: 0;
        left: 0;
        z-index: 1040;
        display: flex;
        gap: 2px;
        padding: 6px 8px calc(6px + env(safe-area-inset-bottom, 0px));
        border-top: 1px solid var(--fc-line);
        background: var(--fc-surface);
        box-shadow: 0 -8px 24px rgba(17, 17, 17, 0.06);
    }

    .fc-mobile-nav a,
    .fc-mobile-nav a:link,
    .fc-mobile-nav a:visited,
    .fc-mobile-nav a:hover,
    .fc-mobile-nav a:focus,
    .fc-mobile-nav a:active,
    .fc-mobile-nav button,
    .fc-mobile-nav button:hover,
    .fc-mobile-nav button:focus,
    .fc-mobile-nav button:active {
        position: relative;
        display: flex;
        flex: 1;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        gap: 3px;
        min-height: 52px;
        padding: 4px;
        border: 0;
        border-radius: 12px;
        outline: none;
        background: transparent;
        box-shadow: none;
        color: var(--fc-muted) !important;
        font-size: 11px;
        font-weight: 500;
        line-height: 1;
        text-decoration: none !important;
    }

    .fc-mobile-nav a svg,
    .fc-mobile-nav button svg {
        display: block;
        width: 22px;
        height: 22px;
        color: inherit;
    }

    .fc-mobile-nav a.is-active,
    .fc-mobile-nav a.is-active:hover,
    .fc-mobile-nav a.is-active:focus,
    .fc-mobile-nav button.is-active,
    .fc-mobile-nav button.is-active:hover,
    .fc-mobile-nav button.is-active:focus {
        color: var(--fc-accent) !important;
        background: var(--fc-accent-soft);
    }

    .fc-mobile-nav .fc-nav-badge {
        position: absolute;
        top: 2px;
        right: calc(50% - 18px);
        min-width: 16px;
        height: 16px;
        padding: 0 4px;
        border-radius: 999px;
        background: var(--fc-accent);
        color: #fff;
        font-size: 10px;
        font-weight: 600;
        line-height: 16px;
        text-align: center;
    }

    .icon-ws {
        right: 14px;
        bottom: calc(var(--fc-nav-height) + 12px + env(safe-area-inset-bottom, 0px)) !important;
    }

    .icon-ws img {
        width: 44px;
        height: 44px;
    }

    /* ---------- Estados ---------- */
    .fc-empty-state {
        padding: 32px 16px;
        border: 1px dashed var(--fc-line);
        border-radius: var(--fc-radius);
        background: #fafafa;
        color: var(--fc-muted);
        text-align: center;
    }

    .fc-empty-state strong {
        display: block;
        margin-bottom: 6px;
        color: var(--fc-ink);
        font-size: 16px;
    }

    /* ---------- Facturas en tarjetas ---------- */
    .fc-responsive-table thead {
        display: none;
    }

    .fc-responsive-table tbody tr {
        display: block;
        margin-bottom: 12px;
        padding: 12px;
        border: 1px solid var(--fc-line);
        border-radius: 12px;
        background: #fff;
    }

    .fc-responsive-table tbody td {
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 12px;
        padding: 6px 0;
        border: 0;
        white-space: normal;
        text-align: right;
    }

    .fc-responsive-table tbody td::before {
        content: attr(data-label);
        color: var(--fc-muted);
        font-size: 12px;
        font-weight: 500;
        text-align: left;
    }

    .fc-responsive-table tbody td[data-label="Seleccionar"] {
        justify-content: flex-start;
        padding-bottom: 8px;
        border-bottom: 1px solid var(--fc-line);
    }

    .fc-responsive-table tbody td[data-label="Seleccionar"]::before {
        display: none;
    }

    .fc-responsive-table tbody td[data-label="Factura"] {
        font-weight: 600;
        color: var(--fc-ink);
    }
}

@media (min-width: 768px) {
    .fc-mobile-nav {
        display: none !important;
    }
}
