/* WeroTV ERP - Estilos Principales */

body {
    font-family: 'Inter', sans-serif;
    background-color: #111827;
    color: #d1d5db;
}

/* Ocultar la app y el login por defecto */
#login-view,
#loading-overlay {
    display: none;
}

.view {
    display: none;
    container-type: inline-size;
}

.view.active {
    display: block;
}

/* Modal Styles */
.modal {
    display: none;
    position: fixed;
    z-index: 100;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(4px);
    animation: fadeIn 0.3s ease-out;
    align-items: center;
    justify-content: center;
}

.modal.active {
    display: flex;
}

.modal-content {
    animation: slideInUp 0.3s ease-out;
    max-height: 90vh;
    overflow-y: auto;
}

/* Sale form: customer information and transaction details side by side. */
#sale-modal .sale-modal-content {
    width: min(1040px, 95vw);
    max-width: 1040px;
}

.sale-columns {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1.15fr);
    gap: 32px;
}

.sale-column {
    min-width: 0;
}

.sale-column>*+* {
    margin-top: 20px;
}

.sale-section-heading {
    margin: 0 0 20px;
    color: var(--w-muted, #9ca3af);
    font-size: 12px;
    font-weight: 600;
    letter-spacing: .08em;
    text-transform: uppercase;
}

.sale-customer-fields {
    display: grid;
    gap: 20px;
}

.sale-product-column {
    border-left: 1px solid var(--w-divider, #374151);
    padding-left: 32px;
}

.sale-form-actions {
    margin-top: 28px;
}

@media (max-width: 859px) {
    #sale-modal .sale-modal-content {
        padding: 24px;
    }

    .sale-columns {
        grid-template-columns: minmax(0, 1fr);
        gap: 24px;
    }

    .sale-product-column {
        padding-left: 0;
        padding-top: 24px;
        border-left: 0;
        border-top: 1px solid var(--w-divider, #374151);
    }
}

@media (max-width: 420px) {
    #sale-modal .sale-modal-content {
        padding: 20px 16px;
    }

    .sale-form-actions {
        flex-wrap: wrap;
    }

    .sale-form-actions button {
        flex: 1 1 auto;
        justify-content: center;
    }
}

/* Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

@keyframes slideInUp {
    from {
        transform: translateY(20px);
        opacity: 0;
    }

    to {
        transform: translateY(0);
        opacity: 1;
    }
}

/* KPI Cards */
.kpi-card {
    transition: all 0.2s ease-in-out;
    min-width: 0;
}

.kpi-card>.flex {
    gap: 12px;
}

.kpi-card>.flex> :first-child {
    min-width: 0;
    flex: 1;
    overflow-wrap: anywhere;
}

.kpi-card>.flex> :last-child {
    flex-shrink: 0;
}

.kpi-card h3 {
    max-width: 100%;
}

@container (max-width: 1100px) {
    .grid:has(> .kpi-card) {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@container (max-width: 560px) {
    .grid:has(> .kpi-card) {
        grid-template-columns: minmax(0, 1fr);
    }
}

.kpi-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.2), 0 4px 6px -2px rgba(0, 0, 0, 0.1);
}

/* Navigation */
.nav-link {
    border-left: 3px solid transparent;
}

.nav-link.active {
    border-left-color: #3b82f6;
    background-color: #1f2937;
}

/* Table Styles */
.inventory-table {
    table-layout: fixed;
}

.inventory-table th,
.inventory-table td {
    text-align: center;
    overflow-wrap: anywhere;
}

.customer-history-table {
    border-collapse: separate;
    border-spacing: 0;
}

.customer-history-table tbody td {
    border-bottom: 1px solid var(--w-divider, #374151);
}

.table-header {
    background-color: #374151;
    position: sticky;
    top: 0;
    z-index: 10;
}

.table-row:nth-child(even) {
    background-color: #1f2937;
}

.table-row:hover {
    background-color: #374151;
}

.price-active {
    background-color: rgba(16, 185, 129, 0.1) !important;
    border-color: #10B981 !important;
}

/* Loading Overlay */
#loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(17, 24, 39, 0.9);
    z-index: 200;
    justify-content: center;
    align-items: center;
    flex-direction: column;
}

.spinner {
    border: 4px solid rgba(255, 255, 255, 0.1);
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border-left-color: #3b82f6;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

/* Indicador de stock: flex solo cuando no est� oculto (evita conflicto flex/hidden). */
#sale-stock-indicator:not(.hidden) {
    display: flex;
}