/* Variables CSS para facilitar mantenimiento */
:root {
    --primary-color: #5B9CB8;
    --primary-hover: #4A8BA5;
    --primary-light: #7BB8D0;
    --secondary-color: #6c757d;
    --secondary-hover: #5a6268;
    --accent-color: #E8B830;
    --accent-hover: #D4A520;
    --text-color: #2C3E50;
    --text-light: #5A7A8F;
    --text-lighter: #6B8FA3;
    --background-gradient: linear-gradient(180deg, #5B9CB8 0%, #A8D4E5 100%);
    --white: #ffffff;
    --border-color: #d6e4ec;
    --shadow-light: 0 5px 15px rgba(91, 156, 184, 0.25);
    --shadow-main: 0 15px 35px rgba(0, 0, 0, 0.08);
    --border-radius: 10px;
    --border-radius-large: 20px;
    --font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

/* Reset y estilos base */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: var(--font-family);
    line-height: 1.6;
    color: var(--text-color);
    background: var(--background-gradient);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Estilos de texto */
h1, h2, h3, h4, h5, h6 {
    margin-bottom: 1rem;
    font-weight: bold;
}

p {
    margin-bottom: 1rem;
}

a {
    text-decoration: none;
    color: var(--primary-color);
    transition: color 0.3s ease;
}

/* ====================================
   BOTONES DE ACCIÓN MEJORADOS - INVENTARIO
   ==================================== */

.btn-action {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.75rem 1.25rem;
    border: none;
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
    outline: none;
    min-width: 120px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.btn-action::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.4), transparent);
    transition: left 0.5s;
}

.btn-action:hover::before {
    left: 100%;
}

.btn-icon {
    font-size: 1.1rem;
    transition: transform 0.3s ease;
}

.btn-text {
    font-weight: 600;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

/* Botón Editar */
.btn-editar {
    background: linear-gradient(135deg, #28a745 0%, #20c997 100%);
    color: white;
    border: 2px solid transparent;
}

.btn-editar:hover {
    background: linear-gradient(135deg, #218838 0%, #1e7e34 100%);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(40, 167, 69, 0.4);
}

.btn-editar:hover .btn-icon {
    transform: rotate(15deg) scale(1.1);
}

.btn-editar:active {
    transform: translateY(0);
    box-shadow: 0 2px 8px rgba(40, 167, 69, 0.3);
}

/* Botón Eliminar */
.btn-eliminar {
    background: linear-gradient(135deg, #dc3545 0%, #c82333 100%);
    color: white;
    border: 2px solid transparent;
}

.btn-eliminar:hover {
    background: linear-gradient(135deg, #c82333 0%, #bd2130 100%);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(220, 53, 69, 0.4);
    animation: shake 0.6s ease-in-out;
}

.btn-eliminar:hover .btn-icon {
    transform: scale(1.2);
    animation: bounce 0.6s ease-in-out;
}

.btn-eliminar:active {
    transform: translateY(0);
    box-shadow: 0 2px 8px rgba(220, 53, 69, 0.3);
}

/* Animaciones */
@keyframes shake {
    0%, 100% { transform: translateY(-2px) translateX(0); }
    25% { transform: translateY(-2px) translateX(-2px); }
    75% { transform: translateY(-2px) translateX(2px); }
}

@keyframes bounce {
    0%, 100% { transform: scale(1.2); }
    50% { transform: scale(1.3); }
}

/* Responsive para botones */
@media (max-width: 768px) {
    .btn-action {
        padding: 0.6rem 1rem;
        font-size: 0.8rem;
        min-width: 100px;
        gap: 0.3rem;
    }
    
    .btn-icon {
        font-size: 1rem;
    }
    
    .btn-text {
        display: none;
    }
    
    .btn-action {
        min-width: auto;
        width: 40px;
        height: 40px;
        border-radius: 50%;
        padding: 0;
    }
}

/* Contenedor de acciones del inventario */
.inventario-actions {
    display: flex;
    gap: 0.75rem;
    justify-content: center;
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid rgba(0, 0, 0, 0.1);
}

@media (max-width: 768px) {
    .inventario-actions {
        gap: 0.5rem;
        justify-content: space-around;
    }
}

/* ====================================
   MODAL PARA NUEVO PRODUCTO
   ==================================== */

.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(5px);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    animation: fadeIn 0.3s ease-out;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.modal-container {
    background: white;
    border-radius: 20px;
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.25);
    max-width: 800px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    animation: slideIn 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes slideIn {
    from {
        transform: translateY(30px) scale(0.95);
        opacity: 0;
    }
    to {
        transform: translateY(0) scale(1);
        opacity: 1;
    }
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 2rem 2rem 1rem 2rem;
    border-bottom: 2px solid #f8f9fa;
    background: linear-gradient(135deg, #5B9CB8 0%, #7BB8D0 100%);
    color: white;
    border-radius: 20px 20px 0 0;
}

.modal-header h2 {
    margin: 0;
    font-size: 1.5rem;
    font-weight: 700;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

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

.modal-close:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: rotate(90deg) scale(1.1);
}

.modal-form {
    padding: 2rem;
}

.form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.form-group {
    display: flex;
    flex-direction: column;
}

.form-group.full-width {
    grid-column: 1 / -1;
}

.form-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 600;
    color: #333;
    margin-bottom: 0.5rem;
    font-size: 0.9rem;
}

.label-icon {
    font-size: 1rem;
}

.form-input,
.form-textarea {
    padding: 0.75rem 1rem;
    border: 2px solid #e9ecef;
    border-radius: 10px;
    font-size: 1rem;
    transition: all 0.3s ease;
    background: #f8f9fa;
}

.form-input:focus,
.form-textarea:focus {
    outline: none;
    border-color: #5B9CB8;
    background: white;
    box-shadow: 0 0 0 3px rgba(111, 66, 193, 0.1);
    transform: translateY(-1px);
}

.form-textarea {
    resize: vertical;
    min-height: 80px;
    font-family: inherit;
}

.checkbox-group {
    align-items: center;
    justify-content: center;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    cursor: pointer;
    font-weight: 500;
    padding: 0.75rem;
    border-radius: 10px;
    transition: background 0.3s ease;
}

.checkbox-label:hover {
    background: #f8f9fa;
}

.form-checkbox {
    display: none;
}

.checkbox-custom {
    width: 20px;
    height: 20px;
    border: 2px solid #5B9CB8;
    border-radius: 4px;
    position: relative;
    transition: all 0.3s ease;
}

.form-checkbox:checked + .checkbox-custom {
    background: #5B9CB8;
    border-color: #5B9CB8;
}

.form-checkbox:checked + .checkbox-custom::after {
    content: '✓';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: white;
    font-weight: bold;
    font-size: 12px;
}

.checkbox-text {
    user-select: none;
}

.input-feedback {
    min-height: 1.2rem;
    font-size: 0.8rem;
    margin-top: 0.25rem;
}

.input-feedback.error {
    color: #dc3545;
}

.input-feedback.success {
    color: #28a745;
}

.modal-actions {
    display: flex;
    gap: 1rem;
    justify-content: flex-end;
    padding-top: 1rem;
    border-top: 1px solid #e9ecef;
}

.btn-cancelar {
    background: linear-gradient(135deg, #6c757d 0%, #5a6268 100%);
    color: white;
}

.btn-cancelar:hover {
    background: linear-gradient(135deg, #5a6268 0%, #495057 100%);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(108, 117, 125, 0.4);
}

.btn-guardar {
    background: linear-gradient(135deg, #5B9CB8 0%, #7BB8D0 100%);
    color: white;
}

.btn-guardar:hover {
    background: linear-gradient(135deg, #7BB8D0 0%, #4A8BA5 100%);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(111, 66, 193, 0.4);
}

.btn-guardar:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

/* Responsive para modal */
@media (max-width: 768px) {
    .modal-container {
        width: 95%;
        margin: 1rem;
        max-height: 95vh;
    }
    
    .modal-header {
        padding: 1.5rem 1.5rem 1rem 1.5rem;
    }
    
    .modal-header h2 {
        font-size: 1.3rem;
    }
    
    .modal-form {
        padding: 1.5rem;
    }
    
    .form-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    
    .modal-actions {
        flex-direction: column-reverse;
        gap: 0.75rem;
    }
    
    .btn-action {
        width: 100%;
        justify-content: center;
    }
}

/* Indicador de disponibilidad en tienda */
.disponible-tienda {
    background: linear-gradient(135deg, #28a745 0%, #20c997 100%);
    color: white !important;
    padding: 0.25rem 0.75rem;
    border-radius: 15px;
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    box-shadow: 0 2px 4px rgba(40, 167, 69, 0.3);
}

/* ====================================
   MODAL DE PRODUCTOS
   ==================================== */

.modal-productos {
    max-width: 1200px;
    width: 95%;
    max-height: 90vh;
}

.modal-body {
    padding: 2rem;
    max-height: 70vh;
    overflow-y: auto;
}

.productos-filtros {
    margin-bottom: 2rem;
}

.productos-controles {
    display: flex;
    gap: 1rem;
    align-items: center;
    margin-bottom: 2rem;
    flex-wrap: wrap;
}

.productos-filtros {
    flex: 1;
    min-width: 300px;
}

.productos-filtros .form-input {
    width: 100%;
}

.btn-agregar-producto {
    background: linear-gradient(135deg, #28a745, #20c997);
    color: white;
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    font-size: 1rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(40, 167, 69, 0.3);
    white-space: nowrap;
}

.btn-agregar-producto:hover {
    background: linear-gradient(135deg, #218838, #1e7e34);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(40, 167, 69, 0.4);
}

.productos-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 1.5rem;
    margin-top: 1rem;
}

.producto-card {
    background: white;
    border: 2px solid #e9ecef;
    border-radius: 15px;
    padding: 1.5rem;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.producto-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
    border-color: #5B9CB8;
}

.producto-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid #e9ecef;
}

.producto-id {
    font-size: 0.9rem;
    font-weight: 600;
    color: #5B9CB8;
    background: rgba(111, 66, 193, 0.1);
    padding: 0.25rem 0.75rem;
    border-radius: 15px;
}

.producto-oferta {
    background: linear-gradient(135deg, #ff6b6b, #ff5252);
    color: white;
    padding: 0.25rem 0.75rem;
    border-radius: 15px;
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.05); }
}

.producto-nombre {
    font-size: 1.3rem;
    font-weight: 700;
    color: #333;
    margin: 0 0 0.5rem 0;
    line-height: 1.2;
}

.producto-descripcion {
    color: #666;
    font-size: 0.9rem;
    line-height: 1.4;
    margin: 0 0 1rem 0;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.producto-precios {
    background: #f8f9fa;
    border-radius: 10px;
    padding: 1rem;
    margin-bottom: 1rem;
}

.precio-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
}

.precio-item:last-child {
    margin-bottom: 0;
}

.precio-item.oferta {
    background: rgba(255, 107, 107, 0.1);
    padding: 0.5rem;
    border-radius: 8px;
    border-left: 3px solid #ff6b6b;
}

.precio-label {
    font-size: 0.9rem;
    font-weight: 500;
    color: #666;
}

.precio-valor {
    font-size: 1.1rem;
    font-weight: 700;
    color: #28a745;
}

.precio-item.oferta .precio-valor {
    color: #ff6b6b;
}

.producto-detalles {
    border-top: 1px solid #e9ecef;
    padding-top: 1rem;
    margin-top: 1rem;
}

.detalle-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
    font-size: 0.9rem;
}

.detalle-item:last-child {
    margin-bottom: 0;
}

.detalle-label {
    color: #666;
    font-weight: 500;
}

.detalle-valor {
    font-weight: 600;
    color: #333;
}

.producto-foto {
    margin-top: 1rem;
    text-align: center;
}

.producto-foto img {
    max-width: 100%;
    max-height: 150px;
    border-radius: 10px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    object-fit: cover;
}

/* Estilos para acciones de productos */
.producto-actions {
    margin-top: 1.5rem;
    padding-top: 1rem;
    border-top: 1px solid #eee;
    display: flex;
    gap: 0.75rem;
    justify-content: flex-end;
}

.btn-editar-producto,
.btn-eliminar-producto,
.btn-desactivar-producto {
    padding: 0.5rem 1rem;
    border: none;
    border-radius: 8px;
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    position: relative;
    overflow: hidden;
}

.btn-editar-producto {
    background: linear-gradient(135deg, #28a745, #20c997);
    color: white;
    box-shadow: 0 4px 12px rgba(40, 167, 69, 0.3);
}

.btn-editar-producto:hover {
    background: linear-gradient(135deg, #218838, #1fa085);
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(40, 167, 69, 0.4);
}

.btn-eliminar-producto {
    background: linear-gradient(135deg, #dc3545, #e74c3c);
    color: white;
    box-shadow: 0 4px 12px rgba(220, 53, 69, 0.3);
}

.btn-eliminar-producto:hover {
    background: linear-gradient(135deg, #c82333, #c0392b);
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(220, 53, 69, 0.4);
}

.btn-desactivar-producto {
    background: linear-gradient(135deg, #fd7e14, #f39c12);
    color: white;
    box-shadow: 0 4px 12px rgba(253, 126, 20, 0.3);
}

.btn-desactivar-producto:hover {
    background: linear-gradient(135deg, #e8640b, #e67e22);
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(253, 126, 20, 0.4);
}

.btn-editar-producto:active,
.btn-eliminar-producto:active,
.btn-desactivar-producto:active {
    transform: translateY(0);
}

.btn-editar-producto .btn-icon,
.btn-eliminar-producto .btn-icon,
.btn-desactivar-producto .btn-icon {
    font-size: 1rem;
}

.btn-editar-producto .btn-text,
.btn-eliminar-producto .btn-text,
.btn-desactivar-producto .btn-text {
    font-size: 0.875rem;
}

/* Estilos para botón actualizar en el modal de edición */
.btn-actualizar {
    background: linear-gradient(135deg, #5B9CB8, #7BB8D0);
    color: white;
    border: none;
    padding: 0.75rem 1.5rem;
    border-radius: 10px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    box-shadow: 0 4px 12px rgba(111, 66, 193, 0.3);
}

.btn-actualizar:hover {
    background: linear-gradient(135deg, #5a2d91, #673ab7);
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(111, 66, 193, 0.4);
}

.btn-actualizar:active {
    transform: translateY(0);
}

.btn-actualizar:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.btn-actualizar .btn-icon {
    font-size: 1.1rem;
}

.btn-actualizar .btn-text {
    font-size: 0.95rem;
}

/* Estilos para formularios de inventario */
.form-select {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 2px solid #e9ecef;
    border-radius: 10px;
    font-size: 1rem;
    background-color: white;
    transition: all 0.3s ease;
    cursor: pointer;
}

.form-select:focus {
    outline: none;
    border-color: #5B9CB8;
    box-shadow: 0 0 0 3px rgba(111, 66, 193, 0.1);
}

.form-select option {
    padding: 0.5rem;
}

/* Caja de información */
.info-box {
    background: linear-gradient(135deg, #e3f2fd, #f3e5f5);
    border: 1px solid #bbdefb;
    border-radius: 12px;
    padding: 1rem;
    margin-top: 1rem;
}

.info-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.75rem;
}

.info-icon {
    font-size: 1.2rem;
}

.info-title {
    font-weight: 600;
    color: #1976d2;
}

.info-content {
    color: #546e7a;
    line-height: 1.5;
}

.info-content p {
    margin: 0.5rem 0;
    font-size: 0.9rem;
}

.info-content strong {
    color: #37474f;
}

.loading-indicator {
    text-align: center;
    padding: 3rem;
    color: #666;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #5B9CB8;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 1rem auto;
}

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

.empty-state {
    text-align: center;
    padding: 3rem;
    color: #666;
}

/* Responsive para modal de productos */
@media (max-width: 768px) {
    .modal-productos {
        width: 98%;
        margin: 1rem;
    }
    
    .productos-controles {
        flex-direction: column;
        align-items: stretch;
    }
    
    .productos-filtros {
        min-width: unset;
    }
    
    .btn-agregar-producto {
        width: 100%;
        justify-content: center;
    }
    
    .productos-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    
    .producto-card {
        padding: 1rem;
    }
    
    .producto-header {
        flex-direction: column;
        gap: 0.5rem;
        align-items: flex-start;
    }
    
    .producto-nombre {
        font-size: 1.1rem;
    }
    
    .producto-actions {
        flex-direction: column;
        gap: 0.5rem;
    }
    
    .btn-editar-producto,
    .btn-eliminar-producto,
    .btn-desactivar-producto {
        width: 100%;
        justify-content: center;
        padding: 0.75rem;
    }
    
    .form-select {
        font-size: 1rem;
    }
    
    .info-box {
        margin-top: 0.5rem;
    }
    
    .info-content {
        font-size: 0.85rem;
    }
}

a:hover {
    color: var(--primary-hover);
}

/* Utilidades de layout */
.container {
    max-width: 600px;
    background-color: var(--white);
    padding: 40px;
    border-radius: var(--border-radius-large);
    box-shadow: var(--shadow-main);
    text-align: center;
    width: 100%;
    margin: 20px;
}

.text-center {
    text-align: center;
}

.text-left {
    text-align: left;
}

.mb-1 { margin-bottom: 1rem; }
.mb-2 { margin-bottom: 2rem; }
.mb-3 { margin-bottom: 3rem; }
.mt-1 { margin-top: 1rem; }
.mt-2 { margin-top: 2rem; }
.mt-3 { margin-top: 3rem; }

/* Clases de color */
.text-primary { color: var(--primary-color); }
.text-secondary { color: var(--secondary-color); }
.text-light { color: var(--text-light); }
.text-lighter { color: var(--text-lighter); }