/* ---- Inventory Dashboard ---- */
.inv-dashboard {
    display: flex;
    flex-direction: column;
    gap: var(--space-xl);
}

/* ---- Stat Cards Row ---- */
.inv-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: var(--space-md);
}

.inv-stat-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    padding: var(--space-lg);
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
}

.inv-stat-card__label {
    font-size: var(--text-xs);
    font-weight: 600;
    color: var(--text-tertiary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.inv-stat-card__value {
    font-size: var(--text-2xl);
    font-weight: 700;
    color: var(--text-primary);
}

.inv-stat-card__change {
    font-size: var(--text-xs);
    font-weight: 500;
}

.inv-stat-card__change--up { color: var(--accent-green); }
.inv-stat-card__change--down { color: #EF4444; }

/* ---- Page Header ---- */
.inv-page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-md);
    flex-wrap: wrap;
}

.inv-page-header__title {
    font-size: var(--text-xl);
    font-weight: 700;
}

.inv-page-header__actions {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
}

/* ---- Search & Filter Bar ---- */
.inv-toolbar {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    flex-wrap: wrap;
}

.inv-search {
    flex: 1;
    min-width: 200px;
    max-width: 360px;
    position: relative;
}

.inv-search__icon {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    width: 16px;
    height: 16px;
    color: var(--text-tertiary);
    pointer-events: none;
}

.inv-search__input {
    width: 100%;
    padding-left: 36px;
}

.inv-filter-select {
    min-width: 140px;
}

/* ---- Data Table ---- */
.inv-table-wrap {
    background: var(--bg-secondary);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    overflow: hidden;
}

.inv-table {
    width: 100%;
    border-collapse: collapse;
}

.inv-table th {
    font-size: var(--text-xs);
    font-weight: 600;
    color: var(--text-tertiary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    text-align: left;
    padding: var(--space-md) var(--space-lg);
    border-bottom: 1px solid var(--border-subtle);
    background: var(--bg-tertiary);
    white-space: nowrap;
    cursor: pointer;
    user-select: none;
}

.inv-table th:hover {
    color: var(--text-secondary);
}

.inv-table th.sorted-asc::after { content: ' \u25B2'; font-size: 10px; }
.inv-table th.sorted-desc::after { content: ' \u25BC'; font-size: 10px; }

.inv-table td {
    padding: var(--space-md) var(--space-lg);
    border-bottom: 1px solid var(--border-subtle);
    font-size: var(--text-sm);
    vertical-align: middle;
}

.inv-table tbody tr {
    transition: background var(--transition-fast);
    cursor: pointer;
}

.inv-table tbody tr:hover {
    background: var(--bg-tertiary);
}

.inv-table tbody tr:last-child td {
    border-bottom: none;
}

/* ---- Product Cell ---- */
.inv-product-cell {
    display: flex;
    align-items: center;
    gap: var(--space-md);
}

.inv-product-cell__img {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-md);
    background: var(--bg-elevated);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: var(--text-lg);
    flex-shrink: 0;
}

.inv-product-cell__info {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.inv-product-cell__name {
    font-weight: 500;
    color: var(--text-primary);
}

.inv-product-cell__sku {
    font-size: var(--text-xs);
    color: var(--text-tertiary);
    font-family: var(--font-mono);
}

/* ---- Stock Status Badge ---- */
.inv-stock-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 3px 10px;
    border-radius: var(--radius-full);
    font-size: var(--text-xs);
    font-weight: 600;
}

.inv-stock-badge--in-stock {
    background: rgba(16, 185, 129, 0.12);
    color: #10B981;
}

.inv-stock-badge--low-stock {
    background: rgba(245, 158, 11, 0.12);
    color: #F59E0B;
}

.inv-stock-badge--out-of-stock {
    background: rgba(239, 68, 68, 0.12);
    color: #EF4444;
}

.inv-stock-badge--on-order {
    background: rgba(6, 182, 212, 0.12);
    color: #06B6D4;
}

.inv-stock-badge__dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: currentColor;
}

/* ---- Stock Bar ---- */
.inv-stock-bar {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    min-width: 120px;
}

.inv-stock-bar__track {
    flex: 1;
    height: 6px;
    background: var(--bg-elevated);
    border-radius: var(--radius-full);
    overflow: hidden;
}

.inv-stock-bar__fill {
    height: 100%;
    border-radius: var(--radius-full);
    transition: width var(--transition-base);
}

.inv-stock-bar__fill--green { background: #10B981; }
.inv-stock-bar__fill--amber { background: #F59E0B; }
.inv-stock-bar__fill--red { background: #EF4444; }

.inv-stock-bar__label {
    font-size: var(--text-xs);
    color: var(--text-secondary);
    white-space: nowrap;
    min-width: 50px;
    text-align: right;
}

/* ---- Tabs / Sub-nav ---- */
.inv-tabs {
    display: flex;
    gap: var(--space-xs);
    border-bottom: 1px solid var(--border-subtle);
    margin-bottom: var(--space-lg);
}

.inv-tab {
    padding: var(--space-sm) var(--space-md);
    font-size: var(--text-sm);
    font-weight: 500;
    color: var(--text-tertiary);
    border-bottom: 2px solid transparent;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.inv-tab:hover {
    color: var(--text-secondary);
}

.inv-tab--active {
    color: var(--brand-purple);
    border-bottom-color: var(--brand-purple);
}

.inv-tab__count {
    font-size: var(--text-xs);
    background: var(--bg-elevated);
    padding: 1px 6px;
    border-radius: var(--radius-full);
    margin-left: 6px;
}

/* ---- Sidebar Nav ---- */
.inv-layout {
    display: flex;
    gap: 0;
    min-height: calc(100vh - var(--header-height));
    margin: calc(-1 * var(--space-xl));
}

.inv-sidebar {
    width: 220px;
    background: var(--bg-secondary);
    border-right: 1px solid var(--border-subtle);
    padding: var(--space-lg) 0;
    flex-shrink: 0;
}

.inv-sidebar__section {
    padding: 0 var(--space-md);
    margin-bottom: var(--space-lg);
}

.inv-sidebar__section-title {
    font-size: var(--text-xs);
    font-weight: 600;
    color: var(--text-tertiary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 0 var(--space-sm);
    margin-bottom: var(--space-sm);
}

.inv-sidebar__item {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    padding: var(--space-sm) var(--space-md);
    border-radius: var(--radius-md);
    font-size: var(--text-sm);
    font-weight: 500;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.inv-sidebar__item:hover {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

.inv-sidebar__item--active {
    background: rgba(139, 92, 246, 0.1);
    color: var(--brand-purple);
}

.inv-sidebar__item svg {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
}

.inv-sidebar__item-count {
    margin-left: auto;
    font-size: var(--text-xs);
    color: var(--text-tertiary);
    background: var(--bg-elevated);
    padding: 1px 6px;
    border-radius: var(--radius-full);
}

.inv-content {
    flex: 1;
    padding: var(--space-xl);
    overflow-x: auto;
}

/* ---- Detail Panel ---- */
.inv-detail {
    display: flex;
    flex-direction: column;
    gap: var(--space-lg);
}

.inv-detail__header {
    display: flex;
    align-items: flex-start;
    gap: var(--space-lg);
}

.inv-detail__img {
    width: 80px;
    height: 80px;
    border-radius: var(--radius-lg);
    background: var(--bg-elevated);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2.5rem;
    flex-shrink: 0;
}

.inv-detail__info {
    flex: 1;
}

.inv-detail__name {
    font-size: var(--text-xl);
    font-weight: 700;
    margin-bottom: var(--space-xs);
}

.inv-detail__sku {
    font-size: var(--text-sm);
    color: var(--text-tertiary);
    font-family: var(--font-mono);
}

.inv-detail__grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: var(--space-md);
}

.inv-detail__field {
    display: flex;
    flex-direction: column;
    gap: var(--space-xs);
}

.inv-detail__field-label {
    font-size: var(--text-xs);
    font-weight: 600;
    color: var(--text-tertiary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.inv-detail__field-value {
    font-size: var(--text-sm);
    color: var(--text-primary);
    font-weight: 500;
}

/* ---- Movement History ---- */
.inv-history {
    display: flex;
    flex-direction: column;
    gap: 0;
}

.inv-history__item {
    display: flex;
    align-items: center;
    gap: var(--space-md);
    padding: var(--space-md) 0;
    border-bottom: 1px solid var(--border-subtle);
}

.inv-history__item:last-child {
    border-bottom: none;
}

.inv-history__icon {
    width: 32px;
    height: 32px;
    border-radius: var(--radius-full);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: var(--text-sm);
}

.inv-history__icon--in { background: rgba(16, 185, 129, 0.12); color: #10B981; }
.inv-history__icon--out { background: rgba(239, 68, 68, 0.12); color: #EF4444; }
.inv-history__icon--adjust { background: rgba(139, 92, 246, 0.12); color: #8B5CF6; }
.inv-history__icon--transfer { background: rgba(6, 182, 212, 0.12); color: #06B6D4; }

.inv-history__info {
    flex: 1;
}

.inv-history__desc {
    font-size: var(--text-sm);
    color: var(--text-primary);
}

.inv-history__meta {
    font-size: var(--text-xs);
    color: var(--text-tertiary);
}

.inv-history__qty {
    font-size: var(--text-sm);
    font-weight: 600;
    white-space: nowrap;
}

.inv-history__qty--positive { color: #10B981; }
.inv-history__qty--negative { color: #EF4444; }

/* ---- Warehouse Card ---- */
.inv-warehouse-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: var(--space-md);
}

.inv-warehouse-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    padding: var(--space-lg);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.inv-warehouse-card:hover {
    border-color: var(--border-default);
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}

.inv-warehouse-card__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: var(--space-md);
}

.inv-warehouse-card__name {
    font-size: var(--text-base);
    font-weight: 600;
}

.inv-warehouse-card__location {
    font-size: var(--text-xs);
    color: var(--text-tertiary);
}

.inv-warehouse-card__stats {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--space-sm);
}

.inv-warehouse-card__stat {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.inv-warehouse-card__stat-label {
    font-size: var(--text-xs);
    color: var(--text-tertiary);
}

.inv-warehouse-card__stat-value {
    font-size: var(--text-lg);
    font-weight: 600;
}

/* ---- Order Card / Row ---- */
.inv-order-status {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 3px 10px;
    border-radius: var(--radius-full);
    font-size: var(--text-xs);
    font-weight: 600;
}

.inv-order-status--pending {
    background: rgba(245, 158, 11, 0.12);
    color: #F59E0B;
}

.inv-order-status--confirmed {
    background: rgba(59, 130, 246, 0.12);
    color: #3B82F6;
}

.inv-order-status--shipped {
    background: rgba(6, 182, 212, 0.12);
    color: #06B6D4;
}

.inv-order-status--delivered {
    background: rgba(16, 185, 129, 0.12);
    color: #10B981;
}

.inv-order-status--cancelled {
    background: rgba(107, 114, 128, 0.12);
    color: #6B7280;
}

/* ---- Form Grid ---- */
.inv-form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--space-md);
}

.inv-form-grid--full {
    grid-column: 1 / -1;
}

/* ---- Pagination ---- */
.inv-pagination {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-md) var(--space-lg);
    border-top: 1px solid var(--border-subtle);
    font-size: var(--text-sm);
    color: var(--text-secondary);
}

.inv-pagination__controls {
    display: flex;
    align-items: center;
    gap: var(--space-xs);
}

.inv-pagination__btn {
    padding: var(--space-xs) var(--space-sm);
    border-radius: var(--radius-sm);
    font-size: var(--text-sm);
    color: var(--text-secondary);
    background: transparent;
    border: 1px solid var(--border-subtle);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.inv-pagination__btn:hover:not(:disabled) {
    background: var(--bg-elevated);
    color: var(--text-primary);
}

.inv-pagination__btn:disabled {
    opacity: 0.4;
    cursor: default;
}

.inv-pagination__btn--active {
    background: var(--brand-purple);
    color: white;
    border-color: var(--brand-purple);
}

/* ---- Responsive ---- */
@media (max-width: 768px) {
    .inv-layout {
        flex-direction: column;
    }

    .inv-sidebar {
        width: 100%;
        border-right: none;
        border-bottom: 1px solid var(--border-subtle);
        padding: var(--space-md) 0;
    }

    .inv-form-grid {
        grid-template-columns: 1fr;
    }

    .inv-table-wrap {
        overflow-x: auto;
    }
}
