/**
 * Enhanced Widget Search Styles
 * Command Palette + Quick Preview
 */

/* ============================================
   COMMAND PALETTE
   ============================================ */
.widget-command-palette {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 10000;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding-top: 15vh;
    animation: fadeIn 0.15s ease;
}

.palette-backdrop {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
}

.palette-container {
    position: relative;
    width: 90%;
    max-width: 640px;
    background: #ffffff;
    border-radius: 12px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    overflow: hidden;
    animation: slideInDown 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Header */
.palette-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px 20px;
    border-bottom: 1px solid rgba(0, 0, 0, 0.08);
}

.palette-header input {
    flex: 1;
    border: none;
    outline: none;
    font-size: 16px;
    font-family: Inter, sans-serif;
    color: #1f2937;
    background: transparent;
}

.palette-header input::placeholder {
    color: #9ca3af;
}

.palette-close {
    display: flex;
    align-items: center;
    gap: 4px;
    color: #6b7280;
    font-size: 12px;
}

.palette-close kbd {
    padding: 2px 6px;
    background: #f3f4f6;
    border: 1px solid #d1d5db;
    border-radius: 4px;
    font-size: 11px;
    font-family: monospace;
    color: #6b7280;
}

/* Tabs */
.palette-tabs {
    display: flex;
    gap: 8px;
    padding: 12px 20px;
    border-bottom: 1px solid rgba(0, 0, 0, 0.08);
    background: #fafbfc;
}

.palette-tab {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    border: 1px solid transparent;
    border-radius: 6px;
    background: transparent;
    color: #6b7280;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s;
}

.palette-tab:hover {
    background: #ffffff;
    border-color: rgba(139, 92, 246, 0.2);
    color: #8B5CF6;
}

.palette-tab.active {
    background: #8B5CF6;
    color: #ffffff;
    border-color: #8B5CF6;
}

/* Results */
.palette-results {
    max-height: 400px;
    overflow-y: auto;
    padding: 8px;
}

.palette-results::-webkit-scrollbar {
    width: 8px;
}

.palette-results::-webkit-scrollbar-track {
    background: #f3f4f6;
}

.palette-results::-webkit-scrollbar-thumb {
    background: #d1d5db;
    border-radius: 4px;
}

.palette-results::-webkit-scrollbar-thumb:hover {
    background: #9ca3af;
}

/* Result Item */
.palette-result-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.15s;
    border: 1px solid transparent;
}

.palette-result-item:hover {
    background: rgba(139, 92, 246, 0.05);
    border-color: rgba(139, 92, 246, 0.2);
}

.palette-result-item.selected {
    background: rgba(139, 92, 246, 0.1);
    border-color: #8B5CF6;
}

.result-icon {
    flex-shrink: 0;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(139, 92, 246, 0.1);
    border-radius: 8px;
    color: #8B5CF6;
}

.result-info {
    flex: 1;
    min-width: 0;
}

.result-name {
    font-size: 14px;
    font-weight: 600;
    color: #1f2937;
    margin-bottom: 2px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.result-desc {
    font-size: 12px;
    color: #6b7280;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.result-badge-premium {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    padding: 2px 6px;
    background: linear-gradient(135deg, #fbbf24 0%, #f59e0b 100%);
    border-radius: 4px;
    font-size: 10px;
    font-weight: 600;
    color: #ffffff;
}

.result-meta {
    flex-shrink: 0;
    text-align: right;
}

.result-price {
    font-size: 13px;
    font-weight: 600;
    color: #8B5CF6;
}

.result-free {
    font-size: 13px;
    font-weight: 600;
    color: #10b981;
}

/* Empty State */
.palette-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 48px 20px;
    text-align: center;
}

.palette-empty p {
    margin-top: 12px;
    font-size: 14px;
    color: #6b7280;
}

/* Footer */
.palette-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 20px;
    border-top: 1px solid rgba(0, 0, 0, 0.08);
    background: #fafbfc;
}

.palette-shortcuts {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 12px;
    color: #6b7280;
}

.palette-shortcuts kbd {
    padding: 2px 6px;
    background: #ffffff;
    border: 1px solid #d1d5db;
    border-radius: 4px;
    font-size: 11px;
    font-family: monospace;
    color: #4b5563;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.palette-count {
    font-size: 12px;
    font-weight: 600;
    color: #8B5CF6;
}

/* ============================================
   QUICK PREVIEW MODAL
   ============================================ */
.widget-quick-preview {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 10001;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    animation: fadeIn 0.2s ease;
}

.preview-backdrop {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
}

.preview-card {
    position: relative;
    width: 100%;
    max-width: 480px;
    background: #ffffff;
    border-radius: 16px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    animation: scaleIn 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.preview-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 24px 24px 16px;
}

.preview-icon {
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(139, 92, 246, 0.1);
    border-radius: 12px;
}

.preview-close {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: 1px solid rgba(0, 0, 0, 0.1);
    border-radius: 8px;
    color: #6b7280;
    cursor: pointer;
    transition: all 0.15s;
}

.preview-close:hover {
    background: #f3f4f6;
    border-color: #d1d5db;
}

.preview-content {
    padding: 0 24px 24px;
}

.preview-title {
    font-size: 20px;
    font-weight: 700;
    color: #1f2937;
    margin-bottom: 8px;
}

.preview-desc {
    font-size: 14px;
    line-height: 1.6;
    color: #6b7280;
    margin-bottom: 16px;
}

.preview-meta {
    display: flex;
    align-items: center;
    gap: 12px;
}

.preview-category {
    padding: 6px 12px;
    background: rgba(139, 92, 246, 0.1);
    border-radius: 6px;
    font-size: 12px;
    font-weight: 600;
    color: #8B5CF6;
}

.preview-price {
    font-size: 16px;
    font-weight: 700;
    color: #8B5CF6;
}

.preview-free {
    font-size: 16px;
    font-weight: 700;
    color: #10b981;
}

.preview-actions {
    display: flex;
    gap: 12px;
    padding: 16px 24px;
    border-top: 1px solid rgba(0, 0, 0, 0.08);
}

.preview-btn-cancel,
.preview-btn-add {
    flex: 1;
    padding: 12px 20px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s;
}

.preview-btn-cancel {
    background: #ffffff;
    border: 1px solid #d1d5db;
    color: #6b7280;
}

.preview-btn-cancel:hover {
    background: #f3f4f6;
    border-color: #9ca3af;
}

.preview-btn-add {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    background: linear-gradient(135deg, #8B5CF6 0%, #7C3AED 100%);
    border: none;
    color: #ffffff;
}

.preview-btn-add:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(139, 92, 246, 0.3);
}

/* ============================================
   ANIMATIONS
   ============================================ */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

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

@keyframes scaleIn {
    from {
        opacity: 0;
        transform: scale(0.95);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

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

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

/* ============================================
   RESPONSIVE
   ============================================ */
@media (max-width: 768px) {
    .palette-container {
        width: 95%;
        max-width: none;
    }
    
    .palette-tabs {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    
    .palette-results {
        max-height: 50vh;
    }
    
    .preview-card {
        max-width: 100%;
    }
}
