/* Bodega - Estilos Compartidos (alineados a ERP) */

/* Tabs (ERP style) */
.tab-bar {
    display: flex;
    gap: 2rem;
    border-bottom: 1px solid var(--border);
    margin-bottom: 20px;
    padding-left: 10px;
}

/* Shell layout alignment with ERP */
body.bodega-shell .section-block {
    background: transparent;
    border: none;
    box-shadow: none;
    padding: 0;
    gap: 18px;
}

body.bodega-shell .section-header {
    border-bottom: none;
    padding-bottom: 0;
}

.tab-btn {
    background: none;
    border: none;
    color: var(--text-soft);
    padding: 10px 0;
    font-size: 1rem;
    cursor: pointer;
    position: relative;
    transition: color 0.3s;
}

.tab-btn.active {
    color: var(--neon);
    font-weight: 700;
}

.tab-btn.active::after {
    content: '';
    position: absolute;
    bottom: -1px;
    left: 0;
    width: 100%;
    height: 2px;
    background: var(--neon);
    box-shadow: 0 0 10px var(--neon);
}

/* Views */
.view-section {
    display: none;
    animation: fadeIn 0.3s ease;
}

.view-section.active {
    display: block;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(5px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* KPI Cards (ERP style) */
.kpi-grid,
.kpi-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.kpi-card {
    background: var(--panel);
    padding: 20px;
    border-radius: 16px;
    border: 1px solid var(--border);
    text-align: center;
    display: flex;
    align-items: baseline;
    justify-content: center;
    gap: 8px;
}

.kpi-val {
    font-size: 2rem;
    font-weight: 800;
    color: #fff;
}

.kpi-lbl {
    font-size: 0.8rem;
    color: var(--text-soft);
    text-transform: uppercase;
    margin-top: 5px;
}

/* Toolbar */
.toolbar {
    display: flex;
    gap: 1rem;
    margin-bottom: 1rem;
    background: var(--panel);
    padding: 10px;
    border-radius: 8px;
    align-items: center;
    flex-wrap: wrap;
    border: 1px solid var(--border);
}

.search-box {
    flex: 1;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid var(--border);
    color: #fff;
    padding: 8px 10px;
    border-radius: 6px;
}

.search-box:focus {
    outline: none;
    border-color: var(--neon);
}

/* Buttons (ERP style) */
.btn-primary,
.btn-secondary {
    padding: 8px 15px;
    border-radius: 6px;
    border: none;
    cursor: pointer;
    transition: all 0.3s;
}

.btn-primary {
    background: var(--neon);
    color: #000;
}

.btn-primary:hover {
    box-shadow: 0 0 15px var(--neon);
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.1);
    color: white;
    border: 1px solid var(--border);
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.15);
}

.btn-icon {
    background: transparent;
    border: none;
    color: var(--text-soft);
    font-size: 1.2rem;
    cursor: pointer;
    padding: 5px;
    border-radius: 4px;
    transition: 0.2s;
}

.btn-icon:hover {
    color: #fff;
    background: rgba(255, 255, 255, 0.05);
}

/* Tables (ERP style) */
.table-container {
    flex: 1;
    overflow-y: auto;
    border: none;
    border-radius: 8px;
    min-height: 300px;
}

.data-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0 12px;
    margin-top: 10px;
    font-size: 0.9rem;
}

.data-table thead th {
    padding: 12px 20px;
    color: var(--text-soft);
    text-transform: uppercase;
    font-size: 0.75rem;
    letter-spacing: 1px;
    text-align: left;
    border-bottom: 2px solid var(--border);
    background: transparent;
    position: static;
}

.data-table tbody tr {
    transition: transform 0.2s;
    cursor: pointer;
}

.data-table tbody tr:hover {
    transform: scale(1.002);
    background: rgba(255, 255, 255, 0.02);
}

.data-table tbody td {
    background: var(--panel-strong);
    padding: 16px 20px;
    color: #fff;
    text-align: left;
    border-top: 1px solid rgba(255, 255, 255, 0.03);
    border-bottom: 1px solid rgba(0, 0, 0, 0.2);
}

.data-table tbody td:first-child {
    border-top-left-radius: 12px;
    border-bottom-left-radius: 12px;
}

.data-table tbody td:last-child {
    border-top-right-radius: 12px;
    border-bottom-right-radius: 12px;
    text-align: right;
}

/* Catalog actions column: align with header (left) */
#catItemsTable tbody td:last-child {
    text-align: left;
}

/* Drawers */
.kardex-drawer {
    position: fixed;
    top: 0;
    right: 0;
    height: 100vh;
    width: 420px;
    background: rgba(12, 15, 22, 0.98);
    border-left: 1px solid rgba(255, 255, 255, 0.08);
    padding: 1.5rem;
    box-shadow: -10px 0 30px rgba(0, 0, 0, 0.5);
    transform: translateX(100%);
    transition: transform 0.25s ease;
    z-index: 9999;
}

.kardex-drawer.open {
    transform: translateX(0);
}

.kardex-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1rem;
}

/* Catalog / Tree */
.cat-grid {
    display: grid;
    grid-template-columns: 260px 1fr;
    gap: 1rem;
    height: 100%;
}

.cat-tree {
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 1rem;
    overflow-y: auto;
}

.tree-node {
    padding: 6px 8px;
    cursor: pointer;
    border-radius: 6px;
    color: #ccc;
}

.tree-node.active {
    background: rgba(0, 243, 255, 0.12);
    color: #fff;
    font-weight: bold;
}

.tree-indent {
    margin-left: 1rem;
    border-left: 1px solid rgba(255, 255, 255, 0.1);
}

/* Badges */
.badge-match {
    display: inline-block;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 0.7rem;
    background: rgba(0, 255, 65, 0.2);
    color: #00ff41;
    border: 1px solid rgba(0, 255, 65, 0.3);
}

.badge-none {
    display: inline-block;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 0.7rem;
    background: rgba(255, 255, 255, 0.1);
    color: #aaa;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

/* Analysis Cards */
.analysis-card {
    background: var(--panel);
    padding: 1rem;
    margin-bottom: 1rem;
    border-radius: 12px;
    border-left: 4px solid var(--neon);
    border: 1px solid var(--border);
}

.analysis-card h4 {
    margin: 0 0 0.5rem 0;
    color: #fff;
}

.card-danger {
    border-left-color: #ff3333;
}

.card-warning {
    border-left-color: #ffc107;
}

/* Dialog / Modal Styling */
dialog {
    margin: auto;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    background: #1a1f2b;
    color: #fff;
    max-width: 90vw;
    max-height: 90vh;
}

dialog::backdrop {
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(2px);
}

/* Tree Selector Specifics */
.cat-tree-nodes {
    margin-top: 10px;
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 4px;
    padding: 5px;
    background: rgba(0, 0, 0, 0.1);
}

.cat-tree-search input {
    background: rgba(255, 255, 255, 0.05) !important;
    border: 1px solid rgba(255, 255, 255, 0.1) !important;
    color: #fff !important;
    border-radius: 4px;
}
