/* object-palette.css - Styles for the object palette UI */

.object-palette-container {
    display: flex;
    flex-direction: column;
    height: 100%;
    background: var(--panel);
    border-radius: var(--radius);
    overflow: hidden;
}

.palette-header {
    border-bottom: 1px solid #232a39;
    background: var(--panel2);
}

/* Search Box */
.search-box {
    display: flex;
    align-items: center;
    padding: 10px;
    gap: 8px;
}

.search-input {
    flex: 1;
    padding: 8px 12px;
    background: var(--panel);
    border: 1px solid #232a39;
    border-radius: 8px;
    color: var(--ink);
    font-size: 14px;
    transition: all 0.2s ease;
}

.search-input:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(34, 211, 238, 0.1);
}

.search-input::placeholder {
    color: var(--muted);
}

.clear-search {
    width: 28px;
    height: 28px;
    padding: 0;
    background: transparent;
    border: 1px solid #232a39;
    border-radius: 6px;
    color: var(--muted);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.clear-search:hover {
    color: var(--ink);
    border-color: var(--accent);
    background: rgba(34, 211, 238, 0.1);
}

/* Category Tabs */
.category-tabs {
    display: flex;
    gap: 2px;
    padding: 0 10px 10px;
    overflow-x: auto;
    scrollbar-width: thin;
    scrollbar-color: #232a39 transparent;
}

.category-tabs::-webkit-scrollbar {
    height: 6px;
}

.category-tabs::-webkit-scrollbar-track {
    background: transparent;
}

.category-tabs::-webkit-scrollbar-thumb {
    background: #232a39;
    border-radius: 3px;
}

.category-tab {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    background: var(--panel);
    border: 1px solid #232a39;
    border-radius: 8px;
    color: var(--muted);
    font-size: 13px;
    white-space: nowrap;
    cursor: pointer;
    transition: all 0.2s ease;
}

.category-tab:hover {
    background: #1a1f2e;
    color: var(--ink);
    border-color: #2a3142;
}

.category-tab.active {
    background: linear-gradient(135deg, var(--accent), #3b82f6);
    color: white;
    border-color: transparent;
}

.tab-icon {
    font-size: 16px;
}

.tab-label {
    font-weight: 500;
}

/* Object Grid */
.palette-grid {
    flex: 1;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    gap: 10px;
    padding: 10px;
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: #232a39 transparent;
}

.palette-grid::-webkit-scrollbar {
    width: 6px;
}

.palette-grid::-webkit-scrollbar-track {
    background: transparent;
}

.palette-grid::-webkit-scrollbar-thumb {
    background: #232a39;
    border-radius: 3px;
}

/* Object Chip */
.object-chip {
    user-select: none;
    cursor: grab;
    border-radius: 12px;
    border: 1px solid #273043;
    background: linear-gradient(180deg, #202736, #121722);
    aspect-ratio: 1;
    position: relative;
    display: flex;
    flex-direction: column;
    transition: all 0.2s ease;
    overflow: hidden;
}

.object-chip:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    border-color: var(--accent);
}

.object-chip:active {
    cursor: grabbing;
    transform: scale(0.95);
}

.object-chip.dragging {
    opacity: 0.5;
}

.chip-thumbnail {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 8px;
    position: relative;
    overflow: hidden;
}

.chip-thumbnail img,
.chip-thumbnail canvas {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.chip-loading {
    font-size: 24px;
    color: var(--muted);
    animation: spin 1s linear infinite;
}

.chip-error {
    font-size: 24px;
    color: var(--error);
}

@keyframes spin {
    from {
        transform: rotate(0deg);
    }

    to {
        transform: rotate(360deg);
    }
}

.chip-info {
    padding: 8px;
    background: rgba(21, 25, 36, 0.8);
    border-top: 1px solid #232a39;
    backdrop-filter: blur(4px);
}

.chip-name {
    display: block;
    font-size: 12px;
    font-weight: 600;
    color: var(--ink);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-bottom: 2px;
}

.chip-category {
    display: block;
    font-size: 10px;
    font-weight: 500;
    opacity: 0.8;
}

/* No Results */
.no-results {
    grid-column: 1 / -1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px 20px;
    text-align: center;
    color: var(--muted);
}

.no-results-icon {
    font-size: 48px;
    margin-bottom: 16px;
    opacity: 0.5;
}

.no-results p {
    margin: 0;
    font-size: 14px;
}

/* Palette Status */
.palette-status {
    padding: 8px 12px;
    background: var(--panel2);
    border-top: 1px solid #232a39;
    font-size: 12px;
    color: var(--muted);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

#objectCount {
    font-weight: 500;
}

/* Responsive adjustments */
@media (max-width: 980px) {
    .palette-grid {
        grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
        gap: 8px;
    }

    .category-tab {
        padding: 6px 10px;
        font-size: 12px;
    }

    .tab-icon {
        font-size: 14px;
    }

    .tab-label {
        display: none;
    }

    .category-tab.active .tab-label {
        display: inline;
    }
}

/* put at the bottom of object-palette.css */
.object-chip {
    display: grid;
    grid-template-rows: 1fr auto;
    aspect-ratio: auto;
}

.chip-thumbnail {
    aspect-ratio: 1;
}

.chip-thumbnail img,
.chip-thumbnail canvas {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
}




.palette-grid {
    /* existing props ... */
    overflow-y: auto;
    /* you already have this */
    align-content: start;
    /* ⬅️ don't stretch rows to fill the column */
    align-items: start;
    /* ⬅️ don't stretch items either */
    grid-auto-rows: 150px;
    /* ⬅️ fixed “card” height; adjust to taste */
}

/* make each card fill the fixed grid row */
.object-chip {
    height: 100%;
    display: grid;
    grid-template-rows: 1fr auto;
    /* you already added these near the bottom of the file */
}

.chip-thumbnail {
    aspect-ratio: 1;
}

/* square preview area */
