/* Multi-KI IX Search Engine Styles */
/* Neon-themed overlay matching MusicChain aesthetic */

/* Main Overlay */
.ki-search-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(10px);
    z-index: 10000;
    display: none;
    animation: kiFadeIn 0.2s ease-out;
}

.ki-search-overlay.ki-search-open {
    display: flex;
    align-items: center;
    justify-content: center;
}

@keyframes kiFadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* Search Modal */
.ki-search-modal {
    background: linear-gradient(135deg, #0a0a0a 0%, #1a1a1a 100%);
    border: 1px solid #333;
    border-radius: 12px;
    width: 90%;
    max-width: 800px;
    max-height: 80vh;
    overflow: hidden;
    box-shadow: 
        0 0 40px rgba(0, 255, 136, 0.3),
        0 0 80px rgba(0, 255, 136, 0.1),
        inset 0 0 20px rgba(0, 255, 136, 0.05);
    animation: kiSlideUp 0.3s ease-out;
}

@keyframes kiSlideUp {
    from { 
        opacity: 0;
        transform: translateY(20px);
    }
    to { 
        opacity: 1;
        transform: translateY(0);
    }
}

/* Header */
.ki-search-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 24px;
    border-bottom: 1px solid #333;
    background: linear-gradient(90deg, rgba(0, 255, 136, 0.1) 0%, transparent 100%);
}

.ki-search-title {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 18px;
    font-weight: 600;
    color: #00ff88;
    text-shadow: 0 0 10px rgba(0, 255, 136, 0.5);
}

.ki-search-icon {
    font-size: 20px;
}

.ki-search-close {
    background: none;
    border: none;
    color: #888;
    font-size: 24px;
    cursor: pointer;
    padding: 4px;
    border-radius: 4px;
    transition: all 0.2s;
}

.ki-search-close:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
}

/* Body */
.ki-search-body {
    padding: 20px 24px;
    max-height: calc(80vh - 80px);
    overflow-y: auto;
}

/* Search Input */
.ki-search-input {
    width: 100%;
    padding: 16px 20px;
    background: #111;
    border: 2px solid #333;
    border-radius: 8px;
    color: #fff;
    font-size: 16px;
    outline: none;
    transition: all 0.3s;
    box-shadow: inset 0 2px 8px rgba(0, 0, 0, 0.5);
}

.ki-search-input:focus {
    border-color: #00ff88;
    box-shadow: 
        0 0 20px rgba(0, 255, 136, 0.3),
        inset 0 2px 8px rgba(0, 0, 0, 0.5);
}

.ki-search-input::placeholder {
    color: #666;
}

/* Filter Buttons */
.ki-search-filters {
    display: flex;
    gap: 8px;
    margin: 16px 0;
    flex-wrap: wrap;
}

.ki-filter-btn {
    padding: 8px 16px;
    background: #111;
    border: 1px solid #333;
    border-radius: 20px;
    color: #888;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.2s;
    text-transform: uppercase;
    font-weight: 500;
}

.ki-filter-btn:hover {
    background: #222;
    border-color: #555;
    color: #aaa;
}

.ki-filter-btn.active {
    background: linear-gradient(135deg, #00ff88 0%, #00cc6a 100%);
    border-color: #00ff88;
    color: #000;
    font-weight: 600;
    box-shadow: 0 0 15px rgba(0, 255, 136, 0.4);
}

/* Results Container */
.ki-search-results {
    margin-top: 16px;
}

/* Loading/Error/Empty States */
.ki-search-loading,
.ki-search-error,
.ki-search-empty {
    text-align: center;
    padding: 40px 20px;
    color: #666;
    font-size: 14px;
}

.ki-search-error {
    color: #ff4444;
}

/* Result Groups */
.ki-search-group {
    margin-bottom: 24px;
    border-radius: 8px;
    overflow: hidden;
    background: rgba(255, 255, 255, 0.02);
}

.ki-search-group-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    background: rgba(255, 255, 255, 0.05);
    font-weight: 600;
    color: #fff;
    font-size: 14px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.ki-search-group-icon {
    font-size: 16px;
}

.ki-search-group-name {
    flex: 1;
}

.ki-search-group-count {
    background: rgba(255, 255, 255, 0.1);
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 11px;
    color: #aaa;
}

/* Result Items */
.ki-search-group-items {
    padding: 8px 0;
}

.ki-search-item {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    padding: 12px 16px;
    cursor: pointer;
    transition: all 0.2s;
    border-left: 2px solid transparent;
}

.ki-search-item:hover {
    background: rgba(0, 255, 136, 0.1);
    border-left-color: #00ff88;
}

.ki-search-item-main {
    flex: 1;
    min-width: 0;
}

.ki-search-item-title {
    font-weight: 600;
    color: #fff;
    font-size: 14px;
    margin-bottom: 4px;
    line-height: 1.3;
}

.ki-search-item-subtitle {
    color: #aaa;
    font-size: 12px;
    margin-bottom: 2px;
}

.ki-search-item-description {
    color: #666;
    font-size: 11px;
    line-height: 1.4;
}

/* IX Data Display */
.ki-search-ix-data {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 4px;
    margin-left: 12px;
    font-size: 10px;
    font-weight: 600;
    text-align: right;
}

/* Tier Badges */
.ki-tier {
    padding: 2px 6px;
    border-radius: 10px;
    text-transform: uppercase;
    font-weight: 700;
    font-size: 9px;
    letter-spacing: 0.5px;
}

.ki-tier-iron {
    background: linear-gradient(135deg, #666 0%, #444 100%);
    color: #ccc;
    box-shadow: 0 0 8px rgba(102, 102, 102, 0.3);
}

.ki-tier-silver {
    background: linear-gradient(135deg, #c0c0c0 0%, #999 100%);
    color: #333;
    box-shadow: 0 0 8px rgba(192, 192, 192, 0.3);
}

.ki-tier-gold {
    background: linear-gradient(135deg, #ffd700 0%, #ffb300 100%);
    color: #333;
    box-shadow: 0 0 8px rgba(255, 215, 0, 0.3);
}

.ki-tier-diamond {
    background: linear-gradient(135deg, #00ffff 0%, #00cccc 100%);
    color: #000;
    box-shadow: 0 0 12px rgba(0, 255, 255, 0.5);
}

/* Resource Values */
.ki-mccc,
.ki-fuel,
.ki-gas {
    padding: 2px 4px;
    border-radius: 4px;
    font-family: 'Courier New', monospace;
    white-space: nowrap;
}

.ki-mccc {
    background: rgba(0, 255, 136, 0.2);
    color: #00ff88;
    border: 1px solid rgba(0, 255, 136, 0.3);
}

.ki-fuel {
    background: rgba(255, 170, 0, 0.2);
    color: #ffaa00;
    border: 1px solid rgba(255, 170, 0, 0.3);
}

.ki-gas {
    background: rgba(0, 170, 255, 0.2);
    color: #00aaff;
    border: 1px solid rgba(0, 170, 255, 0.3);
}

/* Scrollbar Styling */
.ki-search-body::-webkit-scrollbar {
    width: 8px;
}

.ki-search-body::-webkit-scrollbar-track {
    background: #111;
}

.ki-search-body::-webkit-scrollbar-thumb {
    background: #333;
    border-radius: 4px;
}

.ki-search-body::-webkit-scrollbar-thumb:hover {
    background: #555;
}

/* Search Help Section */
.ki-search-help {
    background: rgba(0, 255, 136, 0.1);
    border: 1px solid rgba(0, 255, 136, 0.3);
    border-radius: 6px;
    padding: 12px;
    margin-bottom: 16px;
    font-size: 11px;
    font-family: 'Courier New', monospace;
}

.ki-search-help code {
    color: #00ff88;
    background: rgba(0, 0, 0, 0.3);
    padding: 2px 4px;
    border-radius: 3px;
}

/* Risk Indicators */
.ki-search-risk-indicator {
    margin-left: 8px;
    font-size: 14px;
    animation: kiPulse 2s infinite;
}

@keyframes kiPulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.6; }
}

/* Risk Flags */
.ki-search-flags {
    margin-top: 6px;
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
}

.ki-flag {
    background: rgba(255, 68, 68, 0.2);
    border: 1px solid #ff4444;
    color: #ff6666;
    padding: 2px 6px;
    border-radius: 10px;
    font-size: 9px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Heat Score Display */
.ki-heat-score {
    background: linear-gradient(135deg, rgba(255, 100, 0, 0.3) 0%, rgba(255, 50, 0, 0.1) 100%);
    border: 1px solid rgba(255, 100, 0, 0.5);
    color: #ff6400;
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 10px;
    font-weight: 700;
    margin-top: 4px;
    text-shadow: 0 0 8px rgba(255, 100, 0, 0.4);
}

/* Risk Score Display */
.ki-risk-score {
    background: linear-gradient(135deg, rgba(255, 170, 0, 0.3) 0%, rgba(255, 170, 0, 0.1) 100%);
    border: 1px solid rgba(255, 170, 0, 0.5);
    color: #ffaa00;
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 10px;
    font-weight: 700;
    margin-top: 4px;
    text-shadow: 0 0 8px rgba(255, 170, 0, 0.4);
}

/* Enhanced IX Data Display */
.ki-search-ix-data {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 6px;
    margin-left: 12px;
    font-size: 10px;
    font-weight: 600;
    text-align: right;
    min-width: 120px;
}

/* Enhanced Result Items */
.ki-search-item-title {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-weight: 600;
    color: #fff;
    font-size: 14px;
    margin-bottom: 4px;
    line-height: 1.3;
}

/* Loading State Enhancement */
.ki-search-loading {
    text-align: center;
    padding: 40px 20px;
    color: #00ff88;
    font-size: 14px;
    animation: kiGlow 1.5s ease-in-out infinite alternate;
}

/* Error State Enhancement */
.ki-search-error {
    text-align: center;
    padding: 40px 20px;
    color: #ff4444;
    font-size: 14px;
    background: rgba(255, 68, 68, 0.1);
    border: 1px solid rgba(255, 68, 68, 0.3);
    border-radius: 8px;
    margin: 20px 0;
}

/* Empty State Enhancement */
.ki-search-empty {
    text-align: center;
    padding: 40px 20px;
    color: #666;
    font-size: 14px;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    margin: 20px 0;
}

/* Performance Optimizations */
.ki-search-group-items {
    max-height: 400px;
    overflow-y: auto;
}

.ki-search-group-items::-webkit-scrollbar {
    width: 6px;
}

.ki-search-group-items::-webkit-scrollbar-track {
    background: #111;
}

.ki-search-group-items::-webkit-scrollbar-thumb {
    background: #333;
    border-radius: 3px;
}

.ki-search-group-items::-webkit-scrollbar-thumb:hover {
    background: #555;
}

/* Mobile Responsiveness for v2 */
@media (max-width: 768px) {
    .ki-search-help {
        font-size: 10px;
        padding: 8px;
    }
    
    .ki-search-ix-data {
        min-width: 100px;
        gap: 4px;
    }
    
    .ki-flag {
        font-size: 8px;
        padding: 1px 4px;
    }
    
    .ki-heat-score,
    .ki-risk-score {
        font-size: 9px;
        padding: 3px 6px;
    }
}

/* Glow Effects */
.ki-search-modal {
    animation: kiGlow 3s ease-in-out infinite alternate;
}

@keyframes kiGlow {
    from {
        box-shadow: 
            0 0 40px rgba(0, 255, 136, 0.3),
            0 0 80px rgba(0, 255, 136, 0.1),
            inset 0 0 20px rgba(0, 255, 136, 0.05);
    }
    to {
        box-shadow: 
            0 0 60px rgba(0, 255, 136, 0.4),
            0 0 100px rgba(0, 255, 136, 0.15),
            inset 0 0 30px rgba(0, 255, 136, 0.08);
    }
}
