/**
 * sketchfab-search.css
 * Modelixir Theme — AI Model Search section
 * Dark / Light mode via [data-theme="light"] on <body>
 * Purple accent (#c084fc) matching interior module
 */

/* ============================================
   AI MODEL SEARCH SECTION
   ============================================ */

.ai-search-section {
    margin-top: 10px;
    max-height: 70vh;
    overflow-y: auto;
    overflow-x: hidden;
    padding-right: 5px;
}

.ai-search-section::-webkit-scrollbar { width: 4px; }
.ai-search-section::-webkit-scrollbar-track { background: rgba(0,0,0,0.2); border-radius: 3px; }
.ai-search-section::-webkit-scrollbar-thumb { background: rgba(192,132,252,0.45); border-radius: 3px; }
.ai-search-section::-webkit-scrollbar-thumb:hover { background: rgba(192,132,252,0.75); }

[data-theme="light"] .ai-search-section::-webkit-scrollbar-thumb { background: rgba(168,85,247,0.35); }
[data-theme="light"] .ai-search-section::-webkit-scrollbar-thumb:hover { background: rgba(168,85,247,0.65); }

/* ============================================
   SEARCH BOX CONTAINER
   ============================================ */

.search-box-container {
    padding: 13px;
    background: rgba(192,132,252,0.06);
    border: 1px solid rgba(192,132,252,0.15);
    border-radius: 10px;
    margin-bottom: 12px;
    position: sticky;
    top: 0;
    z-index: 10;
    backdrop-filter: blur(8px);
}

[data-theme="light"] .search-box-container {
    background: rgba(192,132,252,0.07);
    border-color: rgba(168,85,247,0.18);
}

.search-input-group {
    display: flex;
    gap: 7px;
    margin-bottom: 9px;
}

#sketchfab-search-input {
    flex: 1;
    padding: 9px 11px;
    background: rgba(0,0,0,0.35);
    border: 1px solid rgba(255,255,255,0.10);
    border-radius: 7px;
    color: #e2e8f0;
    font-size: 12px;
    font-family: inherit;
    transition: all 0.3s ease;
    outline: none;
}

[data-theme="light"] #sketchfab-search-input {
    background: #ffffff;
    border-color: rgba(0,0,0,0.12);
    color: #1a1a2e;
}

#sketchfab-search-input:focus {
    border-color: #c084fc;
    box-shadow: 0 0 0 3px rgba(192,132,252,0.18);
}

[data-theme="light"] #sketchfab-search-input:focus {
    border-color: #a855f7;
    box-shadow: 0 0 0 3px rgba(168,85,247,0.15);
}

#sketchfab-search-input::placeholder { color: rgba(160,160,180,0.6); }
[data-theme="light"] #sketchfab-search-input::placeholder { color: rgba(100,100,120,0.5); }

#sketchfab-search-btn {
    padding: 9px 14px;
    background: linear-gradient(135deg, #c084fc 0%, #a855f7 100%);
    border: none;
    border-radius: 7px;
    color: white;
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s ease;
    white-space: nowrap;
    font-family: inherit;
    box-shadow: 0 2px 10px rgba(192,132,252,0.3);
}

#sketchfab-search-btn:hover {
    background: linear-gradient(135deg, #a855f7 0%, #7c3aed 100%);
    transform: translateY(-1px);
    box-shadow: 0 4px 14px rgba(192,132,252,0.45);
}

#sketchfab-search-btn:active { transform: translateY(0); }

#sketchfab-search-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

.search-tips {
    font-size: 10.5px;
    color: rgba(192,132,252,0.8);
    margin-top: 7px;
    padding: 7px 9px;
    background: rgba(192,132,252,0.07);
    border-radius: 5px;
    border-left: 2px solid rgba(192,132,252,0.5);
    line-height: 1.5;
}

[data-theme="light"] .search-tips {
    color: rgba(124,58,237,0.85);
    background: rgba(168,85,247,0.07);
    border-left-color: rgba(168,85,247,0.5);
}

.search-tips strong { color: #c084fc; font-weight: 700; }
[data-theme="light"] .search-tips strong { color: #7c3aed; }

/* ============================================
   LOADING INDICATOR
   ============================================ */

#sketchfab-loading {
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 28px;
    color: rgba(192,132,252,0.7);
}

#sketchfab-loading.active { display: flex; }

.search-spinner {
    width: 36px;
    height: 36px;
    border: 3px solid rgba(192,132,252,0.18);
    border-top-color: #c084fc;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

#sketchfab-loading p {
    margin-top: 11px;
    font-size: 12px;
    font-weight: 500;
}

/* ============================================
   RESULTS GRID
   ============================================ */

#sketchfab-results {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 6px;
    margin-bottom: 10px;
    padding-bottom: 6px;
}

/* ============================================
   THUMBNAIL CARDS
   ============================================ */

.sketchfab-thumbnail {
    background: rgba(192,132,252,0.05);
    border: 1px solid rgba(192,132,252,0.12);
    border-radius: 9px;
    overflow: hidden;
    cursor: pointer;
    transition: all 0.3s ease;
}

[data-theme="light"] .sketchfab-thumbnail {
    background: #ffffff;
    border-color: rgba(0,0,0,0.09);
    box-shadow: 0 1px 4px rgba(0,0,0,0.06);
}

.sketchfab-thumbnail:hover {
    transform: translateY(-3px);
    border-color: rgba(192,132,252,0.5);
    box-shadow: 0 6px 18px rgba(192,132,252,0.22);
}

[data-theme="light"] .sketchfab-thumbnail:hover {
    border-color: rgba(168,85,247,0.45);
    box-shadow: 0 6px 18px rgba(168,85,247,0.18);
}

.sketchfab-thumbnail.loading {
    opacity: 0.6;
    pointer-events: none;
}

.sketchfab-thumbnail.loading .thumbnail-image::after {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.6);
    display: flex;
    align-items: center;
    justify-content: center;
}

.thumbnail-image {
    position: relative;
    width: 100%;
    padding-top: 45%;
    background-size: cover;
    background-position: center;
    background-color: rgba(192,132,252,0.06);
}

[data-theme="light"] .thumbnail-image { background-color: rgba(168,85,247,0.05); }

.thumbnail-overlay {
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.72);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.sketchfab-thumbnail:hover .thumbnail-overlay { opacity: 1; }

.thumbnail-overlay span {
    color: white;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.6px;
}

.thumbnail-info { padding: 5px 7px 6px; }

.thumbnail-name {
    font-size: 11px;
    font-weight: 600;
    color: #e2e8f0;
    margin-bottom: 3px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

[data-theme="light"] .thumbnail-name { color: #1a1a2e; }

.thumbnail-author {
    font-size: 10px;
    color: rgba(192,132,252,0.7);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

[data-theme="light"] .thumbnail-author { color: rgba(124,58,237,0.65); }

/* ============================================
   REMAKE BUTTON
   ============================================ */

#sketchfab-remake-btn {
    display: none;
    width: 100%;
    padding: 9px;
    background: rgba(192,132,252,0.08);
    border: 1px solid rgba(192,132,252,0.35);
    border-radius: 7px;
    color: #c084fc;
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-bottom: 10px;
    font-family: inherit;
}

#sketchfab-remake-btn:hover {
    background: rgba(192,132,252,0.16);
    border-color: #c084fc;
    transform: translateY(-1px);
    box-shadow: 0 3px 10px rgba(192,132,252,0.25);
}

[data-theme="light"] #sketchfab-remake-btn {
    background: rgba(168,85,247,0.07);
    border-color: rgba(168,85,247,0.35);
    color: #7c3aed;
}

[data-theme="light"] #sketchfab-remake-btn:hover {
    background: rgba(168,85,247,0.14);
    border-color: #7c3aed;
}

#sketchfab-remake-btn:active { transform: translateY(0); }

/* ============================================
   SUCCESS NOTIFICATION
   ============================================ */

.sketchfab-success-notification {
    position: fixed;
    top: 80px;
    right: 20px;
    background: linear-gradient(135deg, #c084fc 0%, #a855f7 100%);
    color: white;
    padding: 11px 18px;
    border-radius: 9px;
    font-size: 12px;
    font-weight: 700;
    box-shadow: 0 4px 16px rgba(192,132,252,0.45);
    z-index: 10000;
    opacity: 0;
    transform: translateX(400px);
    transition: all 0.3s ease;
    font-family: inherit;
}

.sketchfab-success-notification.show {
    opacity: 1;
    transform: translateX(0);
}

/* ============================================
   EMPTY STATE
   ============================================ */

.search-empty-state {
    text-align: center;
    padding: 28px 16px;
    color: rgba(192,132,252,0.5);
}

[data-theme="light"] .search-empty-state { color: rgba(124,58,237,0.45); }

.search-empty-state svg {
    width: 54px;
    height: 54px;
    margin-bottom: 13px;
    opacity: 0.3;
}

.search-empty-state p {
    font-size: 12px;
    margin: 5px 0;
    font-weight: 500;
}

/* ============================================
   SECTION COLLAPSED STATE (functional — unchanged)
   ============================================ */

.tool-section[data-section="ai-search"]:not(.active) #sketchfab-results,
.tool-section[data-section="ai-search"]:not(.active) #sketchfab-remake-btn,
.tool-section[data-section="ai-search"]:not(.active) .search-box-container {
    display: none;
}

/* ============================================
   RESULTS SCROLLBAR
   ============================================ */

#sketchfab-results::-webkit-scrollbar { width: 4px; }
#sketchfab-results::-webkit-scrollbar-track { background: rgba(0,0,0,0.2); border-radius: 3px; }
#sketchfab-results::-webkit-scrollbar-thumb { background: rgba(192,132,252,0.4); border-radius: 3px; }
#sketchfab-results::-webkit-scrollbar-thumb:hover { background: rgba(192,132,252,0.7); }

/* ============================================
   LOADING ANIMATION FOR THUMBNAILS
   ============================================ */

@keyframes pulse {
    0%, 100% { opacity: 0.55; }
    50% { opacity: 1; }
}

.sketchfab-thumbnail.loading .thumbnail-image { animation: pulse 1.5s ease-in-out infinite; }
.sketchfab-thumbnail.loading .thumbnail-info { opacity: 0.45; }
