/* ==========================================================================
   Base
   ========================================================================== */
:root {
    --bg: #f6f8fb;
    --text: #343a40;
    --muted: #6c757d;

    --primary: #007bff;
    --primary-600: #0069d9;

    --success: #28a745;
    --success-50: #eefaf3;

    --danger: #dc3545;
    --danger-600: #c82333;

    --card: #ffffff;
    --card-border: #e5e7eb;
    --shadow: 0 6px 18px rgba(0, 0, 0, .08);
    --radius: 10px;
}

* {
    box-sizing: border-box;
}

html,
body {
    height: 100%;
}

body {
    font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
    background: var(--bg);
    color: var(--text);
    margin: 0;
}

/* ==========================================================================
   Cabecera / título
   ========================================================================== */
h1.title {
    text-align: center;
    color: var(--primary);
    font-weight: 700;
    margin: 24px 0 8px 0;
}

/* ==========================================================================
   Contenedor de órdenes
   ========================================================================== */
#orders {
    margin: 20px;
}

.order-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    background: var(--card);
    border: 1px solid var(--card-border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 14px 16px;
    margin-bottom: 12px;
}

/* ==========================================================================
   Botones
   ========================================================================== */
button {
    appearance: none;
    border: none;
    outline: none;
    cursor: pointer;
    background: var(--primary);
    color: #fff;
    border-radius: 8px;
    padding: 8px 14px;
    font-size: 14px;
    line-height: 1;
    transition: transform .15s ease, background-color .15s ease, box-shadow .15s ease;
}

button:hover {
    background: var(--primary-600);
    transform: translateY(-1px);
}

button:active {
    transform: translateY(0);
}

.btn-primary {
    background: var(--primary);
}

.btn-primary:hover {
    background: var(--primary-600);
}

.btn-secondary {
    background: #6c757d;
}

.btn-secondary:hover {
    background: #5a6268;
}

.btn-danger {
    background: var(--danger);
}

.btn-danger:hover {
    background: var(--danger-600);
}

.btn-light {
    background: #e9ecef;
    color: #2b2b2b
}

.btn-light:hover {
    background: #dde2e6
}

button.small {
    padding: 6px 10px;
    font-size: 12px;
    border-radius: 6px;
}

button.view-button {
    background: #17a2b8
}

button.view-button:hover {
    background: #117a8b
}

/* ==========================================================================
   Modales base
   ========================================================================== */
.modal {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, .45);
    z-index: 1000;
    overflow: hidden;
}

/* Contenedor general “blanco” (ver/pagar/confirmación) */
.modal .modal-content {
    background: var(--card);
    border: 1px solid var(--card-border);
    border-radius: 14px;
    box-shadow: var(--shadow);
    width: 92%;
    max-width: 760px;
    margin: 1% auto;
    max-height: 82vh;
    overflow-y: auto;
    padding: 18px 20px;
    position: relative;
}

.modal .close-modal {
    position: absolute;
    top: 10px;
    right: 12px;
    background: #f1f3f5;
    color: #222;
    border-radius: 8px;
    padding: 6px 10px;
    font-size: 13px;
}

.modal .close-modal:hover {
    background: #e9ecef
}

.modal .modal-content h2 {
    margin: 6px 0 16px 0;
    font-weight: 700;
    color: #222
}

#payment-modal .modal-content {
    max-width: 820px;
}

#confirmation-modal .modal-content {
    max-width: 680px;
}

/* ==========================================================================
   “Ver Orden”
   ========================================================================== */
.order-details {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.order-chip {
    background: #fff;
    border: 1px solid var(--card-border);
    border-radius: 10px;
    padding: 12px 14px;
}

.order-total {
    margin-top: 8px;
    font-weight: 700;
}

/* ==========================================================================
   Pago parcial – tarjetas
   ========================================================================== */
.product-selection {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    background: #fff;
    border: 2px solid #e9ecef;
    border-radius: 10px;
    padding: 10px 12px;
    margin-bottom: 10px;
    transition: border-color .15s ease, background-color .15s ease, box-shadow .15s ease;
}

.product-selection input[type="checkbox"] {
    margin-right: 10px;
    transform: translateY(1px);
}

.product-selection label {
    flex: 1;
    cursor: pointer;
}

.product-selection input[type="number"] {
    width: 64px;
    text-align: center;
    border: 1px solid #dcdfe4;
    border-radius: 6px;
    padding: 6px 4px;
}

.product-selection.selected {
    border-color: #2ecc71;
    background: var(--success-50);
    box-shadow: 0 0 0 4px rgba(46, 204, 113, .15);
}

#selected-total {
    font-weight: 700;
}

.total {
    font-weight: bold;
    margin-top: 20px;
}

@media (max-width: 620px) {
    .order-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }

    .modal .modal-content {
        margin: 6% auto;
        width: 94%;
        max-height: 86vh;
        padding: 16px;
    }

    .product-selection {
        flex-wrap: wrap;
        gap: 10px;
    }
}

/* Mantener scroll solo dentro del cuadro */
.modal .modal-content {
    max-height: 90vh;
    overflow: auto;
    scrollbar-gutter: stable both-edges;
}

/* ==========================================================================
   EDITAR ORDEN + BUILDER DE COMBO (mismo estilo/ancho)
   ========================================================================== */
/* card contenedor de ambos modales “nuevos” */
.eo-modal-card,
.eo-combo-card {
    width: 96%;
    max-width: 1400px;
    /* más horizontal */
    margin: 3vh auto;
    background: #fff;
    border-radius: 14px;
    box-shadow: var(--shadow);
    padding: 16px 18px;
    position: relative;
}

/* header con título y X */
.eo-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 8px;
}

.eo-modal-title {
    font-size: 22px;
    font-weight: 800;
    color: #1e2a3a;
}

.eo-close {
    background: #f1f3f5;
    color: #222;
    border: none;
    border-radius: 8px;
    padding: 6px 10px;
}

.eo-close:hover {
    background: #e9ecef
}

/* grillas de 3 columnas (categorías / productos / derecha) */
.eo-grid,
.eo-combo-grid {
    display: grid;
    grid-template-columns: 260px 1.4fr 420px;
    /* centro más ancho */
    gap: 16px;
    min-height: 60vh;
}

.eo-panel {
    border: 1px solid var(--card-border);
    border-radius: 12px;
    padding: 12px;
    background: #fff;
    overflow: auto;
}

.eo-panel h3 {
    margin: 6px 0 10px;
    font-size: 16px;
    color: #263248;
}

/* botón guardar al pie */
#eo-save-btn {
    display: block;
    width: 100%;
    margin-top: 12px;
    background: #0d6efd;
    color: #fff;
    border: none;
    padding: 12px;
    border-radius: 10px;
    font-size: 16px;
    cursor: pointer;
}

#eo-save-btn:hover {
    background: #0b5ed7
}

.eo-footer {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 12px;
}

.eo-footer input {
    width: 90px;
}

/* Tarjetas de producto */
.product-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    border: 1px solid #eee;
    padding: 10px;
    border-radius: 10px;
    margin-bottom: 8px;
}

.eo-product-left {
    flex: 1 1 auto;
    min-width: 0;
    /* evita saltos raros */
    white-space: nowrap;
    /* todo en una sola línea */
}

.eo-product-right {
    flex: 0 0 auto;
    display: flex;
    gap: 8px;
    align-items: center;
}

.eo-badge {
    display: inline-block;
    margin: 0 6px;
    padding: 2px 8px;
    border-radius: 999px;
    background: #e8fff1;
    color: #1e7e34;
    font-weight: 700;
    font-size: 12px;
}

/* botones estado stock */
.add-product-btn {
    background: #28a745;
    color: #fff;
}

.add-product-btn:disabled {
    opacity: .6;
    cursor: not-allowed;
}

.out-of-stock-btn {
    background: #dc3545;
    color: #fff;
    cursor: not-allowed;
}

/* Scroll amable en la lista derecha */
#eo-order-list {
    max-height: calc(80vh - 220px);
    overflow-y: auto;
    padding-right: 8px;
}

#eo-order-list::-webkit-scrollbar {
    width: 10px
}

#eo-order-list::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 8px
}

#eo-order-list::-webkit-scrollbar-track {
    background: transparent
}

/* Botones de categorías (en ambos modales) */
.category-btn {
    width: 100%;
    background: #0d6efd;
    color: #fff;
    border: none;
    padding: 10px 12px;
    border-radius: 8px;
    cursor: pointer;
    margin: 6px 0;
}

.category-btn:hover {
    background: #0b5ed7
}
