/* General Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Poppins', sans-serif;
    background-color: #f0f2f5;
    color: #333;
    height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Barra superior */
.top-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 20px;
    background-color: #3498db;
    /* Color amigable */
    color: white;
    width: 100%;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
}

.main-title {
    font-size: 24px;
    font-weight: bold;
    text-align: center;
    flex-grow: 1;
    /* Para que ocupe el espacio intermedio */
    color: white;
}

.table-input-container {
    display: flex;
    align-items: center;
    justify-content: flex-end;
}

.table-input-container label {
    font-size: 16px;
    color: white;
    margin-right: 10px;
}

.table-input-container input {
    padding: 8px;
    font-size: 14px;
    border-radius: 5px;
    border: 1px solid #ccc;
    width: 180px;
}

/* Contenedor principal */
.container {
    display: flex;
    justify-content: space-between;
    margin-top: 80px;
    /* Espacio para la barra superior */
    height: calc(100vh - 160px);
    /* Ajustamos para evitar el espacio extra abajo */
    padding: 0 20px;
}

/* Estilo general para los títulos dentro de los contenedores */
.categories-title,
.products-title,
.order-details-title {
    font-size: 18px;
    color: #333;
    margin-bottom: 15px;
    font-weight: bold;
    text-align: center;
    padding-bottom: 10px;
    border-bottom: 1px solid #ddd;
}

/* Contenedor de Categorías */
.categories-container {
    width: 22%;
    /* Hacemos el contenedor más ancho */
    background-color: #f7f7f7;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
    overflow-y: auto;
    /* Barra de desplazamiento vertical */
    max-height: calc(100% - 80px);
    /* Altura máxima dentro de la pantalla */
}

.categories {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.categories button {
    width: 100%;
    background-color: #3498db;
    color: white;
    padding: 15px;
    margin-bottom: 10px;
    border: none;
    border-radius: 5px;
    font-size: 18px;
    transition: background-color 0.3s ease, transform 0.3s ease;
}

.categories button.active {
    background-color: #2ecc71;
}

.categories button:hover {
    background-color: #2980b9;
    transform: scale(1.05);
}

/* Contenedor de Productos en el centro */
.products-container {
    flex: 2;
    /* Hacemos el contenedor más ancho */
    background-color: #fff;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
    overflow-y: auto;
    max-height: calc(100% - 80px);
}

.product-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background-color: #f7f7f7;
    padding: 15px;
    margin: 15px 0;
    border-radius: 8px;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
    transition: transform 0.3s ease;
}

.product-item:hover {
    transform: scale(1.02);
}

/* Input para la cantidad */
.product-quantity {
    width: 60px;
    margin-left: 15px;
    padding: 8px;
    border-radius: 5px;
    border: 1px solid #ccc;
}

/* Botón de agregar */
.product-item button {
    padding: 10px 15px;
    background-color: #27ae60;
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    transition: background-color 0.3s ease;
}

.product-item button:hover {
    background-color: #229954;
}

/* Contenedor de Detalles de la Orden */
.order-details-container {
    width: 25%;
    /* Hacemos el contenedor más ancho */
    background-color: #f7f7f7;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
    overflow-y: auto;
    max-height: calc(100% - 80px);
    position: relative;
}

.selected-items {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.selected-product-item {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    background-color: #f7f7f7;
    padding: 15px;
    margin: 15px 0;
    border-radius: 8px;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
    transition: transform 0.3s ease;
}

.selected-product-item > div:first-child {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
}

.selected-product-item:hover {
    transform: scale(1.02);
}

/* Botón para eliminar productos seleccionados */
.selected-product-item button {
    padding: 5px 10px;
    background-color: #e74c3c;
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    transition: background-color 0.3s ease;
}

.selected-product-item button:hover {
    background-color: #c0392b;
}

.selected-product-item ul {
    margin: 10px 0 0 0;
    padding-left: 20px;
    list-style-type: disc;
}

/* Botón para guardar la orden */
.save-order-button {
    display: block;
    padding: 15px;
    background-color: #3498db;
    color: white;
    font-size: 18px;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    transition: background-color 0.3s ease, transform 0.3s ease;
    margin: 20px;
    width: calc(100% - 40px);
    /* De extremo a extremo pero con espacio */
    position: absolute;
    bottom: 0;
    /* Fija el botón en la parte inferior */
}

.save-order-button:hover {
    background-color: #2980b9;
    transform: scale(1.05);
}

/* Estilo para el botón de regresar al inicio */
.btn-home {
    background-color: #2980b9;
    color: white;
    padding: 10px 20px;
    text-decoration: none;
    border-radius: 5px;
    font-size: 14px;
    transition: background-color 0.3s ease, transform 0.3s ease;
}

.btn-home:hover {
    background-color: #21618c;
}

.product-item button.btn-disabled {
    background-color: #e74c3c !important;
    /* Fondo rojo */
    color: white !important;
    /* Texto blanco */
    border: none !important;
    /* Sin borde */
    cursor: not-allowed !important;
    /* Cursor de no permitido */
    opacity: 0.8 !important;
    /* Apariencia apagada */
    pointer-events: none !important;
    /* Evitar interacciones */
    font-weight: bold !important;
    /* Texto en negrita */
}

.product-item button.btn-disabled:hover {
    background-color: #e74c3c !important;
    /* Sin cambio al pasar el ratón */
    transform: none !important;
    /* Sin efecto hover */
}

/* 🔷 MODAL de Edición Mejorado */
#edit-order-modal {
    display: none;
    position: fixed;
    top: 5%;
    left: 50%;
    transform: translateX(-50%);
    width: 95%;
    max-width: 1200px;
    background: white;
    border-radius: 10px;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3);
    z-index: 1000;
    max-height: 90vh;
    overflow: hidden;
    flex-direction: column;
}

/* 🔹 Contenido interno del modal */
.edit-order-modal-content {
    position: relative;
    padding: 20px 30px;
    flex: 1;
    overflow: auto;
}

/* 🔹 Botón cerrar superior derecho */
.edit-order-close-modal {
    position: absolute;
    top: 15px;
    right: 15px;
    background: transparent;
    border: none;
    font-size: 26px;
    cursor: pointer;
    color: #555;
}

.edit-order-close-modal:hover {
    color: #222;
}

/* 🔹 Encabezado de la ventana modal */
.edit-order-content h2 {
    margin-bottom: 20px;
    font-size: 1.5rem;
}

/* 🔹 Separador visual entre secciones */
.separator {
    border: 0;
    border-bottom: 1px solid #ddd;
    margin: 20px 0;
}

/* 🔹 Grid de 3 columnas */
.edit-order-container {
    display: grid;
    grid-template-columns: 1fr 2fr 1fr;
    gap: 15px;
    height: 70vh;
    overflow: hidden;
}

/* 🔹 Secciones internas */
.edit-order-category-section,
.edit-order-products-section,
.edit-order-products-list-section {
    background: #f8f9fa;
    padding: 15px;
    border-radius: 8px;
    border: 1px solid #ddd;
    overflow-y: auto;
}

/* 🔹 Título de cada sección */
.edit-order-category-section h3,
.edit-order-products-section h3,
.edit-order-products-list-section h3 {
    text-align: center;
    margin-bottom: 10px;
}

/* 🔹 Botones de Categoría */
.category-btn {
    display: block;
    width: 100%;
    padding: 12px;
    margin: 8px 0;
    background-color: #007bff;
    color: white;
    font-weight: bold;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.3s ease;
}

.category-btn:hover {
    background-color: #0056b3;
}

/* 🔹 Productos disponibles */
.product-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: white;
    border-radius: 5px;
    padding: 12px;
    margin-bottom: 8px;
    box-shadow: 0px 2px 5px rgba(0, 0, 0, 0.1);
}

.product-item input {
    width: 50px;
    text-align: center;
    margin-right: 10px;
}

/* 🔹 Botón para agregar productos */
.add-product-btn {
    background: #28a745;
    color: white;
    border: none;
    padding: 6px 12px;
    border-radius: 5px;
    cursor: pointer;
}

.add-product-btn:hover {
    background: #218838;
}

/* 🔹 Botón para productos sin stock */
.out-of-stock-btn {
    background: #dc3545;
    color: white;
    border: none;
    padding: 6px 12px;
    border-radius: 5px;
    cursor: not-allowed;
}

/* 🔹 Botón eliminar producto */
.remove-product-btn {
    background: #dc3545;
    color: white;
    border: none;
    padding: 6px 12px;
    border-radius: 5px;
    cursor: pointer;
}

.remove-product-btn:hover {
    background: #c82333;
}

/* 🔹 Guardar Cambios */
#save-order,
#edit-order-save-order {
    width: 100%;
    background: #007bff;
    color: white;
    padding: 14px;
    font-size: 16px;
    border: none;
    border-radius: 0 0 10px 10px;
    cursor: pointer;
    transition: background 0.3s ease;
}

#save-order:hover,
#edit-order-save-order:hover {
    background: #0056b3;
}

.btn-disabled {
    background-color: #e74c3c;
    color: white;
    border: none;
    cursor: not-allowed;
    padding: 6px 12px;
    border-radius: 5px;
}
