/* Reset & base */
* {
    box-sizing: border-box;
}

body {
    margin: 0;
    background: #121212;
    color: #eee;
    font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
    height: 100vh;
    display: flex;
    overflow: hidden;
}

/* Sidebar (item list) */
#sidebar {
    width: 280px;
    background: #1e1e1e;
    display: flex;
    flex-direction: column;
    border-right: 1px solid #333;
}

#searchBar {
    padding: 12px 16px;
    border: none;
    outline: none;
    font-size: 1rem;
    background: #121212;
    color: #eee;
    border-bottom: 1px solid #333;
}

#itemList {
    flex-grow: 1;
    overflow-y: auto;
}

#itemList .list-item {
    padding: 12px 18px;
    cursor: pointer;
    border-bottom: 1px solid #2c2c2c;
    user-select: none;
}

#itemList .list-item:hover {
    background: #333;
}

#itemList .list-item.selected {
    background: #81a1c1;
    color: #121212;
    font-weight: 700;
}

#itemList .no-results {
    padding: 20px;
    color: #777;
    font-style: italic;
}

/* Detail panel */
#detailPanel {
    flex-grow: 1;
    background: #1c1c1c;
    padding: 24px;
    overflow-y: auto;
}

.item-detail {
    position: relative;
    background: #1e1e1e;
    border-radius: 12px;
    box-shadow: 0 0 15px #222;
    max-width: 700px;
    padding: 24px;
    margin: 0 auto;
}

.item-detail h2 {
    margin-top: 0;
    color: #81a1c1;
    font-size: 2em;
    font-weight: 700;
}

.item-detail .quantity {
    font-style: italic;
    color: #a3be8c;
    margin-bottom: 12px;
}

.item-detail .meta {
    color: #bbb;
    font-size: 0.95em;
    margin-bottom: 20px;
}

.item-detail .specs {
    display: flex;
    flex-wrap: wrap;
    gap: 14px;
    margin-bottom: 24px;
}

.item-detail .spec {
    background: #2a2a2a;
    padding: 12px 18px;
    border-radius: 8px;
    min-width: 140px;
    flex-grow: 1;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.item-detail .spec .label {
    font-weight: 600;
    color: #8fbcbb;
}

.item-detail .spec .value {
    margin-left: 6px;
    color: #d8dee9;
}

.item-detail .image-container {
    margin-bottom: 24px;
    text-align: center;
}

.item-detail .image-container img {
    max-width: 100%;
    max-height: 250px;
    border-radius: 12px;
    border: 1px solid #333;
    object-fit: contain;
}

.item-detail .subparts {
    border-left: 3px solid #444;
    margin-left: 20px;
    padding-left: 16px;
}

.item-detail .subparts>.item-detail {
    margin-bottom: 24px;
}

/* Buttons */
.btn {
    background: #81a1c1;
    color: #121212;
    border: none;
    padding: 8px 16px;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 700;
    margin-right: 12px;
    transition: background-color 0.25s ease;
}

.btn:hover {
    background: #5a7ca8;
}

.btn:disabled {
    background: #555;
    cursor: not-allowed;
}

.btn-group {
    margin-bottom: 20px;
}

/* Editable specs */
.spec input[type="text"],
.spec input[type="number"] {
    background: #333;
    border: none;
    border-radius: 6px;
    color: #eee;
    padding: 4px 8px;
    max-width: 90px;
    font-size: 1rem;
}

/* Add spec inputs inline */
#itemEditSpecDiv {
    background: #292929;
    border-radius: 8px;
    padding: 12px;
    display: flex;
    gap: 10px;
    align-items: center;
    /* max-width: 400px; */
}

#itemEditSpecDiv input[type="text"],
#itemEditSpecDiv input[type="number"] {
    flex-grow: 1;
    background: #333;
    border: none;
    border-radius: 6px;
    color: #eee;
    padding: 6px 10px;
    font-size: 1rem;
}

/* File input (custom look) */
.file-input {
    display: block;
    background: #2a2a2a;
    border: 1px solid #444;
    color: #eee;
    font-size: 1rem;
    border-radius: 8px;
    cursor: pointer;
    width: 50%;
    max-width: 400px;
    margin: 0 auto;
    text-align: center;
}

.file-input::file-selector-button {
    background: #81a1c1;
    color: #121212;
    border: none;
    padding: 8px 16px;
    border-radius: 6px;
    margin-right: 10px;
    cursor: pointer;
    font-weight: 600;
    transition: background-color 0.25s ease;
}

.file-input::file-selector-button:hover {
    background: #5a7ca8;
}

.image-preview-top-right {
    position: absolute;
    top: 16px;
    right: 16px;
    width: 100px;
    height: 100px;
    border-radius: 12px;
    overflow: hidden;
    border: 1px solid #444;
    background: #1e1e1e;
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.4);
    z-index: 10;
}

.image-preview-top-right img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.list-item.selected {
    background-color: lightblue;
}

.subpartInput {
    color: white;
    background: #292929;
    border-radius: 8px;
    padding: 12px;
    gap: 10px;
    align-items: center;
}

.subpart-toggle {
    display: flex;
    align-items: center;
    gap: 12px;
    font-weight: 600;
    color: #e0e0e0;
    cursor: pointer;
    user-select: none;
    margin-top: 16px;
}

#imageModalOverlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.85);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    flex-direction: column;
}

#imageModalContent {
    max-width: 90vw;
    max-height: 90vh;
    background: #1e1e1e;
    padding: 20px;
    border-radius: 12px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    align-items: center;
}

#imageModalMain {
    max-width: 100%;
    max-height: 60vh;
    border-radius: 8px;
    object-fit: contain;
    box-shadow: 0 0 15px rgba(0, 0, 0, 0.6);
}

#imageModalThumbnails {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    justify-content: center;
}

#imageModalThumbnails img {
    width: 60px;
    height: 60px;
    object-fit: cover;
    border-radius: 6px;
    cursor: pointer;
    border: 2px solid transparent;
    transition: border-color 0.2s;
}

#imageModalThumbnails img:hover {
    border-color: #81a1c1;
}

.thumb-wrapper input[type="checkbox"] {
  accent-color: limegreen;
}

#subpartFilterContainer {
  padding: 12px 16px;
  border-bottom: 1px solid #333;
  background: #1e1e1e;
  display: flex;
  flex-direction: column;
  gap: 6px;
  color: #ccc;
  font-size: 0.95rem;
}

#subpartFilter {
  padding: 8px;
  border-radius: 6px;
  background: #121212;
  color: #eee;
  border: 1px solid #333;
  font-size: 1rem;
}
