/**
 * AI Recommendations Page Styles
 * Part of V22.5.0 - Complete English-only unified system
 * Comprehensive styling for AI recommendations and intelligent insights
 */

/* ===== PAGE LAYOUT ===== */

.ai-recommendations-page,
.data-quality-page {
    padding: 20px;
    max-width: 1400px;
    margin: 0 auto;
}

.data-quality-page .page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 2px solid #e5e7eb;
}

.data-quality-page .header-content h2 {
    margin: 0 0 10px 0;
    color: #1f2937;
    font-size: 28px;
    display: flex;
    align-items: center;
    gap: 12px;
}

.data-quality-page .header-content p {
    margin: 0;
    color: #6b7280;
    font-size: 14px;
}

.data-quality-page .header-actions {
    display: flex;
    gap: 12px;
}

/* ===== QUALITY SCORE CARD ===== */

.quality-score-card {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 16px;
    padding: 30px;
    margin-bottom: 30px;
    color: white;
    display: flex;
    gap: 40px;
    align-items: center;
    box-shadow: 0 10px 40px rgba(102, 126, 234, 0.3);
}

.score-circle {
    width: 150px;
    height: 150px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.2);
    backdrop-filter: blur(10px);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    border: 6px solid var(--score-color, #10b981);
    flex-shrink: 0;
    position: relative;
}

.score-circle::before {
    content: '';
    position: absolute;
    inset: -10px;
    border-radius: 50%;
    background: radial-gradient(circle at center, var(--score-color, #10b981) 0%, transparent 70%);
    opacity: 0.3;
    z-index: -1;
}

.score-value {
    font-size: 48px;
    font-weight: 700;
    line-height: 1;
}

.score-grade {
    font-size: 24px;
    font-weight: 600;
    opacity: 0.9;
}

.score-details {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.score-info h3 {
    margin: 0 0 8px 0;
    font-size: 24px;
    font-weight: 600;
}

.score-info p {
    margin: 0 0 12px 0;
    font-size: 16px;
    opacity: 0.95;
}

.last-scan {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    opacity: 0.85;
}

.score-breakdown {
    display: flex;
    gap: 30px;
}

.issue-stat {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

.issue-stat i {
    font-size: 24px;
}

.issue-stat.critical i {
    color: #fecaca;
}

.issue-stat.warning i {
    color: #fde68a;
}

.issue-stat.info i {
    color: #bfdbfe;
}

.stat-value {
    font-size: 32px;
    font-weight: 700;
    line-height: 1;
}

.stat-label {
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    opacity: 0.9;
}

/* ===== QUALITY CONTENT ===== */

.quality-content {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 30px;
    margin-bottom: 30px;
}

/* ===== NO ISSUES STATE ===== */

.no-issues {
    grid-column: 1 / -1;
    text-align: center;
    padding: 60px 20px;
    background: linear-gradient(135deg, #d4fc79 0%, #96e6a1 100%);
    border-radius: 16px;
    color: #065f46;
}

.no-issues i {
    font-size: 64px;
    margin-bottom: 20px;
    display: block;
    color: #059669;
}

.no-issues h3 {
    margin: 0 0 10px 0;
    font-size: 24px;
}

.no-issues p {
    margin: 0;
    font-size: 16px;
    opacity: 0.9;
}

/* ===== ISSUES SUMMARY ===== */

.issues-summary {
    background: white;
    border-radius: 12px;
    padding: 24px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.issues-summary h3 {
    margin: 0 0 20px 0;
    font-size: 18px;
    color: #1f2937;
    display: flex;
    align-items: center;
    gap: 10px;
}

.category-grid {
    display: grid;
    gap: 16px;
}

.category-card {
    background: #f9fafb;
    border: 2px solid #e5e7eb;
    border-radius: 12px;
    padding: 16px;
    transition: all 0.2s ease;
}

.category-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.category-card.critical {
    border-color: #fca5a5;
    background: #fef2f2;
}

.category-card.warning {
    border-color: #fcd34d;
    background: #fffbeb;
}

.category-card.info {
    border-color: #93c5fd;
    background: #eff6ff;
}

.category-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 12px;
    font-weight: 600;
    color: #1f2937;
}

.category-header i {
    font-size: 20px;
}

.category-card.critical .category-header i {
    color: #dc2626;
}

.category-card.warning .category-header i {
    color: #d97706;
}

.category-card.info .category-header i {
    color: #2563eb;
}

.category-name {
    flex: 1;
}

.category-count {
    background: rgba(0, 0, 0, 0.1);
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 14px;
    font-weight: 600;
}

.category-issues {
    margin-bottom: 12px;
}

.mini-issue {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 0;
    font-size: 13px;
    color: #4b5563;
}

.mini-issue i {
    font-size: 8px;
}

.mini-issue .severity-critical {
    color: #dc2626;
}

.mini-issue .severity-warning {
    color: #d97706;
}

.mini-issue .severity-info {
    color: #2563eb;
}

.more-issues {
    padding: 6px 0;
    font-size: 12px;
    color: #6b7280;
    font-style: italic;
}

/* ===== DETAILED ISSUES ===== */

.detailed-issues {
    background: white;
    border-radius: 12px;
    padding: 24px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.detailed-issues h3 {
    margin: 0 0 20px 0;
    font-size: 18px;
    color: #1f2937;
    display: flex;
    align-items: center;
    gap: 10px;
}

.issues-list {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.severity-section {
    border-radius: 12px;
    overflow: hidden;
}

.severity-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    font-weight: 600;
}

.severity-section.critical .severity-header {
    background: #fef2f2;
    color: #991b1b;
}

.severity-section.warning .severity-header {
    background: #fffbeb;
    color: #92400e;
}

.severity-section.info .severity-header {
    background: #eff6ff;
    color: #1e40af;
}

.severity-header h4 {
    margin: 0;
    flex: 1;
    font-size: 14px;
    letter-spacing: 0.5px;
}

.severity-header .badge {
    background: rgba(0, 0, 0, 0.1);
    padding: 4px 10px;
    border-radius: 10px;
    font-size: 12px;
}

.severity-issues {
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 16px;
    background: #f9fafb;
}

/* ===== ISSUE CARDS ===== */

.issue-card {
    background: white;
    border: 2px solid #e5e7eb;
    border-radius: 12px;
    padding: 16px;
    transition: all 0.2s ease;
}

.issue-card:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

.issue-card.critical {
    border-left: 4px solid #dc2626;
}

.issue-card.warning {
    border-left: 4px solid #d97706;
}

.issue-card.info {
    border-left: 4px solid #2563eb;
}

.issue-header {
    display: flex;
    justify-content: space-between;
    align-items: start;
    margin-bottom: 12px;
}

.issue-title {
    display: flex;
    align-items: center;
    gap: 10px;
    color: #1f2937;
    font-size: 15px;
}

.issue-title i {
    color: #6b7280;
}

.issue-meta {
    display: flex;
    gap: 12px;
    font-size: 12px;
}

.issue-module {
    background: #f3f4f6;
    padding: 4px 10px;
    border-radius: 6px;
    color: #4b5563;
    font-weight: 500;
}

.issue-count {
    background: #fee2e2;
    padding: 4px 10px;
    border-radius: 6px;
    color: #991b1b;
    font-weight: 500;
}

.issue-description {
    color: #4b5563;
    font-size: 14px;
    line-height: 1.5;
    margin-bottom: 12px;
}

.issue-examples {
    background: #f9fafb;
    border-left: 3px solid #d1d5db;
    padding: 12px;
    margin-bottom: 12px;
    border-radius: 4px;
    font-size: 13px;
}

.issue-examples strong {
    display: block;
    margin-bottom: 8px;
    color: #1f2937;
}

.issue-examples ul {
    margin: 0;
    padding-left: 20px;
    color: #6b7280;
}

.issue-examples li {
    margin-bottom: 4px;
    font-family: 'Courier New', monospace;
}

.issue-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

/* ===== QUICK ACTIONS ===== */

.quality-actions {
    margin-top: 30px;
}

.quick-actions-section h3 {
    margin: 0 0 20px 0;
    font-size: 20px;
    color: #1f2937;
    display: flex;
    align-items: center;
    gap: 10px;
}

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

.action-card {
    background: white;
    border: 2px solid #e5e7eb;
    border-radius: 12px;
    padding: 20px;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
}

.action-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.1);
    border-color: #667eea;
}

.action-card i {
    font-size: 32px;
    color: #667eea;
}

.action-card strong {
    font-size: 16px;
    color: #1f2937;
}

.action-card span {
    font-size: 13px;
    color: #6b7280;
}

/* ===== BUTTONS ===== */

.btn {
    padding: 10px 20px;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.btn-secondary {
    background: #f3f4f6;
    color: #1f2937;
}

.btn-outline {
    background: white;
    color: #6b7280;
    border: 1px solid #d1d5db;
}

.btn-sm {
    padding: 6px 12px;
    font-size: 13px;
}

/* ===== SCANNING OVERLAY ===== */

#quality-scan-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    animation: fadeIn 0.2s ease;
}

.scan-spinner {
    background: white;
    padding: 40px 60px;
    border-radius: 16px;
    text-align: center;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

.scan-spinner i {
    font-size: 48px;
    color: #667eea;
    margin-bottom: 20px;
    display: block;
}

.scan-spinner p {
    margin: 0;
    font-size: 16px;
    color: #1f2937;
    font-weight: 600;
}

/* ===== TOAST NOTIFICATIONS ===== */

.toast {
    position: fixed;
    bottom: 30px;
    right: 30px;
    background: white;
    padding: 16px 24px;
    border-radius: 12px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
    display: flex;
    align-items: center;
    gap: 12px;
    z-index: 9999;
    opacity: 0;
    transform: translateY(20px);
    transition: all 0.3s ease;
    min-width: 300px;
}

.toast.show {
    opacity: 1;
    transform: translateY(0);
}

.toast i {
    font-size: 20px;
}

.toast-success {
    border-left: 4px solid #10b981;
}

.toast-success i {
    color: #10b981;
}

.toast-error {
    border-left: 4px solid #ef4444;
}

.toast-error i {
    color: #ef4444;
}

.toast-warning {
    border-left: 4px solid #f59e0b;
}

.toast-warning i {
    color: #f59e0b;
}

.toast-info {
    border-left: 4px solid #3b82f6;
}

.toast-info i {
    color: #3b82f6;
}

.toast span {
    flex: 1;
    color: #1f2937;
    font-size: 14px;
}

/* ===== ANIMATIONS ===== */

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

/* ===== RESPONSIVE DESIGN ===== */

@media (max-width: 1024px) {
    .quality-content {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    .data-quality-page .page-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 20px;
    }

    .data-quality-page .header-actions {
        width: 100%;
        justify-content: stretch;
    }

    .data-quality-page .header-actions .btn {
        flex: 1;
    }

    .quality-score-card {
        flex-direction: column;
        text-align: center;
    }

    .score-breakdown {
        justify-content: center;
    }

    .actions-grid {
        grid-template-columns: 1fr;
    }

    .issue-header {
        flex-direction: column;
        gap: 12px;
    }

    .issue-meta {
        justify-content: flex-start;
    }
}

@media (max-width: 480px) {
    .data-quality-page,
    .ai-recommendations-page {
        padding: 15px;
    }

    .quality-score-card,
    .insights-summary-card {
        padding: 20px;
    }

    .score-circle {
        width: 120px;
        height: 120px;
    }

    .score-value {
        font-size: 36px;
    }

    .score-grade {
        font-size: 20px;
    }

    .score-info h3 {
        font-size: 20px;
    }

    .stat-value {
        font-size: 24px;
    }
}

/* ===== AI RECOMMENDATIONS SPECIFIC STYLES ===== */

.insights-summary-card {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 16px;
    padding: 30px;
    margin-bottom: 30px;
    color: white;
    display: flex;
    gap: 30px;
    align-items: center;
    box-shadow: 0 10px 40px rgba(102, 126, 234, 0.3);
    flex-wrap: wrap;
}

.insight-stat {
    display: flex;
    align-items: center;
    gap: 15px;
    flex: 1;
    min-width: 200px;
}

.insight-stat i {
    font-size: 36px;
    opacity: 0.9;
}

.insight-stat.high-priority i {
    color: #fecaca;
}

.insight-stat.revenue i {
    color: #fde68a;
}

.insight-stat.actionable i {
    color: #bfdbfe;
}

.stat-content {
    display: flex;
    flex-direction: column;
}

.last-analysis {
    flex-basis: 100%;
    text-align: center;
    padding-top: 20px;
    border-top: 1px solid rgba(255, 255, 255, 0.2);
    font-size: 14px;
    opacity: 0.9;
}

.no-recommendations {
    grid-column: 1 / -1;
    text-align: center;
    padding: 60px 20px;
    background: linear-gradient(135deg, #d4fc79 0%, #96e6a1 100%);
    border-radius: 16px;
    color: #065f46;
}

.no-recommendations i {
    font-size: 64px;
    margin-bottom: 20px;
    display: block;
    color: #059669;
}

.recommendation-section {
    background: white;
    border-radius: 12px;
    padding: 24px;
    margin-bottom: 24px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.recommendation-section .section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 2px solid #e5e7eb;
}

.recommendation-section h3 {
    margin: 0;
    color: #1f2937;
    font-size: 20px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.recommendation-cards {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.recommendation-card {
    background: #f9fafb;
    border: 2px solid #e5e7eb;
    border-radius: 12px;
    padding: 20px;
    transition: all 0.2s ease;
}

.recommendation-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.recommendation-card.high {
    border-left: 4px solid #dc2626;
    background: #fef2f2;
}

.recommendation-card.medium {
    border-left: 4px solid #d97706;
    background: #fffbeb;
}

.recommendation-card.low {
    border-left: 4px solid #2563eb;
    background: #eff6ff;
}

.rec-header {
    display: flex;
    justify-content: space-between;
    align-items: start;
    margin-bottom: 12px;
}

.rec-title {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 16px;
    color: #1f2937;
}

.rec-title i {
    color: #667eea;
    font-size: 20px;
}

.rec-badges {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.priority-badge {
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.priority-badge.priority-high {
    background: #fee2e2;
    color: #991b1b;
}

.priority-badge.priority-medium {
    background: #fef3c7;
    color: #92400e;
}

.priority-badge.priority-low {
    background: #dbeafe;
    color: #1e40af;
}

.value-badge {
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 11px;
    font-weight: 600;
    background: #d1fae5;
    color: #065f46;
}

.rec-description {
    color: #4b5563;
    font-size: 14px;
    line-height: 1.6;
    margin-bottom: 12px;
}

.rec-insights {
    background: white;
    border-left: 3px solid #667eea;
    padding: 12px;
    margin-bottom: 12px;
    border-radius: 4px;
    font-size: 13px;
}

.rec-insights strong {
    display: block;
    margin-bottom: 8px;
    color: #1f2937;
}

.rec-insights ul {
    margin: 0;
    padding-left: 20px;
    color: #6b7280;
}

.rec-insights li {
    margin-bottom: 4px;
}

.rec-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.rec-confidence {
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid #e5e7eb;
}

.confidence-bar {
    height: 6px;
    background: #e5e7eb;
    border-radius: 3px;
    overflow: hidden;
    margin-bottom: 6px;
}

.confidence-fill {
    height: 100%;
    background: linear-gradient(90deg, #667eea 0%, #764ba2 100%);
    border-radius: 3px;
    transition: width 0.3s ease;
}

.confidence-label {
    font-size: 12px;
    color: #6b7280;
}

/* ===== ANALYZING OVERLAY ===== */

#ai-analyzing-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    animation: fadeIn 0.2s ease;
}

.analyzing-spinner {
    background: white;
    padding: 40px 60px;
    border-radius: 16px;
    text-align: center;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

.analyzing-spinner i {
    font-size: 48px;
    color: #667eea;
    margin-bottom: 20px;
    display: block;
}

.analyzing-spinner p {
    margin: 0;
    font-size: 16px;
    color: #1f2937;
    font-weight: 600;
}
