/* Shared Items and Inventory catalog layout */

.items-main {
    display: flex;
    flex-direction: column;
    gap: 14px;
    min-width: 0;
    min-height: 0;
    height: 100%;
    padding: 16px;
    overflow: auto;
    background: #131722;
}

.items-header {
    display: flex;
    flex-direction: column;
    gap: 10px;
    flex: 0 0 auto;
    padding: 14px;
    background: #0f0f0f;
    border: 1px solid #262b36;
    border-radius: 8px;
}

.items-header h2 {
    color: #f8fafc;
    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: #171b24;
    border: 1px solid #303746;
    border-radius: 5px;
    color: #f8fafc;
    font: inherit;
    font-size: 13px;
}

.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: #1f2937;
    border: 1px solid #3b4657;
    border-radius: 5px;
    color: #f8fafc;
    cursor: pointer;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: .4px;
    text-transform: uppercase;
    white-space: nowrap;
}

.search-btn:hover { background: #334155; }

.filter-info {
    height: 13px;
    line-height: 13px;
    color: #94a3b8;
    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: #0f0f0f;
    border: 1px solid #262b36;
    border-radius: 8px;
    color: #f8fafc;
    cursor: pointer;
    transition: border-color .15s ease, background .15s ease, transform .15s ease;
}

.item-card:hover {
    background: #151a23;
    border-color: #526176;
    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: #171b24;
    border: 1px solid #303746;
    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: #64748b;
    background: #171b24;
    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: #f8fafc;
    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: #aab6c6;
    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 #262b36;
}

.price-row {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    color: #cbd5e1;
    font-size: 11px;
    line-height: 1.35;
}

.price-label {
    color: #94a3b8;
    font-size: 9px;
    font-weight: 600;
    letter-spacing: .4px;
    text-transform: uppercase;
}

.cost-price { color: #cbd5e1; }
.sale-price,
.profit { color: #65e889; font-weight: 700; }

.inventory-action {
    align-self: flex-start;
    margin-top: auto;
    padding: 6px 9px;
    background: #1e293b;
    border: 1px solid #475569;
    border-radius: 4px;
    color: #f8fafc;
    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: #0f0f0f;
    border: 1px solid #262b36;
    border-radius: 8px;
    color: #94a3b8;
    text-align: center;
}

body.light-mode .items-main { background: #f5f6f8; }
body.light-mode .items-header,
body.light-mode .item-card,
body.light-mode .no-results {
    background: #fff;
    border-color: #dfe5ec;
    color: #18202b;
}
body.light-mode .items-header h2,
body.light-mode .item-name { color: #18202b; }
body.light-mode .search-input { background: #f8fafc; border-color: #d8dee7; color: #18202b; }
body.light-mode .search-btn,
body.light-mode .inventory-action { background: #e8eef5; border-color: #cbd5e1; color: #18202b; }
body.light-mode .item-image,
body.light-mode .image-placeholder { background: #eef2f6; border-color: #d8dee7; }
body.light-mode .item-pricing { border-color: #e1e5eb; }
body.light-mode .item-sku,
body.light-mode .price-label,
body.light-mode .filter-info { color: #647184; }
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%; }
}
