/* Shared Items and Inventory catalog layout */

:root {
    --items-bg: #131722;
    --items-header-bg: #0f0f0f;
    --items-panel-bg: #0f0f0f;
    --items-panel-border: #262b36;
    --items-panel-text: #f8fafc;
    --items-panel-muted: #94a3b8;
    --items-panel-soft: #aab6c6;
    --items-field-bg: #171b24;
    --items-field-border: #303746;
    --items-button-bg: #1f2937;
    --items-button-border: #3b4657;
    --items-button-text: #f8fafc;
    --items-hover-bg: #151a23;
    --items-hover-border: #526176;
    --items-accent: #846de7;
}

html.light-mode {
    --items-bg: #f5f6f8;
    --items-header-bg: #ffffff;
    --items-panel-bg: #ffffff;
    --items-panel-border: #dfe5ec;
    --items-panel-text: #18202b;
    --items-panel-muted: #647184;
    --items-panel-soft: #647184;
    --items-field-bg: #f8fafc;
    --items-field-border: #d8dee7;
    --items-button-bg: #e8eef5;
    --items-button-border: #cbd5e1;
    --items-button-text: #18202b;
    --items-hover-bg: #f3f6fb;
    --items-hover-border: #d0d9e5;
    --items-accent: #6f5de6;
}

.items-main {
    display: flex;
    flex-direction: column;
    gap: 14px;
    min-width: 0;
    min-height: 0;
    height: 100%;
    padding: 16px;
    overflow: auto;
    background: var(--items-bg);
    transition: background-color .18s ease;
}

.items-header {
    display: flex;
    flex-direction: column;
    gap: 10px;
    flex: 0 0 auto;
    padding: 14px;
    background: var(--items-header-bg);
    border: 1px solid var(--items-panel-border);
    border-radius: 8px;
    transition: background-color .18s ease, border-color .18s ease;
}

.items-header h2 {
    color: var(--items-panel-text);
    font-size: 18px;
    font-weight: 700;
}

.search-bar,
.catalog-import {
    display: flex;
    align-items: center;
    gap: 8px;
}

.search-bar {
    width: 100%;
}

.search-bar .search-input {
    min-width: 0;
}

.catalog-import-status {
    height: 13px;
    line-height: 13px;
}

.search-input {
    flex: 1;
    min-width: 0;
    height: 36px;
    padding: 0 12px;
    background: var(--items-field-bg);
    border: 1px solid var(--items-field-border);
    border-radius: 5px;
    color: var(--items-panel-text);
    font: inherit;
    font-size: 13px;
    transition: background-color .18s ease, border-color .18s ease, color .18s ease;
}

.search-input:focus {
    outline: 2px solid #667eea;
    outline-offset: -1px;
}

.search-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 36px;
    padding: 0 14px;
    background: var(--items-button-bg);
    border: 1px solid var(--items-button-border);
    border-radius: 5px;
    color: var(--items-button-text);
    cursor: pointer;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: .4px;
    text-transform: uppercase;
    white-space: nowrap;
    transition: background-color .18s ease, border-color .18s ease, color .18s ease;
}

.search-btn:hover { background: var(--items-hover-bg); }

.filter-info {
    height: 13px;
    line-height: 13px;
    color: var(--items-panel-muted);
    font-size: 11px;
    letter-spacing: .2px;
}

.items-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 12px;
    align-items: stretch;
}

.item-card {
    display: grid;
    grid-template-columns: 116px minmax(0, 1fr);
    grid-template-rows: auto auto;
    align-items: stretch;
    gap: 12px;
    min-width: 0;
    min-height: 140px;
    padding: 12px;
    background: var(--items-panel-bg);
    border: 1px solid var(--items-panel-border);
    border-radius: 8px;
    color: var(--items-panel-text);
    cursor: pointer;
    transition: border-color .15s ease, background .15s ease, transform .15s ease;
}

.item-card:hover {
    background: var(--items-hover-bg);
    border-color: var(--items-hover-border);
    transform: translateY(-1px);
}

.item-image {
    grid-column: 1;
    grid-row: 1;
    flex: 0 0 116px;
    width: 116px;
    height: 116px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    background: var(--items-field-bg);
    border: 1px solid var(--items-field-border);
    border-radius: 6px;
}

.item-image img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.image-placeholder {
    display: none;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    color: var(--items-panel-muted);
    background: var(--items-field-bg);
    font-size: 12px;
    font-weight: 700;
    letter-spacing: .5px;
}

.image-placeholder.show { display: flex; }

.item-content {
    display: flex;
    grid-column: 2;
    grid-row: 1 / span 2;
    flex: 1 1 auto;
    flex-direction: column;
    gap: 6px;
    min-width: 0;
    min-height: 116px;
}

.item-name {
    display: -webkit-box;
    overflow: hidden;
    color: var(--items-panel-text);
    font-size: 13px;
    font-weight: 700;
    line-height: 1.35;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
}

.item-sku {
    min-width: 0;
    overflow-wrap: anywhere;
    color: var(--items-panel-soft);
    font-size: 10px;
    line-height: 1.35;
}

.item-pricing {
    display: flex;
    flex-direction: column;
    gap: 3px;
    margin-top: 2px;
    padding-top: 7px;
    border-top: 1px solid var(--items-panel-border);
    transition: border-color .18s ease;
}

.price-row {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    color: var(--items-panel-text);
    font-size: 11px;
    line-height: 1.35;
}

.price-label {
    color: var(--items-panel-muted);
    font-size: 9px;
    font-weight: 600;
    letter-spacing: .4px;
    text-transform: uppercase;
}

.cost-price { color: var(--items-panel-soft); }
.sale-price,
.profit { color: #65e889; font-weight: 700; }

.inventory-action {
    align-self: flex-start;
    margin-top: auto;
    padding: 6px 9px;
    background: var(--items-button-bg);
    border: 1px solid var(--items-button-border);
    border-radius: 4px;
    color: var(--items-button-text);
    cursor: pointer;
    font-size: 10px;
    font-weight: 700;
}

.card-actions {
    grid-column: 1;
    grid-row: 2;
    display: flex;
    align-items: center;
    gap: 5px;
    width: max-content;
    max-width: 100%;
    padding-top: 8px;
}

.card-actions .inventory-action {
    flex: 0 0 auto;
    min-width: max-content;
    margin: 0;
    padding: 6px 8px;
    font-size: 9px;
    white-space: nowrap;
}

.inventory-action:hover,
.inventory-action:focus-visible,
.inventory-action:active {
    background: #846de7 !important;
    border-color: #846de7 !important;
    color: #fff !important;
}

.delete-action,
.delete-action:hover,
.delete-action:focus-visible,
.delete-action:active {
    background: #ef3b3a !important;
    border-color: #ef3b3a !important;
    color: #fff !important;
}

.inventory-action:focus-visible {
    outline: 2px solid #846de7;
    outline-offset: 2px;
}

.delete-action:focus-visible {
    outline-color: #ef3b3a;
}
.inventory-action:disabled { cursor: default; opacity: .65; }

.no-results {
    padding: 32px 16px;
    background: var(--items-panel-bg);
    border: 1px solid var(--items-panel-border);
    border-radius: 8px;
    color: var(--items-panel-muted);
    text-align: center;
} 

html.light-mode .items-main,
body.light-mode .items-main { background: #f5f6f8; }
html.light-mode .items-header,
html.light-mode .item-card,
html.light-mode .no-results,
body.light-mode .items-header,
body.light-mode .item-card,
body.light-mode .no-results {
    background: #fff;
    border-color: #dfe5ec;
    color: #18202b;
}
html.light-mode .items-header h2,
html.light-mode .item-name,
body.light-mode .items-header h2,
body.light-mode .item-name { color: #18202b; }
html.light-mode .search-input,
body.light-mode .search-input { background: #f8fafc; border-color: #d8dee7; color: #18202b; }
html.light-mode .search-btn,
html.light-mode .inventory-action,
body.light-mode .search-btn,
body.light-mode .inventory-action { background: #e8eef5; border-color: #cbd5e1; color: #18202b; }
html.light-mode .item-image,
html.light-mode .image-placeholder,
body.light-mode .item-image,
body.light-mode .image-placeholder { background: #eef2f6; border-color: #d8dee7; }
html.light-mode .item-pricing,
body.light-mode .item-pricing { border-color: #e1e5eb; }
html.light-mode .item-sku,
html.light-mode .price-label,
html.light-mode .filter-info,
body.light-mode .item-sku,
body.light-mode .price-label,
body.light-mode .filter-info { color: #647184; }
html.light-mode .cost-price,
body.light-mode .cost-price { color: #455468; }

@media (max-width: 700px) {
    .items-main { padding: 10px; }
    .items-grid { grid-template-columns: 1fr; }
    .search-bar { align-items: stretch; flex-direction: column; }
    .search-bar .search-btn { width: 100%; }
    .item-card { min-height: 160px; padding: 10px; grid-template-columns: 96px minmax(0, 1fr); }
    .item-image { flex-basis: 96px; width: 96px; height: 96px; }
    .card-actions { width: max-content; max-width: 100%; }
}
