/**
 * Estilos para Modal Configurador de Menús (Dúo y Familiar)
 *
 * @package GestionPedidosV2
 */

/* ============================================================================
   OVERLAY Y MODAL BASE
   ============================================================================ */

.menu-configurador-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
    z-index: 99999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    overflow-y: auto;
}

.menu-configurador-modal {
    background: white;
    border-radius: 16px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    max-width: 900px;
    width: 100%;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    animation: modalSlideIn 0.3s ease-out;
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: scale(0.9) translateY(-20px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

/* ============================================================================
   HEADER DEL MODAL
   ============================================================================ */

.menu-configurador-header {
    padding: 20px 30px;
    border-bottom: 2px solid #f0f0f0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: linear-gradient(135deg, #366121 0%, #4a7c2d 100%);
    color: white;
    border-radius: 16px 16px 0 0;
}

.menu-configurador-header h2 {
    margin: 0;
    font-size: 24px;
    font-weight: 700;
    color: white !important;
}

.menu-configurador-cerrar {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    color: white;
    font-size: 28px;
    line-height: 1;
}

.menu-configurador-cerrar:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: rotate(90deg);
}

/* ============================================================================
   BODY DEL MODAL
   ============================================================================ */

.menu-configurador-body {
    padding: 30px;
    overflow-y: auto;
    flex: 1;
    max-height: calc(90vh - 180px);
}

.menu-configurador-body::-webkit-scrollbar {
    width: 8px;
}

.menu-configurador-body::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 10px;
}

.menu-configurador-body::-webkit-scrollbar-thumb {
    background: #366121;
    border-radius: 10px;
}

.menu-configurador-body::-webkit-scrollbar-thumb:hover {
    background: #2e5219;
}

/* ============================================================================
   LOADING Y ESTADOS
   ============================================================================ */

.menu-configurador-loading,
.menu-configurador-error,
.menu-configurador-exito {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 20px;
    text-align: center;
}

.spinner {
    border: 4px solid #f3f3f3;
    border-top: 4px solid #366121;
    border-radius: 50%;
    width: 50px;
    height: 50px;
    animation: spin 1s linear infinite;
    margin-bottom: 20px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.spinner-small {
    display: inline-block;
    border: 2px solid #f3f3f3;
    border-top: 2px solid white;
    border-radius: 50%;
    width: 16px;
    height: 16px;
    animation: spin 0.8s linear infinite;
    vertical-align: middle;
    margin-right: 8px;
}

.menu-configurador-error .error-icono,
.menu-configurador-exito .exito-icono {
    font-size: 60px;
    margin-bottom: 15px;
}

.menu-configurador-error p {
    color: #dc3232;
    font-size: 16px;
}

.menu-configurador-exito .exito-icono {
    color: #46b450;
    animation: scaleIn 0.3s ease-out;
}

@keyframes scaleIn {
    from {
        transform: scale(0);
    }
    to {
        transform: scale(1);
    }
}

/* ============================================================================
   CATEGORÍAS Y PRODUCTOS
   ============================================================================ */

.menu-configurador-categorias {
    display: flex;
    flex-direction: column;
    gap: 30px;
}

.menu-categoria-section {
    background: #fafafa;
    border-radius: 12px;
    padding: 20px;
    border: 2px solid #e0e0e0;
    transition: all 0.3s ease;
}

.menu-categoria-section.menu-incluido {
    background: #e7f3ff;
    border-color: #0073aa;
}

.menu-categoria-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 2px solid #e0e0e0;
}

.menu-categoria-icono {
    font-size: 32px;
}

.menu-categoria-header h3 {
    margin: 0;
    font-size: 20px;
    font-weight: 700;
    flex: 1;
    color: #333;
}

.menu-categoria-contador {
    background: #366121;
    color: white;
    padding: 6px 16px;
    border-radius: 20px;
    font-size: 14px;
    font-weight: 600;
}

.menu-categoria-contador.completo {
    background: #46b450;
}

.menu-categoria-contador .contador-actual {
    opacity: 0.9;
}

.menu-categoria-contador .completo {
    font-weight: 700;
}

/* ============================================================================
   GRID DE PRODUCTOS
   ============================================================================ */

.menu-categoria-productos {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 15px;
}

@media (max-width: 768px) {
    .menu-categoria-productos {
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    }
}

@media (max-width: 480px) {
    .menu-categoria-productos {
        grid-template-columns: 1fr;
    }
}

.menu-producto-item {
    position: relative;
}

.menu-producto-card {
    background: white;
    border: 3px solid #e0e0e0;
    border-radius: 12px;
    padding: 15px;
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    position: relative;
    overflow: hidden;
}

.menu-producto-card:hover {
    border-color: #366121;
    box-shadow: 0 4px 12px rgba(54, 97, 33, 0.2);
    transform: translateY(-2px);
}

.menu-producto-imagen {
    width: 100%;
    height: 120px;
    margin-bottom: 12px;
    border-radius: 8px;
    overflow: hidden;
    background: #f5f5f5;
    display: flex;
    align-items: center;
    justify-content: center;
}

.menu-producto-imagen img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.producto-sin-imagen {
    font-size: 48px;
    opacity: 0.3;
}

.menu-producto-info {
    flex: 1;
}

.menu-producto-nombre {
    font-size: 14px;
    font-weight: 600;
    color: #333;
    display: block;
    line-height: 1.3;
}

/* ============================================================================
   SELECTOR DE CANTIDAD (+/-)
   ============================================================================ */

.menu-producto-cantidad {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    margin-top: 10px;
}

.btn-cantidad {
    width: 32px;
    height: 32px;
    border: 2px solid #366121;
    background: white;
    color: #366121;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    font-size: 14px;
}

.btn-cantidad:hover {
    background: #366121;
    color: white;
    transform: scale(1.1);
}

.btn-cantidad:active {
    transform: scale(0.95);
}

.btn-cantidad i {
    font-size: 12px;
}

.cantidad-display {
    min-width: 30px;
    text-align: center;
    font-size: 18px;
    font-weight: 700;
    color: #366121;
}

/* Producto seleccionado (cuando cantidad > 0) */
.menu-producto-item.seleccionado .menu-producto-card {
    border-color: #366121;
    background: #f0f8f0;
    box-shadow: 0 4px 16px rgba(54, 97, 33, 0.3);
}

.menu-producto-item.seleccionado .cantidad-display {
    color: #366121;
    font-weight: 800;
}

/* ============================================================================
   BOTÓN QUITAR INGREDIENTES
   ============================================================================ */

.btn-quitar-ingredientes {
    margin-top: 8px;
    padding: 6px 12px;
    background: #f5f5f5;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 12px;
    color: #666;
    cursor: pointer;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    gap: 5px;
}

.btn-quitar-ingredientes:hover {
    background: #366121;
    color: white;
    border-color: #366121;
}

.btn-quitar-ingredientes.tiene-cambios {
    background: #fef3e8;
    border-color: #ff9800;
    color: #ff9800;
}

.badge-ingredientes {
    background: #ff9800;
    color: white;
    border-radius: 50%;
    width: 18px;
    height: 18px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: bold;
    margin-left: 4px;
}

/* ============================================================================
   MODAL DE INGREDIENTES
   ============================================================================ */

.modal-ingredientes-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    z-index: 100000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-ingredientes-content {
    background: white;
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    max-width: 500px;
    width: 90%;
    max-height: 80vh;
    display: flex;
    flex-direction: column;
}

.modal-ingredientes-header {
    padding: 20px;
    border-bottom: 1px solid #eee;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-ingredientes-header h3 {
    margin: 0;
    font-size: 18px;
    color: #333;
}

.modal-ingredientes-cerrar {
    background: none;
    border: none;
    font-size: 28px;
    color: #999;
    cursor: pointer;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.2s ease;
}

.modal-ingredientes-cerrar:hover {
    color: #333;
}

.modal-ingredientes-body {
    padding: 20px;
    overflow-y: auto;
}

.ingredientes-lista {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 15px;
}

.ingrediente-checkbox {
    display: flex;
    align-items: center;
    padding: 12px;
    background: #f9f9f9;
    border: 2px solid #eee;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.ingrediente-checkbox:hover {
    background: #f5f5f5;
    border-color: #366121;
}

.ingrediente-checkbox input[type="checkbox"] {
    margin-right: 10px;
    width: 18px;
    height: 18px;
    cursor: pointer;
}

.ingrediente-checkbox input[type="checkbox"]:checked + span {
    color: #dc3545;
    font-weight: 600;
}

.modal-ingredientes-footer {
    padding: 15px 20px;
    border-top: 1px solid #eee;
    display: flex;
    gap: 10px;
    justify-content: flex-end;
}

.btn-ingredientes-cancelar,
.btn-ingredientes-guardar {
    padding: 10px 20px;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-ingredientes-cancelar {
    background: #f5f5f5;
    color: #666;
}

.btn-ingredientes-cancelar:hover {
    background: #e0e0e0;
}

.btn-ingredientes-guardar {
    background: #366121;
    color: white;
}

.btn-ingredientes-guardar:hover {
    background: #2e5219;
}

/* ============================================================================
   PRODUCTO INCLUIDO (HELADO Y PATATAS)
   ============================================================================ */

.menu-producto-incluido {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.item-incluido {
    display: flex;
    align-items: center;
    padding: 10px;
    background: #f0f8f0;
    border-radius: 5px;
}

.item-incluido-icono {
    font-size: 24px;
    margin-right: 10px;
    flex-shrink: 0;
}

.item-incluido-texto {
    font-size: 16px;
    font-weight: 500;
    color: #366121;
    word-wrap: break-word;
}

/* Responsive para móviles */
@media (max-width: 480px) {
    .item-incluido {
        flex-direction: column;
        text-align: center;
        padding: 15px 10px;
    }

    .item-incluido-icono {
        font-size: 32px;
        margin-right: 0;
        margin-bottom: 5px;
    }

    .item-incluido-texto {
        font-size: 14px;
    }
}

.menu-producto-incluido-legacy {
    display: flex;
    align-items: center;
    gap: 15px;
    background: white;
    padding: 15px;
    border-radius: 8px;
    border: 2px solid #0073aa;
}

.menu-producto-incluido img {
    width: 60px;
    height: 60px;
    object-fit: cover;
    border-radius: 8px;
}

.menu-producto-incluido span {
    font-size: 16px;
    font-weight: 600;
    color: #333;
}

.no-productos {
    text-align: center;
    padding: 30px;
    color: #999;
    font-style: italic;
}

/* ============================================================================
   FOOTER DEL MODAL
   ============================================================================ */

.menu-configurador-footer {
    padding: 20px 30px;
    border-top: 2px solid #f0f0f0;
    display: flex;
    justify-content: flex-end;
    gap: 15px;
    background: #fafafa;
    border-radius: 0 0 16px 16px;
}

.menu-configurador-btn-cancelar,
.menu-configurador-btn-añadir {
    padding: 12px 32px;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    border: none;
    outline: none;
}

.menu-configurador-btn-cancelar {
    background: #f0f0f0;
    color: #666;
}

.menu-configurador-btn-cancelar:hover {
    background: #e0e0e0;
}

.menu-configurador-btn-añadir {
    background: #366121;
    color: white;
}

.menu-configurador-btn-añadir:hover:not(:disabled) {
    background: #2e5219;
    box-shadow: 0 4px 12px rgba(54, 97, 33, 0.3);
    transform: translateY(-1px);
}

.menu-configurador-btn-añadir:disabled {
    background: #ccc;
    cursor: not-allowed;
    opacity: 0.6;
}

/* ============================================================================
   ALERTA TEMPORAL
   ============================================================================ */

.menu-alerta-temporal {
    position: fixed;
    top: 20px;
    right: 20px;
    background: #dc3232;
    color: white;
    padding: 15px 25px;
    border-radius: 8px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2);
    z-index: 999999;
    font-weight: 600;
    opacity: 0;
    transform: translateX(100px);
    transition: all 0.3s ease;
}

.menu-alerta-temporal.show {
    opacity: 1;
    transform: translateX(0);
}

/* ============================================================================
   RESPONSIVE
   ============================================================================ */

@media (max-width: 768px) {
    .menu-configurador-modal {
        max-width: 100%;
        max-height: 100vh;
        border-radius: 0;
        margin: 0;
    }

    .menu-configurador-header {
        border-radius: 0;
        padding: 15px 20px;
    }

    .menu-configurador-header h2 {
        font-size: 20px;
    }

    .menu-configurador-body {
        padding: 20px;
    }

    .menu-configurador-footer {
        padding: 15px 20px;
        flex-direction: column-reverse;
        border-radius: 0;
    }

    .menu-configurador-btn-cancelar,
    .menu-configurador-btn-añadir {
        width: 100%;
        padding: 14px;
    }

    .menu-alerta-temporal {
        right: 10px;
        left: 10px;
        top: 10px;
    }
}

@media (max-width: 480px) {
    .menu-categoria-header h3 {
        font-size: 18px;
    }

    .menu-categoria-contador {
        font-size: 12px;
        padding: 4px 12px;
    }

    .menu-producto-imagen {
        height: 100px;
    }

    .menu-producto-nombre {
        font-size: 13px;
    }
}
