/* ============================================================
   INVENTARIOS.CSS - Estilos para Vistas de Inventarios
   (Existencias, Kardex, Recuperación/Merma)
   Barraca Kollasuyo - Sistema de Gestión Comercial
   Estilo 100% Sólido sin degradados, adaptable a los 4 temas
   ============================================================ */

body {
    background: var(--color-bg, #f8fafc);
    color: var(--color-text, #0f172a);
}

.summary-card {
    background: var(--color-surface, #ffffff);
    padding: 15px;
    border-radius: 10px;
    margin-bottom: 15px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
    border: 1px solid var(--color-border, #e2e8f0);
    border-left: 4px solid var(--color-primary, #680d03);
}

.summary-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    text-align: center;
}

.summary-item {
    padding: 5px;
}

.summary-item:not(:last-child) {
    border-right: 1px solid var(--color-border, #e2e8f0);
}

.summary-label {
    font-size: 0.7rem;
    color: var(--color-text-muted, #64748b);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 5px;
}

.summary-value {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--color-primary, #680d03);
    line-height: 1.2;
}

.summary-sub {
    font-size: 0.65rem;
    color: #2E8B57;
    margin-top: 3px;
}

.refresh-container {
    display: flex;
    justify-content: flex-end;
    margin-bottom: 15px;
}

.refresh-btn {
    background-color: var(--color-primary, #680d03);
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.9rem;
    font-weight: 600;
    transition: background-color 0.2s, transform 0.1s;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.12);
}

.refresh-btn:hover {
    background-color: var(--color-primary-hover, #831608);
}

.refresh-btn:disabled {
    background-color: #ccc;
    cursor: not-allowed;
    box-shadow: none;
}

.inventory-card, .kardex-card {
    background-color: var(--color-surface, #ffffff);
    border: 1px solid var(--color-border, #e2e8f0);
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.scroll-hint {
    text-align: center;
    padding: 5px;
    font-size: 0.7rem;
    color: var(--color-primary, #680d03);
    background-color: var(--color-bg, #f8fafc);
    border-bottom: 1px solid var(--color-border, #e2e8f0);
}

.table-container {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.inventory-table, .kardex-table {
    width: 100%;
    border-collapse: collapse;
    min-width: 600px;
    font-size: 0.85rem;
}

.inventory-table thead, .kardex-table thead {
    background: var(--color-primary, #680d03);
    color: #ffffff;
}

.inventory-table th, .kardex-table th {
    padding: 12px 8px;
    text-align: center;
    font-weight: 600;
    font-size: 0.8rem;
    white-space: nowrap;
    border-right: 1px solid rgba(255, 255, 255, 0.1);
}

.inventory-table th:first-child, .kardex-table th:first-child {
    text-align: left;
    padding-left: 10px;
}

.inventory-table th:last-child, .kardex-table th:last-child {
    border-right: none;
}

.inventory-table tbody tr, .kardex-table tbody tr {
    border-bottom: 1px solid var(--color-border, #e2e8f0);
    transition: background-color 0.2s;
}

.inventory-table tbody tr:hover, .kardex-table tbody tr:hover {
    background-color: rgba(0, 0, 0, 0.02);
}

.inventory-table tbody tr:nth-child(even), .kardex-table tbody tr:nth-child(even) {
    background-color: rgba(0, 0, 0, 0.01);
}

.inventory-table td, .kardex-table td {
    padding: 10px 8px;
    text-align: center;
    color: var(--color-text, #0f172a);
    border-right: 1px solid var(--color-border, #e2e8f0);
}

.inventory-table td:first-child, .kardex-table td:first-child {
    font-weight: 600;
    color: var(--color-primary, #680d03);
    text-align: left;
    padding-left: 10px;
}

.inventory-table td:last-child, .kardex-table td:last-child {
    border-right: none;
}

.numeric-cell {
    font-family: monospace;
    font-weight: 600;
    font-size: 0.9rem;
    text-align: right;
    padding-right: 10px !important;
}

.positive-value {
    color: #2E8B57;
    font-weight: 700;
}

.negative-value {
    color: #D32F2F;
    font-weight: 700;
}

.zero-value {
    color: #999;
}

.estado-badge {
    display: inline-block;
    padding: 3px 8px;
    border-radius: 12px;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.estado-badge.disponible {
    background-color: #e8f5e9;
    color: #2E8B57;
    border: 1px solid #a5d6a7;
}

.estado-badge.agotado {
    background-color: #fff3e0;
    color: #ef6c00;
    border: 1px solid #ffcc80;
}

.estado-badge.negativo {
    background-color: #ffebee;
    color: #D32F2F;
    border: 1px solid #ef9a9a;
}

table.data-table tr.total-row,
.kardex-table tr.total-row {
    background: var(--color-primary, #680d03);
    color: white;
    font-weight: 700;
    font-size: 0.9rem;
}

table.data-table tr.total-row td,
.kardex-table tr.total-row td {
    border: none;
    color: white !important;
    padding: 12px 8px;
}

table.data-table tr.total-row td:first-child,
.kardex-table tr.total-row td:first-child {
    color: white !important;
}

/* Controls & Selects */
.controls {
    background-color: var(--color-surface, #ffffff);
    border: 1px solid var(--color-border, #e2e8f0);
    padding: 12px 15px;
    border-radius: 10px;
    margin-bottom: 15px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.product-select {
    width: 100%;
    padding: 12px 15px;
    border: 1px solid var(--color-border, #cbd5e1);
    border-radius: 8px;
    font-size: 1rem;
    background-color: var(--color-surface, #ffffff);
    color: var(--color-text, #0f172a);
    cursor: pointer;
    appearance: none;
}

.product-select:focus {
    outline: none;
    border-color: var(--color-primary, #680d03);
    box-shadow: 0 0 0 3px rgba(104, 13, 3, 0.12);
}

.product-info {
    background: var(--color-surface, #ffffff);
    padding: 15px;
    border-radius: 10px;
    margin-bottom: 15px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
    border: 1px solid var(--color-border, #e2e8f0);
    border-left: 4px solid var(--color-primary, #680d03);
}

.product-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 0;
}

.product-row:not(:last-child) {
    border-bottom: 1px solid var(--color-border, #e2e8f0);
}

.product-label {
    font-size: 0.85rem;
    color: var(--color-text-muted, #64748b);
    font-weight: 500;
}

.product-value {
    font-size: 1rem;
    font-weight: 600;
    color: var(--color-primary, #680d03);
}

.tipo-badge {
    display: inline-block;
    padding: 3px 8px;
    border-radius: 12px;
    font-size: 0.7rem;
    font-weight: 600;
}

.tipo-badge.ingreso {
    background-color: #e8f5e9;
    color: #2E8B57;
}

.tipo-badge.egreso {
    background-color: #ffebee;
    color: #D32F2F;
}

.tipo-badge.ajuste {
    background-color: #e3f2fd;
    color: #1976D2;
}

.tipo-badge.merma {
    background-color: #fff3e0;
    color: #F57C00;
}

.no-results, .loading {
    text-align: center;
    padding: 40px 20px;
    color: var(--color-text-muted, #64748b);
    font-style: italic;
}

.loading i, .no-results i {
    font-size: 2rem;
    display: block;
    margin-bottom: 10px;
    color: var(--color-primary, #680d03);
}

/* Responsive adjustments */
@media (max-width: 480px) {
    .summary-grid {
        grid-template-columns: 1fr;
    }
    .summary-item:not(:last-child) {
        border-right: none;
        border-bottom: 1px solid var(--color-border, #e2e8f0);
    }
}
