/* ========================================
   API Integration Styles
   Live Data Display Components
   ======================================== */

/* Trending Header */
.trending-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 2rem;
    border-radius: 12px;
    margin-bottom: 2rem;
    text-align: center;
}

.trending-header h3 {
    margin: 0 0 0.5rem 0;
    font-size: 1.75rem;
}

.trending-header p {
    margin: 0;
    opacity: 0.9;
    font-size: 0.95rem;
}

/* Enhanced Niche Cards with Live Data */
.niche-card.live-data {
    background: white;
    border-radius: 12px;
    padding: 1.5rem;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    transition: all 0.3s ease;
}

.niche-card.live-data:hover {
    box-shadow: 0 8px 16px rgba(0,0,0,0.15);
    transform: translateY(-4px);
}

.niche-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    padding-bottom: 1rem;
    border-bottom: 2px solid #f3f4f6;
}

.niche-header h4 {
    margin: 0;
    font-size: 1.1rem;
    color: #111827;
}

/* Trend Badges */
.trend-badge {
    padding: 0.35rem 0.75rem;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.trend-badge.trend-hot {
    background: linear-gradient(135deg, #f59e0b, #ef4444);
    color: white;
    animation: pulse 2s infinite;
}

.trend-badge.trend-rising {
    background: #10b981;
    color: white;
}

.trend-badge.trend-stable {
    background: #6b7280;
    color: white;
}

.trend-badge.trend-falling {
    background: #ef4444;
    color: white;
}

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

/* Niche Metrics */
.niche-metrics {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
    margin-bottom: 1rem;
}

.metric {
    display: flex;
    flex-direction: column;
}

.metric-label {
    font-size: 0.8rem;
    color: #6b7280;
    margin-bottom: 0.25rem;
}

.metric-value {
    font-size: 1.1rem;
    font-weight: 700;
    color: #111827;
}

.metric-value.positive {
    color: #10b981;
}

.metric-value.negative {
    color: #ef4444;
}

/* Niche Recommendation */
.niche-recommendation {
    padding: 0.75rem;
    border-radius: 8px;
    margin-bottom: 1rem;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.niche-recommendation.success {
    background: #d1fae5;
    color: #065f46;
}

.niche-recommendation.info {
    background: #dbeafe;
    color: #1e40af;
}

.niche-recommendation.warning {
    background: #fef3c7;
    color: #92400e;
}

.niche-recommendation.danger {
    background: #fee2e2;
    color: #991b1b;
}

/* Analysis Modal */
.analysis-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.3s ease;
}

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

.modal-content {
    position: relative;
    background: white;
    border-radius: 16px;
    max-width: 900px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    animation: slideUp 0.3s ease;
}

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

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

.modal-header {
    padding: 2rem;
    border-bottom: 2px solid #f3f4f6;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h2 {
    margin: 0;
    font-size: 1.75rem;
    color: #111827;
}

.modal-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    color: #6b7280;
    cursor: pointer;
    transition: color 0.2s;
}

.modal-close:hover {
    color: #ef4444;
}

.modal-body {
    padding: 2rem;
}

.analysis-keyword {
    text-align: center;
    font-size: 2rem;
    margin: 0 0 2rem 0;
    color: #111827;
    text-transform: capitalize;
}

/* Score Section */
.score-section {
    display: flex;
    align-items: center;
    gap: 2rem;
    padding: 2rem;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 12px;
    margin-bottom: 2rem;
    color: white;
}

.score-circle {
    width: 140px;
    height: 140px;
    border-radius: 50%;
    background: conic-gradient(#10b981 0deg, #e5e7eb 0deg);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    position: relative;
    transition: background 1s ease;
}

.score-circle::before {
    content: '';
    position: absolute;
    width: 110px;
    height: 110px;
    border-radius: 50%;
    background: white;
}

.score-value {
    position: relative;
    z-index: 1;
    font-size: 2.5rem;
    font-weight: 800;
    color: #111827;
}

.score-label {
    position: relative;
    z-index: 1;
    font-size: 0.7rem;
    font-weight: 600;
    text-align: center;
    line-height: 1.2;
    color: #6b7280;
}

.score-recommendation {
    flex: 1;
    font-size: 1.25rem;
    font-weight: 600;
}

/* Analysis Sections */
.analysis-section {
    margin-bottom: 2rem;
    padding: 1.5rem;
    background: #f9fafb;
    border-radius: 12px;
}

.analysis-section h4 {
    margin: 0 0 1rem 0;
    font-size: 1.25rem;
    color: #111827;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* Metrics Row */
.metrics-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 1rem;
}

.metric-card {
    background: white;
    padding: 1rem;
    border-radius: 8px;
    display: flex;
    align-items: center;
    gap: 1rem;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.metric-icon {
    font-size: 2rem;
}

.metric-icon.trend-hot { color: #ef4444; }
.metric-icon.trend-rising { color: #10b981; }
.metric-icon.trend-stable { color: #6b7280; }
.metric-icon.trend-falling { color: #ef4444; }

.metric-info {
    display: flex;
    flex-direction: column;
}

.metric-info .metric-value {
    font-size: 1.25rem;
    font-weight: 700;
    color: #111827;
}

.metric-info .metric-label {
    font-size: 0.8rem;
    color: #6b7280;
}

/* Competition Bar */
.competition-bar {
    margin-top: 1rem;
    padding: 1rem;
    background: white;
    border-radius: 8px;
    display: flex;
    align-items: center;
    gap: 1rem;
    font-weight: 600;
}

.competition-score {
    margin-left: auto;
    padding: 0.5rem 1rem;
    background: #f3f4f6;
    border-radius: 8px;
}

/* Profit Section */
.profit-section {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    color: white;
}

.profit-section h4 {
    color: white;
}

.profit-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
}

.profit-item {
    background: rgba(255, 255, 255, 0.15);
    padding: 1rem;
    border-radius: 8px;
    backdrop-filter: blur(10px);
}

.profit-item.highlight {
    background: rgba(255, 255, 255, 0.25);
    border: 2px solid rgba(255, 255, 255, 0.5);
}

.profit-label {
    display: block;
    font-size: 0.9rem;
    margin-bottom: 0.5rem;
    opacity: 0.9;
}

.profit-value {
    display: block;
    font-size: 1.5rem;
    font-weight: 800;
}

/* Competitors Table */
.competitors-table {
    overflow-x: auto;
}

.competitors-table table {
    width: 100%;
    background: white;
    border-radius: 8px;
    overflow: hidden;
}

.competitors-table th {
    background: #f3f4f6;
    padding: 0.75rem;
    text-align: left;
    font-weight: 600;
    color: #374151;
}

.competitors-table td {
    padding: 0.75rem;
    border-top: 1px solid #e5e7eb;
}

.competitors-table tr:hover {
    background: #f9fafb;
}

/* Recommendation Box */
.recommendation-box {
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
    color: white;
}

.recommendation-box h4 {
    color: white;
}

.recommendation-box p {
    margin: 0.5rem 0;
    line-height: 1.6;
}

.recommendation-box strong {
    color: #fef3c7;
}

/* Modal Footer */
.modal-footer {
    padding: 1.5rem 2rem;
    border-top: 2px solid #f3f4f6;
    display: flex;
    justify-content: flex-end;
    gap: 1rem;
}

/* Loading Spinner */
.loading-spinner {
    text-align: center;
    padding: 4rem 2rem;
}

.loading-spinner i {
    color: #667eea;
    margin-bottom: 1rem;
}

.loading-spinner p {
    color: #6b7280;
    font-size: 1.1rem;
}

/* Error Message */
.error-message {
    text-align: center;
    padding: 3rem 2rem;
}

.error-message i {
    font-size: 3rem;
    color: #ef4444;
    margin-bottom: 1rem;
}

.error-message p {
    color: #6b7280;
    font-size: 1.1rem;
    margin-bottom: 1.5rem;
}

/* Responsive */
@media (max-width: 768px) {
    .score-section {
        flex-direction: column;
        text-align: center;
    }
    
    .modal-content {
        width: 95%;
        max-height: 95vh;
    }
    
    .modal-body {
        padding: 1rem;
    }
    
    .metrics-row {
        grid-template-columns: 1fr;
    }
    
    .profit-grid {
        grid-template-columns: 1fr;
    }
}
