@import url('https://fonts.googleapis.com/css2?family=Manrope:wght@400;500;600;700;800&family=Archivo:wght@600;700&display=swap');

:root {
    --sales-bg: #f3f7fa;
    --sales-card: #ffffff;
    --sales-border: #dce6ef;
    --sales-text: #0f2740;
    --sales-muted: #64748b;
    --sales-primary: #0a6fdc;
    --sales-accent: #0f9d8d;
    --sales-warm: #f39c12;
    --sales-danger: #df4b3f;
    --sales-shadow: 0 14px 34px rgba(10, 46, 87, 0.1);
}

html,
body {
    height: 100%;
}

body {
    overflow: hidden;
}

.tienda-content {
    background:
        radial-gradient(circle at 0% 0%, rgba(10, 111, 220, 0.08), transparent 40%),
        radial-gradient(circle at 100% 100%, rgba(15, 157, 141, 0.08), transparent 35%),
        var(--sales-bg);
    height: calc(100vh - var(--platform-header-height, 56px));
    min-height: calc(100vh - var(--platform-header-height, 56px));
    overflow: hidden;
}

.sales-shell {
    font-family: "Manrope", "Segoe UI", sans-serif;
    color: var(--sales-text);
    height: 100%;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.sales-page-title {
    font-family: "Archivo", "Manrope", sans-serif;
    font-size: 1.4rem;
    font-weight: 700;
    letter-spacing: 0.01em;
    color: #11365c;
    margin-top: 0.1rem;
}

.sales-shell > .row {
    flex: 1;
    min-height: 0;
}

.sales-fixed-panel {
    height: 100%;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    min-height: 0;
}

.sales-billing-block {
    height: 100%;
    min-height: 0;
    max-height: 100%;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    box-sizing: border-box;
    position: relative;
}

#form_venta {
    height: 100%;
    min-height: 0;
    display: flex;
    flex-direction: column;
}

.sales-billing-content {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    overflow-x: hidden;
    overscroll-behavior: contain;
    padding-right: 0.35rem;
    padding-bottom: 1rem;
    scrollbar-width: thin;
}

.sales-submit-sticky {
    position: sticky;
    bottom: 0;
    z-index: 8;
    margin-top: 0.75rem;
    padding: 0.5rem 0 0.35rem;
    background: linear-gradient(to top, rgba(243, 247, 250, 0.98) 70%, rgba(243, 247, 250, 0));
}

.sales-submit-sticky #add_buy {
    margin-top: 0 !important;
    box-shadow: 0 8px 24px rgba(10, 46, 87, 0.22);
}

.sales-billing-content::-webkit-scrollbar {
    width: 8px;
}

.sales-billing-content::-webkit-scrollbar-thumb {
    background: #b7c9d9;
    border-radius: 10px;
}

.sales-billing-content::-webkit-scrollbar-track {
    background: #eef4fa;
}

.sales-hero {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    padding: 1.1rem 1.25rem;
    border: 1px solid var(--sales-border);
    border-radius: 16px;
    background:
        linear-gradient(115deg, rgba(10, 111, 220, 0.95), rgba(9, 83, 164, 0.95)),
        #0a6fdc;
    color: #fff;
    box-shadow: var(--sales-shadow);
    animation: riseIn 320ms ease;
}

.sales-kicker {
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-size: 11px;
    font-weight: 700;
    opacity: 0.9;
}

.sales-hero h2 {
    font-family: "Archivo", "Manrope", sans-serif;
    font-size: 1.55rem;
    font-weight: 700;
}

.sales-subtitle {
    opacity: 0.92;
    max-width: 700px;
    font-size: 0.95rem;
}

.sales-hero-right {
    display: grid;
    grid-template-columns: repeat(3, minmax(120px, 1fr));
    gap: 0.65rem;
    align-items: center;
}

.metric-pill {
    border: 1px solid rgba(255, 255, 255, 0.24);
    background: rgba(255, 255, 255, 0.14);
    border-radius: 12px;
    padding: 0.5rem 0.75rem;
    display: flex;
    flex-direction: column;
}

.metric-pill-label {
    font-size: 11px;
    opacity: 0.9;
}

.metric-pill-value {
    font-size: 1.05rem;
    font-weight: 800;
}

.sales-banner {
    border: 1px solid #c8ddf6;
    background: linear-gradient(90deg, #eef5ff, #f2fbff);
    padding: 0.42rem 0.62rem;
    border-radius: 10px;
    margin-bottom: 0.65rem !important;
}

.sales-banner-main {
    display: grid;
    grid-template-columns: minmax(320px, 1fr) minmax(140px, 200px);
    gap: 0.55rem;
    align-items: center;
}

.sales-banner-rate {
    min-width: 0;
    font-size: 0.83rem;
    line-height: 1.2;
}

.sales-banner-rate .badge {
    font-size: 0.72rem !important;
    padding: 0.28em 0.45em;
}

.sales-banner-rate small {
    margin-top: 0.2rem !important;
    font-size: 0.7rem;
}

.sales-banner-date .form-control {
    min-width: 140px;
    max-width: 180px;
    height: 31px;
    padding-top: 0.16rem;
    padding-bottom: 0.16rem;
    font-size: 0.78rem;
}

.sales-banner-date .form-label {
    font-size: 0.68rem;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--sales-muted);
    margin-bottom: 0.2rem !important;
}

.sales-panel {
    border: 1px solid var(--sales-border);
    border-radius: 14px;
    box-shadow: 0 8px 20px rgba(16, 39, 66, 0.06);
    background: var(--sales-card);
    overflow: hidden;
    animation: riseIn 280ms ease;
}

.sales-panel .card-body,
.sales-panel.card {
    padding: 1rem 1.1rem;
}

.sales-panel-title {
    font-size: 0.83rem;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    color: var(--sales-muted);
    font-weight: 800;
    margin-bottom: 0.8rem;
}

.client-search-card {
    position: relative;
    z-index: 3;
    flex-shrink: 0;
}

#seccionCliente {
    position: relative;
    margin-top: 0.75rem !important;
    z-index: 1;
    flex: 1;
    min-height: 0;
    border: 1px solid #d6e4f2;
    border-radius: 12px;
    background: #fbfdff;
    overflow: hidden;
}

#tabla-container {
    position: relative;
    padding-top: 0.2rem;
    height: 100%;
    overflow-y: auto;
    overflow-x: hidden;
    padding-right: 0.2rem;
    scrollbar-width: thin;
}

#tabla-container::-webkit-scrollbar {
    width: 7px;
}

#tabla-container::-webkit-scrollbar-thumb {
    background: #c6d7e8;
    border-radius: 10px;
}

#tabla-container::-webkit-scrollbar-track {
    background: #eef4fa;
}

#tabla-container .autocomplete-results,
#tabla-container .card {
    position: relative;
    margin-top: 0;
    z-index: 1;
}

.sales-banner-date {
    justify-self: end;
    width: 100%;
    max-width: 190px;
}

.sales-bottom-dock {
    position: relative;
    flex-shrink: 0;
    z-index: 10;
    margin-top: 0;
    padding-top: 0.35rem;
    padding-bottom: 0.15rem;
    background: linear-gradient(to top, rgba(243, 247, 250, 0.98) 78%, rgba(243, 247, 250, 0));
    border-top: 1px solid rgba(220, 230, 239, 0.9);
    opacity: 1;
    transform: translateY(0);
    transition: opacity 180ms ease, transform 180ms ease, max-height 180ms ease, margin 180ms ease, padding 180ms ease;
}

.sales-bottom-dock-customer {
    position: sticky;
    bottom: 0;
    margin-top: auto;
}

.sales-bottom-dock.is-hidden {
    opacity: 0;
    transform: translateY(12px);
    pointer-events: none;
    max-height: 0;
    overflow: hidden;
    margin-top: 0;
    padding-top: 0;
    padding-bottom: 0;
    border-top-color: transparent;
}

#compact_checkout_dock_host_customer,
#compact_checkout_dock_host_mobile {
    display: contents;
}

.checkout-compact-panel {
    border-radius: 12px;
    box-shadow: 0 10px 22px rgba(10, 46, 87, 0.14);
}

.checkout-compact-panel .card-body {
    padding: 0.62rem 0.78rem;
}

.checkout-compact-panel .sales-panel-title {
    margin-bottom: 0.45rem;
    font-size: 0.74rem;
}

.checkout-compact-panel small {
    font-size: 0.72rem;
    line-height: 1.15;
}

.checkout-compact-panel .badge {
    font-size: 0.68rem;
    padding: 0.3em 0.45em;
}

.checkout-compact-panel strong {
    font-size: 0.88rem !important;
    font-weight: 700;
}

#compact_subtotal_usd,
#compact_total_objetivo_usd {
    font-size: 0.9rem;
}

#add_product,
#add-payment-method {
    border-radius: 10px;
    font-weight: 700;
}

#add_buy {
    border-radius: 10px;
    font-size: 0.9rem;
    font-weight: 800;
    letter-spacing: 0.02em;
    padding: 0.52rem 0.85rem;
    background: linear-gradient(100deg, #0a6fdc, #0f9d8d);
    border: none;
}

#add_buy:hover {
    filter: brightness(1.04);
}

.payment-method {
    border: 1px solid #d6e2ee;
    border-radius: 10px;
    background: #f8fbff;
    padding: 0.68rem 0.78rem;
}

.payment-method .mb-3 {
    margin-bottom: 0.55rem !important;
}

.payment-method .form-label {
    font-size: 0.72rem;
    font-weight: 700;
    margin-bottom: 0.2rem;
    color: #52677d;
}

.payment-method .form-control,
.payment-method .form-select,
.payment-method .input-group-text {
    min-height: 32px;
    height: 32px;
    font-size: 0.77rem;
}

.payment-method .form-control,
.payment-method .form-select {
    padding: 0.24rem 0.42rem;
    border-radius: 8px;
}

.payment-method .input-group-text {
    padding: 0.24rem 0.45rem;
    font-weight: 700;
}

.payment-method-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.45rem;
}

.payment-method-header h5 {
    font-family: "Archivo", "Manrope", sans-serif;
    font-size: 0.86rem;
    font-weight: 700;
    margin: 0;
}

.payment-method .remove-payment {
    font-size: 0.72rem;
    font-weight: 700;
    color: #bd3b30;
}

.payment-method .row.g-2 {
    --bs-gutter-x: 0.45rem;
    --bs-gutter-y: 0.35rem;
}

.payment-method-top-row {
    align-items: end;
    margin-bottom: 0.55rem;
}

.payment-method-top-row > [class*="col-"] {
    margin-bottom: 0;
}

.payment-method .tasa-fecha-display {
    font-size: 0.67rem;
}

#credit-fields {
    border: 1px dashed #b5c8db;
    border-radius: 12px;
    background: #f9fcff;
    padding: 0.9rem;
}

.sales-summary-panel {
    border: 1px solid #d6e5f2;
    background: linear-gradient(180deg, #f6fbff 0%, #f9fdff 100%);
}

.sales-summary-panel .card-title {
    font-family: "Archivo", "Manrope", sans-serif;
    font-weight: 700;
    color: #174271;
}

.sales-summary-panel .progress {
    background-color: #dfeaf3;
    border-radius: 999px;
}

.sales-summary-panel .progress-bar {
    border-radius: 999px;
    transition: width 240ms ease;
}

#payment-methods-container .payment-method + .payment-method {
    margin-top: 0.75rem;
}

#tabla-container .card {
    border-radius: 12px;
}

.pos-table-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 0.6rem;
}

.pos-table-header h6 {
    font-family: "Archivo", "Manrope", sans-serif;
    color: #133a63;
    font-size: 0.95rem;
    font-weight: 700;
}

.pos-table-header small {
    font-size: 0.76rem;
}

.pos-mode-pill {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid #bfd7ec;
    border-radius: 999px;
    background: #eef6ff;
    color: #0f4d85;
    font-weight: 800;
    letter-spacing: 0.08em;
    font-size: 0.67rem;
    padding: 0.24rem 0.52rem;
}

.pos-table-wrap {
    border: 1px solid #d3e1ef;
    border-radius: 12px;
    background: #fbfdff;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.85);
}

.sales-products-table {
    margin-bottom: 0;
    border-collapse: separate;
    border-spacing: 0;
    min-width: 980px;
}

.sales-products-table thead th {
    position: sticky;
    top: 0;
    z-index: 2;
    background: linear-gradient(180deg, #e7f1fb 0%, #f1f7fe 100%);
    color: #214b72;
    font-size: 0.73rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-weight: 800;
    border-bottom: 1px solid #cfe0f0;
    border-right: 1px solid #dde9f5;
    padding: 0.56rem 0.52rem;
    white-space: nowrap;
}

.sales-products-table tbody td {
    border-top: 1px solid #e4edf6;
    border-right: 1px solid #edf3f9;
    padding: 0.48rem 0.5rem;
    vertical-align: middle;
    background: #ffffff;
}

.sales-products-table tbody tr:nth-child(even) td {
    background: #f9fcff;
}

.sales-products-table tbody tr:hover td {
    background: #eef6ff;
}

.sales-products-table .form-control,
.sales-products-table .form-select {
    min-height: 34px;
    height: 34px;
    padding: 0.28rem 0.5rem;
    font-size: 0.82rem;
    border-radius: 8px;
}

.sales-products-table .select2-container--bootstrap4 .select2-selection--single {
    min-height: 34px;
    height: 34px;
    border-radius: 8px;
    padding-top: 0.12rem;
}

.sales-products-table .total {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 68px;
    max-width: 100%;
    padding: 0.26rem 0.45rem;
    border-radius: 8px;
    background: #eaf6ee;
    border: 1px solid #c9e8d1;
    color: #1e7b3e;
    font-weight: 800;
    font-size: 0.82rem;
    line-height: 1;
    box-sizing: border-box;
}

.sales-products-table .pos-remove-btn,
.sales-products-table .btn-danger {
    border-radius: 8px;
    font-size: 0.74rem;
    padding: 0.3rem 0.52rem;
    font-weight: 700;
}

.sales-products-table td:nth-child(1) {
    box-shadow: inset 2px 0 0 #d9e8f7;
}

.sales-products-table td:nth-child(4),
.sales-products-table th:nth-child(4) {
    text-align: center;
}

.sales-products-table td:nth-child(4) .total {
    width: 100%;
    min-width: 0;
}

.product-select-dropdown .select2-results__options {
    max-height: 320px;
    overflow-y: auto;
}

.product-select-dropdown .select2-results__option {
    font-size: 0.82rem;
    padding-top: 0.36rem;
    padding-bottom: 0.36rem;
}

.product-select-dropdown .select2-search__field {
    font-size: 0.82rem;
}

@media (max-width: 1200px) {
    .sales-hero {
        flex-direction: column;
    }

    .sales-hero-right {
        grid-template-columns: repeat(3, minmax(95px, 1fr));
    }

    .client-search-card {
        position: relative;
    }

    .sales-banner-main {
        grid-template-columns: 1fr;
        align-items: stretch;
    }

    .sales-banner-date {
        justify-self: start;
        max-width: 220px;
    }

    .sales-products-table {
        min-width: 860px;
    }

    .sales-products-table thead th {
        font-size: 0.69rem;
        padding: 0.48rem 0.38rem;
    }

    .sales-products-table tbody td {
        padding: 0.4rem 0.34rem;
    }

    .sales-products-table .form-control,
    .sales-products-table .form-select,
    .sales-products-table .select2-container--bootstrap4 .select2-selection--single {
        min-height: 32px;
        height: 32px;
        font-size: 0.77rem;
    }

    .sales-products-table .total {
        font-size: 0.75rem;
        padding: 0.22rem 0.3rem;
    }

    .sales-products-table .pos-remove-btn,
    .sales-products-table .btn-danger {
        font-size: 0.68rem;
        padding: 0.28rem 0.36rem;
    }

    #seccionCliente {
        max-height: 270px;
    }
}

@media (min-width: 992px) {
    #seccionCliente {
        height: clamp(240px, 36vh, 360px);
    }
}

@media (max-width: 768px) {
    body {
        overflow: auto;
    }

    .tienda-content {
        height: auto;
        min-height: 100vh;
        overflow: visible;
    }

    .sales-shell {
        padding-left: 0.35rem !important;
        padding-right: 0.35rem !important;
        height: auto;
        overflow: visible;
    }

    .sales-hero {
        border-radius: 12px;
        padding: 0.9rem;
    }

    .sales-hero h2 {
        font-size: 1.25rem;
    }

    .sales-page-title {
        font-size: 1.2rem;
    }

    .pos-table-header {
        align-items: flex-start;
        flex-direction: column;
    }

    .sales-products-table {
        min-width: 760px;
    }

    .sales-products-table thead th {
        font-size: 0.64rem;
        padding: 0.4rem 0.24rem;
        letter-spacing: 0.03em;
    }

    .sales-products-table tbody td {
        padding: 0.34rem 0.22rem;
    }

    .sales-products-table .form-control,
    .sales-products-table .form-select,
    .sales-products-table .select2-container--bootstrap4 .select2-selection--single {
        min-height: 30px;
        height: 30px;
        font-size: 0.72rem;
        padding-left: 0.34rem;
        padding-right: 0.34rem;
    }

    .sales-products-table .total {
        font-size: 0.68rem;
        padding: 0.18rem 0.2rem;
        border-radius: 6px;
    }

    .sales-products-table .pos-remove-btn,
    .sales-products-table .btn-danger {
        font-size: 0.62rem;
        padding: 0.24rem 0.28rem;
        border-radius: 6px;
    }

    .pos-table-header h6 {
        font-size: 0.84rem;
    }

    .pos-table-header small,
    .pos-mode-pill {
        font-size: 0.65rem;
    }

    .sales-hero-right {
        grid-template-columns: 1fr;
    }

    .sales-fixed-panel,
    .sales-billing-block {
        height: auto;
        max-height: none;
        overflow: visible;
    }

    #seccionCliente {
        flex: initial;
        max-height: 220px;
    }

    #tabla-container {
        max-height: 220px;
    }

    #form_venta {
        height: auto;
        min-height: 0;
    }

    .sales-billing-content {
        overflow: visible;
        padding-bottom: 1rem;
        padding-right: 0;
    }

    .sales-bottom-dock,
    .sales-bottom-dock-customer {
        position: static;
        padding-top: 0;
        background: transparent;
    }

    #compact_checkout_dock_host_mobile {
        display: block;
        margin-top: 0.75rem;
    }

    .sales-panel .card-body,
    .sales-panel.card {
        padding: 0.82rem;
    }

    .sales-submit-sticky {
        padding-bottom: 0.2rem;
    }
}

@keyframes riseIn {
    from {
        transform: translateY(6px);
        opacity: 0;
    }

    to {
        transform: translateY(0);
        opacity: 1;
    }
}
