/* Estilos personalizados para hacerlo más bonito */
body {
    font-family: 'Inter', sans-serif;
    background-color: #f9fafb;
    margin: 0;
    padding: 0;
}
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 1rem;
    box-sizing: border-box;
}

@media (max-width: 768px) {
    .container {
        padding: 0.5rem;
    }
}
.header {
    display: flex;
    flex-direction: row;
    justify-content: space-between;
    align-items: center;
    text-align: center;
    padding: 8px 24px;
    margin-bottom: 1.5rem;
    background-color: #e7e7e7;
    flex-wrap: wrap;
}

.header img{
    max-width: 20%;
}

.header h1 p {
    font-size: 2rem;
    color: #9ca3af;
}

/* Dashboard de estadísticas */
.stats-dashboard {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1rem;
    margin-bottom: 2rem;
}

.stat-card {
    background: white;
    border-radius: 0.75rem;
    padding: 1.5rem;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
    display: flex;
    align-items: center;
    gap: 1rem;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.stat-icon {
    width: 50px;
    height: 50px;
    background: #f3f4f6;
    border-radius: 0.75rem;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #6b7280;
}

.stat-content h3 {
    font-size: 0.875rem;
    color: #6b7280;
    margin: 0 0 0.25rem 0;
    font-weight: 500;
}

.stat-content p {
    font-size: 1.5rem;
    font-weight: 700;
    color: #1f2937;
    margin: 0;
}

@media (max-width: 768px) {
    .stats-dashboard {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.75rem;
        margin-bottom: 1.5rem;
    }
    
    .stat-card {
        padding: 1rem;
    }
    
    .stat-icon {
        width: 40px;
        height: 40px;
    }
    
    .stat-content h3 {
        font-size: 0.75rem;
    }
    
    .stat-content p {
        font-size: 1.25rem;
    }
}

@media (max-width: 768px) {
    .header {
        padding: 8px 12px;
        margin-bottom: 1rem;
    }
    
    .header img {
        max-width: 40%;
    }
    
    .header h1 {
        font-size: 1.5rem;
        margin: 0.5rem 0;
    }
    
    .header h1 p {
        font-size: 1.5rem;
    }
}
.filters {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
}

.filters-row {
    display: flex;
    justify-content: space-between;
}

.filter-group {
    display: flex;
    flex-direction: column;
    margin-right: 1rem;
    margin-bottom: 1rem;
    width: 100%;
    min-width: 150px;
}

@media (max-width: 480px) {
    .filters {
        margin-bottom: 1rem;
    }
    
    .filters-row {
        flex-direction: column;
    }
    
    .filter-group {
        margin-right: 0;
        min-width: 100%;
    }
}
.filter-group label {
    margin-bottom: 0.2rem;
    font-weight: 600;
    color: #4b5563;
    font-size: 1rem;
}
.filter-group select, .filter-group input {
    padding: 0.8rem;
    border-radius: 0.5rem;
    border: 1px solid #d1d5db;
    font-size: 1.1rem;
    line-height: 1.5rem;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}
.filter-group select:focus, .filter-group input:focus {
    outline: none;
    border-color: #8b5cf6;
    box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.15);
}
.table-container {
    overflow-x: auto;
    margin-bottom: 2rem;
    -webkit-overflow-scrolling: touch; /* Para mejor desplazamiento en iOS */
    border-radius: 0.75rem;
}

.inventory-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    min-width: 900px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    border-radius: 0.75rem;
    overflow: hidden;
}

@media (max-width: 768px) {
    .table-container {
        margin-bottom: 1.5rem;
        border-radius: 0.5rem;
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
    }
    
    .inventory-table thead th {
        padding: 0.75rem;
        font-size: 0.95rem;
    }
    
    .inventory-table tbody td {
        padding: 0.75rem;
        font-size: 0.95rem;
    }
    
    .inventory-table input[type="number"] {
        width: 70px;
        padding: 0.5rem;
        font-size: 0.9rem;
    }
}
.inventory-table thead th {
    background-color: #000000;
    color: #fcfcfc;
    padding: 1.25rem;
    text-align: left;
    font-weight: 600;
    border-bottom: 2px solid #e2e8f0;
    font-size: 1.1rem;
}
.inventory-table thead th:first-child {
    border-top-left-radius: 0.75rem;
}
.inventory-table thead th:last-child {
    border-top-right-radius: 0.75rem;
}
.inventory-table tbody tr {
    background-color: white;
    transition: background-color 0.2s ease;
}
.inventory-table tbody tr:hover {
    background-color: #f5f5f5;
}
.inventory-table tbody tr.highlight-row {
    animation: highlightPulse 2s ease-out;
}

@keyframes highlightPulse {
    0% {
        background-color: #fff;
    }
    50% {
        background-color: #e0f2fe;
    }
    100% {
        background-color: #fff;
    }
}

.inventory-table tbody td {
    padding: 1.25rem;
    border-bottom: 1px solid #f2f4f6;
    font-size: 1.1rem;
}
.inventory-table tbody td:first-child {
    border-left: none;
}
.inventory-table tbody td:last-child {
    border-right: none;
}
.inventory-table tbody tr:last-child td {
    border-bottom: none;
}
.inventory-table td:nth-child(2) {
    font-weight: 500;
    color: #6b7280;
}
.inventory-table td:nth-child(3) {
    text-align: center;
}

/* Controles de cantidad */
.quantity-controls {
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.qty-btn {
    width: 32px;
    height: 32px;
    border: 1px solid #d1d5db;
    background: #fff;
    border-radius: 0.375rem;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 1.25rem;
    font-weight: 500;
    color: #6b7280;
}

.qty-btn:hover {
    background: #f3f4f6;
    border-color: #9ca3af;
    color: #1f2937;
}

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

.qty-btn.decrease {
    color: #ef4444;
}

.qty-btn.decrease:hover {
    background: #fee2e2;
    border-color: #ef4444;
}

.qty-btn.increase {
    color: #10b981;
}

.qty-btn.increase:hover {
    background: #d1fae5;
    border-color: #10b981;
}

.inventory-table input[type="number"] {
    width: 80px;
    padding: 0.5rem;
    border-radius: 0.375rem;
    border: 1px solid #d1d5db;
    font-size: 1rem;
    text-align: center;
    box-sizing: border-box;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}
.inventory-table input[type="number"]:focus {
    outline: none;
    border-color: #8b5cf6;
    box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.15);
}

/* Botones de acción */
.action-buttons {
    display: flex;
    gap: 0.5rem;
}

.btn-action {
    padding: 0.5rem 0.75rem;
    border: none;
    border-radius: 0.375rem;
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
}

.btn-edit {
    background: #e0e7ff;
    color: #4338ca;
}

.btn-edit:hover {
    background: #c7d2fe;
}

.btn-delete {
    background: #fee2e2;
    color: #dc2626;
}

.btn-delete:hover {
    background: #fecaca;
}

.inventory-table .link-cell {
    text-align: center;
}
.inventory-table .link-cell a {
    color: #0014f2;
    text-decoration: none;
    font-weight: 600;
    transition: color 0.2s ease;
    padding: 0.5rem 0.75rem;
    display: inline-block;
    background-color: #e0e7ff;
    border-radius: 0.375rem;
}
.inventory-table .link-cell a:hover {
    color: #fff;
    background-color: #4f46e5;
}

@media (max-width: 768px) {
    .inventory-table .link-cell a {
        padding: 0.5rem;
        width: 90%;
        font-size: 0.9rem;
    }
}
.button-group {
    display: flex;
    gap: 1rem;
    justify-content: flex-start;
    margin-bottom: 2rem;
}

/* Grupo de botones de acción */
.action-buttons-group {
    display: flex;
    flex-direction: column;
    gap: 1.2rem;
    width: 100%;
}

@media (min-width: 640px) {
    .action-buttons-group {
        flex-direction: row;
    }
}

.add-button {
    padding-top: 16px;
    width: 100%;
    border-radius: 0.5rem;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.3s ease, transform 0.2s ease, box-shadow 0.2s ease;
    font-size: 1.1rem;
    border: none;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    background-color: transparent;
    color: #0014f2;
}
.add-button:hover {
    text-decoration: underline;
    transform: translateY(-2px);
}

/* Botón de escaneo */
.scan-button {
    padding-top: 16px;
    width: 100%;
    border-radius: 0.5rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 1.1rem;
    border: none;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    background-color: transparent;
    color: #10b981;
}

.scan-button:hover {
    text-decoration: underline;
    transform: translateY(-2px);
}

/* Modal de escaneo */
.scan-modal, .confirm-modal {
    background-color: white;
    padding: 2rem;
    border-radius: 0.75rem;
    box-shadow: 0 6px 10px -2px rgba(0, 0, 0, 0.15), 0 3px 7px -3px rgba(0, 0, 0, 0.07);
    border: 1px solid #e2e8f0;
    margin: 0;
    overflow-y: auto;
    max-height: 85vh;
    max-width: 600px;
}

.scan-modal h2, .confirm-modal h2 {
    font-size: 1.875rem;
    font-weight: 600;
    color: #1f2937;
    margin-bottom: 1rem;
    text-align: center;
}

.confirm-subtitle {
    text-align: center;
    color: #6b7280;
    margin-bottom: 1.5rem;
}

/* Área de carga de imagen */
.scan-upload-area {
    border: 2px dashed #d1d5db;
    border-radius: 0.5rem;
    padding: 2rem;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s ease;
    background-color: #f9fafb;
}

.scan-upload-area:hover {
    border-color: #9ca3af;
    background-color: #f3f4f6;
}

.upload-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
}

.upload-placeholder svg {
    color: #9ca3af;
}

.upload-placeholder p {
    color: #6b7280;
    font-weight: 500;
}

.capture-btn {
    padding: 0.75rem 1.5rem;
    background-color: #8b5cf6;
    color: white;
    border: none;
    border-radius: 0.5rem;
    font-weight: 600;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    transition: all 0.2s ease;
}

.capture-btn:hover {
    background-color: #7c3aed;
    transform: translateY(-1px);
}

/* Barra de progreso */
.scan-progress {
    margin-top: 2rem;
    text-align: center;
}

.progress-bar {
    width: 100%;
    height: 8px;
    background-color: #e5e7eb;
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 1rem;
}

.progress-fill {
    height: 100%;
    background-color: #8b5cf6;
    width: 0%;
    animation: progress 2s ease-in-out infinite;
}

@keyframes progress {
    0% { width: 0%; }
    50% { width: 70%; }
    100% { width: 100%; }
}

/* Acciones del modal */
.scan-actions, .confirm-actions {
    display: flex;
    justify-content: flex-end;
    gap: 1rem;
    margin-top: 2rem;
}

.scan-btn {
    padding: 0.8rem 2rem;
    background-color: #8b5cf6;
    color: white;
    border: none;
    border-radius: 0.5rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.scan-btn:hover {
    background-color: #7c3aed;
    transform: translateY(-1px);
}

/* Items detectados */
.detected-items {
    max-height: 400px;
    overflow-y: auto;
    border: 1px solid #e5e7eb;
    border-radius: 0.5rem;
    padding: 1rem;
    margin-bottom: 1.5rem;
}

.detected-item {
    display: grid;
    grid-template-columns: 1.5fr 1fr 0.8fr 1fr 0.8fr auto;
    gap: 0.75rem;
    padding: 1rem;
    border-bottom: 1px solid #f3f4f6;
    align-items: end;
}

@media (max-width: 768px) {
    .detected-item {
        grid-template-columns: 1fr 1fr;
        gap: 0.5rem;
    }
    
    .detected-item > div:last-of-type {
        grid-column: span 2;
    }
    
    .detected-item button {
        grid-column: span 2;
        justify-self: center;
    }
}

/* Badge para tipo de producto */
.tipo-badge {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    font-size: 0.75rem;
    font-weight: 600;
    border-radius: 0.375rem;
    background-color: #e0e7ff;
    color: #4338ca;
}

.tipo-badge.tipo-infantil {
    background-color: #fef3c7;
    color: #b45309;
}

.tipo-badge.tipo-adulto {
    background-color: #e0e7ff;
    color: #4338ca;
}

.detected-item:last-child {
    border-bottom: none;
}

.detected-item input {
    padding: 0.5rem;
    border: 1px solid #d1d5db;
    border-radius: 0.375rem;
    font-size: 0.875rem;
}

.detected-item input:focus {
    outline: none;
    border-color: #8b5cf6;
    box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.15);
}

.detected-item-label {
    font-weight: 500;
    color: #4b5563;
    font-size: 0.875rem;
}

.remove-detected {
    padding: 0.5rem;
    background-color: #fee2e2;
    color: #dc2626;
    border: none;
    border-radius: 0.375rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.remove-detected:hover {
    background-color: #fecaca;
}

.add-detected-btn {
    padding: 0.8rem 2rem;
    background-color: #10b981;
    color: white;
    border: none;
    border-radius: 0.5rem;
    font-weight: 600;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    transition: all 0.2s ease;
}

.add-detected-btn:hover {
    background-color: #059669;
    transform: translateY(-1px);
}
.modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    backdrop-filter: blur(2px);
    -webkit-backdrop-filter: blur(2px);
}

.modal {
    display: none;
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 1001;
    width: 90%;
    max-width: 600px;
}

.add-item-form {
    background-color: white;
    padding: 2rem;
    border-radius: 0.75rem;
    box-shadow: 0 6px 10px -2px rgba(0, 0, 0, 0.15), 0 3px 7px -3px rgba(0, 0, 0, 0.07);
    border: 1px solid #e2e8f0;
    margin: 0;
    overflow-y: auto;
    max-height: 85vh;
}

@media (max-width: 768px) {
    .add-item-form {
        padding: 1.5rem;
    }
    
    .add-item-form h2 {
        font-size: 1.5rem;
        margin-bottom: 1rem;
    }
    
    .form-group {
        margin-bottom: 1rem;
    }
    
    .form-actions {
        flex-direction: column-reverse;
        gap: 0.75rem;
    }
    
    .add-item-button, .cancel-button {
        width: 100%;
        margin: 0;
        padding: 0.8rem 1rem;
    }
}
.add-item-form h2 {
    font-size: 1.875rem;
    font-weight: 600;
    color: #6d28d9;
    margin-bottom: 1.5rem;
    text-align: center;
}
.form-group {
    margin-bottom: 1.5rem;
}
.form-group label {
    display: block;
    margin-bottom: 0.75rem;
    font-weight: 600;
    color: #4b5563;
    font-size: 1rem;
}
.form-group input, .form-group select {
    padding: 0.8rem;
    border-radius: 0.5rem;
    border: 1px solid #d1d5db;
    font-size: 1.1rem;
    width: 100%;
    box-sizing: border-box;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}
.form-group input:focus, .form-group select:focus {
    outline: none;
    border-color: #8b5cf6;
    box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.15);
}
.form-actions {
    display: flex;
    justify-content: flex-end;
    margin-top: 2rem;
}
.add-item-button {
    padding: 0.8rem 2rem;
    border-radius: 0.5rem;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.3s ease, transform 0.2s ease, box-shadow 0.2s ease;
    font-size: 1.1rem;
    border: none;
    background-color: #10b981;
    color: white;
}
.add-item-button:hover {
    background-color: #047857;
    transform: translateY(-2px);
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
}
.cancel-button {
    margin-left: 1rem;
    padding: 0.8rem 2rem;
    border-radius: 0.5rem;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.3s ease, transform 0.2s ease, box-shadow 0.2s ease;
    font-size: 1.1rem;
    border: none;
    background-color: #e5e7eb;
    color: #374151;
}
.cancel-button:hover {
    background-color: #d1d5db;
    transform: translateY(-2px);
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
}
.message-box {
    margin-top: 2rem;
    padding: 1.25rem;
    border-radius: 0.75rem;
    text-align: center;
    font-weight: 600;
    border: 1px solid;
    transition: opacity 0.3s ease, transform 0.3s ease;
    opacity: 0;
    transform: translateY(-10px);
}
.message-box.show {
    opacity: 1;
    transform: translateY(0);
}
.message-box.success {
    background-color: #f0fdf4;
    color: #15803d;
    border-color: #16a34a;
}
.message-box.error {
    background-color: #fee2e2;
    color: #991b1b;
    border-color: #b91c1c;
}

.message-box.info {
    background-color: #e0f2fe;
    color: #0369a1;
    border-color: #0284c7;
}

.message-box.warning {
    background-color: #fef3c7;
    color: #b45309;
    border-color: #d97706;
}

/* Toast notifications */
.toast-container {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    z-index: 2000;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.toast {
    background: white;
    padding: 1rem 1.5rem;
    border-radius: 0.5rem;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    display: flex;
    align-items: center;
    gap: 0.75rem;
    min-width: 300px;
    animation: slideIn 0.3s ease-out;
}

@keyframes slideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

.toast.success {
    border-left: 4px solid #10b981;
}

.toast.error {
    border-left: 4px solid #ef4444;
}

.toast-icon {
    width: 24px;
    height: 24px;
}

.toast-icon.success {
    color: #10b981;
}

.toast-icon.error {
    color: #ef4444;
}

.toast-message {
    flex: 1;
    font-weight: 500;
    color: #1f2937;
}

/* Estilo para el indicador de carga */
.loading-indicator {
    display: inline-block;
    margin-left: 0.5rem;
}

.loading-indicator img {
    animation: spin 1s linear infinite;
}

@keyframes spin {
    from {
        transform: rotate(0deg);
    }
    to {
        transform: rotate(360deg);
    }
}

/* Indicador de guardado */
.save-indicator {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    margin-left: 0.5rem;
    color: #10b981;
    font-size: 0.875rem;
    animation: fadeInOut 2s ease-out;
}

@keyframes fadeInOut {
    0% {
        opacity: 0;
        transform: scale(0.8);
    }
    50% {
        opacity: 1;
        transform: scale(1);
    }
    100% {
        opacity: 0;
        transform: scale(0.8);
    }
}

/* Estilos para el enlace de reset búsqueda */
.reset-search-container {
    margin: -0.5rem 0 1rem 0;
    text-align: left;
}

.reset-search-link {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    color: #dc2626;
    font-size: 0.875rem;
    font-weight: 500;
    text-decoration: none;
    padding: 0.375rem 0.75rem;
    border-radius: 0.375rem;
    transition: all 0.2s ease;
}

.reset-search-link:hover {
    background-color: #fee2e2;
    color: #b91c1c;
}

@media (max-width: 768px) {
    .reset-search-container {
        margin: 0.5rem 0 1rem 0;
    }
}

/* Estilos para el empty state */
.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 3rem 2rem;
    background-color: white;
    border-radius: 0.75rem;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    text-align: center;
    margin-top: 1rem;
}

.empty-state-icon {
    width: 100px;
    height: 100px;
    margin-bottom: 1.5rem;
    color: #8b5cf6;
}

.empty-state-icon svg {
    width: 100%;
    height: 100%;
}

.empty-state h3 {
    font-size: 1.5rem;
    font-weight: 600;
    color: #4b5563;
    margin-bottom: 0.75rem;
}

.empty-state p {
    font-size: 1.1rem;
    color: #9ca3af;
    max-width: 400px;
    line-height: 1.5;
}