/**
 * OH Hidráulica - Módulo Exclusivo de Inventario (inventario.css)
 * Estilos para tabla de existencias, semáforos de stock, bitácora Kardex y hoja de conteo físico.
 */

/* Badge de Sincronización con el Catálogo */
.catalog-sync-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: #ecfdf5;
    color: #059669;
    border: 1px solid #a7f3d0;
    font-size: 0.76rem;
    font-weight: 700;
    padding: 4px 10px;
    border-radius: 999px;
}

/* KPI Grid */
.inv-kpi-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
    gap: 16px;
    margin-bottom: 22px;
}

.inv-kpi-card {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 14px;
    padding: 18px 20px;
    display: flex;
    align-items: center;
    gap: 15px;
    box-shadow: 0 2px 6px rgba(15, 23, 42, 0.04);
    transition: all 0.2s ease;
    cursor: pointer;
}

.inv-kpi-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 18px rgba(15, 23, 42, 0.08);
    border-color: #cbd5e1;
}

.inv-kpi-card.active-filter {
    border-color: #0284c7;
    box-shadow: 0 0 0 3px rgba(2, 132, 199, 0.14);
}

.inv-kpi-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.35rem;
    flex-shrink: 0;
}

.inv-kpi-icon.blue { background: #e0f2fe; color: #0284c7; }
.inv-kpi-icon.emerald { background: #d1fae5; color: #059669; }
.inv-kpi-icon.amber { background: #fef3c7; color: #d97706; }
.inv-kpi-icon.rose { background: #fee2e2; color: #dc2626; }
.inv-kpi-icon.purple { background: #ede9fe; color: #7c3aed; }

.inv-kpi-info {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.inv-kpi-label {
    font-size: 0.78rem;
    font-weight: 600;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.inv-kpi-value {
    font-family: 'Outfit', sans-serif;
    font-size: 1.55rem;
    font-weight: 800;
    color: #0f172a;
    line-height: 1.2;
    margin: 2px 0;
}

.inv-kpi-sub {
    font-size: 0.76rem;
    color: #94a3b8;
}

/* Module Tabs Bar */
.inv-tabs-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    margin-bottom: 18px;
    flex-wrap: wrap;
}

.inv-tabs-left {
    display: flex;
    gap: 8px;
    background: #e2e8f0;
    padding: 5px;
    border-radius: 12px;
    flex-wrap: wrap;
}

.inv-tab-btn {
    border: none;
    background: transparent;
    color: #475569;
    font-family: 'Inter', sans-serif;
    font-size: 0.86rem;
    font-weight: 600;
    padding: 9px 16px;
    border-radius: 9px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: all 0.2s ease;
}

.inv-tab-btn:hover {
    color: #0f172a;
}

.inv-tab-btn.active {
    background: #ffffff;
    color: #0284c7;
    box-shadow: 0 2px 6px rgba(15, 23, 42, 0.08);
}

.inv-tab-pill {
    background: #f1f5f9;
    color: #334155;
    font-size: 0.74rem;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 999px;
}

.inv-tab-btn.active .inv-tab-pill {
    background: #e0f2fe;
    color: #0284c7;
}

.inv-tab-pill.pill-warning {
    background: #fef3c7;
    color: #b45309;
}

.btn-sync-catalog {
    background: #ffffff;
    border: 1px solid #cbd5e1;
    color: #0f172a;
    font-size: 0.84rem;
    font-weight: 600;
    padding: 9px 14px;
    border-radius: 10px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 7px;
    transition: all 0.2s ease;
}

.btn-sync-catalog:hover {
    border-color: #0284c7;
    color: #0284c7;
    background: #f8fafc;
}

.inv-tab-panel {
    display: none;
}

.inv-tab-panel.active {
    display: block;
}

/* Toolbar & Filters */
.inv-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 14px;
    padding: 18px 20px;
    border-bottom: 1px solid #e2e8f0;
    background: #f8fafc;
    flex-wrap: wrap;
}

.inv-search-wrapper {
    position: relative;
    flex: 1;
    min-width: 260px;
}

.inv-search-wrapper i.fa-search {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: #94a3b8;
    font-size: 0.9rem;
}

.inv-search-wrapper input {
    width: 100%;
    padding: 10px 36px 10px 38px;
    border: 1px solid #cbd5e1;
    border-radius: 10px;
    font-size: 0.88rem;
    font-family: inherit;
    background: #ffffff;
    color: #0f172a;
    transition: all 0.2s ease;
}

.inv-search-wrapper input:focus {
    outline: none;
    border-color: #0284c7;
    box-shadow: 0 0 0 3px rgba(2, 132, 199, 0.14);
}

.btn-clear-search {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    background: #e2e8f0;
    border: none;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    color: #475569;
    cursor: pointer;
    font-size: 0.72rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

.inv-filters-group {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.inv-select {
    padding: 9px 12px;
    border: 1px solid #cbd5e1;
    border-radius: 10px;
    background: #ffffff;
    color: #1e293b;
    font-size: 0.84rem;
    font-weight: 500;
    font-family: inherit;
    cursor: pointer;
}

.inv-select:focus {
    outline: none;
    border-color: #0284c7;
}

/* Inventory Table Elements */
.sku-code-pill {
    display: inline-block;
    font-family: 'Courier New', Courier, monospace;
    font-weight: 700;
    font-size: 0.82rem;
    color: #0369a1;
    background: #e0f2fe;
    padding: 3px 8px;
    border-radius: 6px;
    border: 1px solid #bae6fd;
    word-break: break-all;
}

.sku-sub-provider {
    display: block;
    font-size: 0.72rem;
    color: #64748b;
    margin-top: 3px;
}

.inv-prod-cell {
    display: flex;
    align-items: center;
    gap: 12px;
}

.inv-prod-thumb {
    width: 42px;
    height: 42px;
    border-radius: 10px;
    background: #f1f5f9;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    flex-shrink: 0;
    border: 1px solid #e2e8f0;
    color: #ffffff;
    font-size: 1.05rem;
}

.inv-prod-thumb img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.inv-prod-title {
    font-weight: 700;
    color: #0f172a;
    font-size: 0.9rem;
    line-height: 1.3;
}

.inv-prod-meta {
    font-size: 0.76rem;
    color: #64748b;
    margin-top: 2px;
}

/* Inline Location Select */
.inline-location-select {
    width: 100%;
    padding: 5px 8px;
    font-size: 0.8rem;
    border: 1px solid #e2e8f0;
    border-radius: 7px;
    background: #f8fafc;
    color: #334155;
    font-weight: 500;
    cursor: pointer;
}

.inline-location-select:focus {
    outline: none;
    border-color: #0284c7;
    background: #ffffff;
}

/* Quick Stock Stepper */
.stock-stepper {
    display: inline-flex;
    align-items: center;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    overflow: hidden;
    background: #ffffff;
}

.btn-step-stock {
    width: 30px;
    height: 32px;
    border: none;
    background: #f1f5f9;
    color: #334155;
    font-weight: 700;
    font-size: 0.9rem;
    cursor: pointer;
    transition: background 0.15s;
}

.btn-step-stock:hover {
    background: #e2e8f0;
    color: #0f172a;
}

.btn-step-stock.minus:hover {
    background: #fee2e2;
    color: #dc2626;
}

.btn-step-stock.plus:hover {
    background: #dcfce7;
    color: #15803d;
}

.input-inline-stock {
    width: 58px;
    height: 32px;
    border: none;
    border-left: 1px solid #e2e8f0;
    border-right: 1px solid #e2e8f0;
    text-align: center;
    font-weight: 800;
    font-size: 0.92rem;
    color: #0f172a;
    font-family: 'Outfit', sans-serif;
    -moz-appearance: textfield;
}

.input-inline-stock::-webkit-outer-spin-button,
.input-inline-stock::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.input-inline-min {
    width: 56px;
    padding: 5px 6px;
    border: 1px solid #e2e8f0;
    border-radius: 7px;
    text-align: center;
    font-weight: 600;
    font-size: 0.84rem;
    color: #475569;
    background: #f8fafc;
}

.input-inline-min:focus {
    outline: none;
    border-color: #0284c7;
    background: #ffffff;
}

/* Status Semaphore Badges */
.stock-status-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    border-radius: 999px;
    font-size: 0.76rem;
    font-weight: 700;
    white-space: nowrap;
}

.stock-status-badge.optimo {
    background: #dcfce7;
    color: #15803d;
}

.stock-status-badge.bajo {
    background: #fef3c7;
    color: #b45309;
}

.stock-status-badge.agotado {
    background: #fee2e2;
    color: #b91c1c;
}

/* Row Actions */
.inv-row-actions {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.btn-inv-action {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    border: 1px solid #e2e8f0;
    background: #ffffff;
    color: #475569;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.18s ease;
    font-size: 0.84rem;
}

.btn-inv-action:hover {
    background: #f1f5f9;
    color: #0284c7;
    border-color: #bae6fd;
}

.btn-inv-action.buy-alert {
    background: #fffbeb;
    color: #d97706;
    border-color: #fde68a;
}

.btn-inv-action.buy-alert:hover {
    background: #fef3c7;
    color: #b45309;
}

/* Table Footer */
.inv-table-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 20px;
    background: #f8fafc;
    border-top: 1px solid #e2e8f0;
    font-size: 0.82rem;
    color: #64748b;
    flex-wrap: wrap;
    gap: 10px;
}

.inv-legend {
    display: flex;
    gap: 16px;
    font-size: 0.78rem;
}

/* Kardex Badges */
.kardex-type-badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 3px 9px;
    border-radius: 6px;
    font-size: 0.76rem;
    font-weight: 700;
}

.kardex-type-badge.entrada { background: #dcfce7; color: #15803d; }
.kardex-type-badge.salida { background: #fee2e2; color: #b91c1c; }
.kardex-type-badge.ajuste { background: #e0f2fe; color: #0369a1; }

/* Modal Styles */
.inv-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.65);
    backdrop-filter: blur(4px);
    z-index: 9999;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 16px;
}

.inv-modal-overlay.active {
    display: flex;
}

.inv-modal-box {
    background: #ffffff;
    width: 100%;
    max-width: 600px;
    border-radius: 16px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    overflow: hidden;
    animation: invModalIn 0.22s ease-out;
}

@keyframes invModalIn {
    from { opacity: 0; transform: scale(0.96) translateY(8px); }
    to { opacity: 1; transform: scale(1) translateY(0); }
}

.inv-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 18px 22px;
    background: #f8fafc;
    border-bottom: 1px solid #e2e8f0;
}

.inv-modal-header h3 {
    font-size: 1.08rem;
    color: #0f172a;
    display: flex;
    align-items: center;
    gap: 8px;
}

.inv-modal-close {
    background: none;
    border: none;
    font-size: 1.1rem;
    color: #94a3b8;
    cursor: pointer;
}

.inv-modal-body {
    padding: 20px 22px;
    max-height: 78vh;
    overflow-y: auto;
}

.inv-form-row {
    display: flex;
    gap: 14px;
    margin-bottom: 14px;
}

.flex-1 {
    flex: 1;
}

.mov-product-preview {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 12px 16px;
    margin-bottom: 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.mov-prod-code {
    display: inline-block;
    font-size: 0.74rem;
    font-weight: 700;
    background: #e0f2fe;
    color: #0369a1;
    padding: 2px 7px;
    border-radius: 4px;
    margin-bottom: 3px;
}

.mov-prod-meta strong {
    display: block;
    font-size: 0.9rem;
    color: #0f172a;
}

.mov-stock-comparison {
    display: flex;
    align-items: center;
    gap: 12px;
}

.mov-stock-box {
    text-align: center;
    background: #ffffff;
    border: 1px solid #cbd5e1;
    padding: 6px 12px;
    border-radius: 8px;
}

.mov-stock-box span {
    display: block;
    font-size: 0.7rem;
    color: #64748b;
}

.mov-stock-box strong {
    font-size: 1.1rem;
    color: #0f172a;
}

.mov-stock-box.result {
    border-color: #0284c7;
    background: #f0f9ff;
}

.mov-stock-box.result strong {
    color: #0284c7;
}

/* Radio Operation Selector */
.mov-type-selector {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
}

.mov-type-option {
    border: 1px solid #cbd5e1;
    border-radius: 10px;
    padding: 10px;
    text-align: center;
    font-size: 0.84rem;
    font-weight: 600;
    color: #475569;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    transition: all 0.2s;
}

.mov-type-option input {
    display: none;
}

.mov-type-option.entrada.active {
    background: #ecfdf5;
    border-color: #10b981;
    color: #047857;
}

.mov-type-option.salida.active {
    background: #fef2f2;
    border-color: #ef4444;
    color: #b91c1c;
}

.mov-type-option.ajuste.active {
    background: #f0f9ff;
    border-color: #0284c7;
    color: #0369a1;
}

.inv-modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    padding-top: 16px;
    border-top: 1px solid #e2e8f0;
    margin-top: 6px;
}

/* Printable Physical Count Sheet */
.print-only-sheet {
    display: none;
}

@media print {
    .no-print,
    .admin-sidebar,
    .admin-topbar,
    .admin-content-area,
    .inv-modal-overlay {
        display: none !important;
    }

    body, .admin-layout-body, .admin-layout-main {
        background: #ffffff !important;
        margin: 0 !important;
        padding: 0 !important;
    }

    .print-only-sheet {
        display: block !important;
        padding: 20px;
        font-family: 'Inter', sans-serif;
        color: #0f172a;
    }

    .print-inventory-table {
        width: 100%;
        border-collapse: collapse;
        font-size: 0.8rem;
    }

    .print-inventory-table th,
    .print-inventory-table td {
        border: 1px solid #94a3b8;
        padding: 6px 8px;
        text-align: left;
    }

    .print-inventory-table th {
        background: #f1f5f9 !important;
        font-weight: 700;
        color: #0f172a;
    }

    .print-signatures-row {
        display: flex;
        justify-content: space-around;
        margin-top: 48px;
        padding-top: 20px;
    }

    .print-sig-box {
        width: 240px;
        text-align: center;
        font-size: 0.8rem;
        color: #334155;
    }

    .print-sig-line {
        border-top: 1px solid #0f172a;
        margin-bottom: 6px;
    }
}

@media (max-width: 768px) {
    .inv-form-row {
        flex-direction: column;
        gap: 10px;
    }
    .mov-type-selector {
        grid-template-columns: 1fr;
    }
}

