/**
 * 🎯 CSS pour l'Optimisation de Contenu Intelligente
 * Phase 1 du SaaS GSC Avancé
 */

/* ========== LAYOUT GÉNÉRAL ========== */

.optimization-section {
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
    border-radius: 12px;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.optimization-section h3 {
    color: #fff;
    font-size: 1.25rem;
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* ========== STATISTIQUES ========== */

.optimization-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.opt-stat {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 10px;
    padding: 1rem;
    text-align: center;
    border: 1px solid rgba(255, 255, 255, 0.1);
    transition: all 0.3s ease;
}

.opt-stat:hover {
    transform: translateY(-2px);
    border-color: rgba(66, 133, 244, 0.5);
}

.opt-stat-value {
    font-size: 1.75rem;
    font-weight: 700;
    color: #fff;
}

.opt-stat-label {
    font-size: 0.8rem;
    color: rgba(255, 255, 255, 0.6);
    margin-top: 0.25rem;
}

.opt-stat.critical .opt-stat-value {
    color: #EA4335;
}

.opt-stat.warning .opt-stat-value {
    color: #FBBC05;
}

.opt-stat.success .opt-stat-value {
    color: #34A853;
}

/* ========== TABLEAUX ========== */

.optimization-table-container {
    overflow-x: auto;
    border-radius: 8px;
    background: rgba(0, 0, 0, 0.2);
}

.optimization-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
}

.optimization-table th,
.optimization-table td {
    padding: 0.75rem;
    text-align: left;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.optimization-table th {
    background: rgba(66, 133, 244, 0.2);
    color: #fff;
    font-weight: 600;
    position: sticky;
    top: 0;
    z-index: 10;
}

.optimization-table tr:hover {
    background: rgba(255, 255, 255, 0.05);
}

.optimization-table td {
    color: rgba(255, 255, 255, 0.85);
}

/* ========== CANNIBALISATION ========== */

.query-cell {
    max-width: 200px;
}

.query-cell strong {
    display: block;
    color: #fff;
    margin-bottom: 0.25rem;
}

.impressions-small {
    font-size: 0.75rem;
    color: rgba(255, 255, 255, 0.5);
}

.urls-list {
    max-width: 300px;
}

.url-item {
    padding: 0.25rem 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.url-item:last-child {
    border-bottom: none;
}

.url-text {
    display: block;
    font-size: 0.8rem;
    color: #4285F4;
    word-break: break-all;
}

.url-metrics {
    font-size: 0.7rem;
    color: rgba(255, 255, 255, 0.5);
}

.position-spread {
    white-space: nowrap;
}

.spread-diff {
    color: #FBBC05;
    font-size: 0.8rem;
    margin-left: 0.25rem;
}

.score-bar {
    width: 60px;
    height: 4px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 2px;
    margin-top: 0.25rem;
}

.score-fill {
    height: 100%;
    border-radius: 2px;
    transition: width 0.3s ease;
}

.action-cell {
    font-size: 0.8rem;
    color: rgba(255, 255, 255, 0.7);
    max-width: 250px;
}

/* ========== CONTENT DECAY ========== */

.current-metrics .clicks {
    display: block;
    font-size: 1rem;
    font-weight: 600;
    color: #fff;
}

.current-metrics .impressions {
    font-size: 0.75rem;
    color: rgba(255, 255, 255, 0.5);
}

td.negative {
    color: #EA4335;
    font-weight: 600;
}

td.positive {
    color: #34A853;
    font-weight: 600;
}

.sparkline-svg {
    display: block;
    margin-top: 0.25rem;
}

.recommendation-cell {
    max-width: 300px;
}

.recommendation {
    color: #4285F4;
    font-weight: 500;
    margin-bottom: 0.5rem;
}

.suggestions-list {
    margin: 0;
    padding-left: 1rem;
    font-size: 0.75rem;
    color: rgba(255, 255, 255, 0.6);
}

.suggestions-list li {
    margin-bottom: 0.25rem;
}

.page-link {
    color: #4285F4;
    text-decoration: none;
}

.page-link:hover {
    text-decoration: underline;
}

/* ========== CTR OPPORTUNITIES ========== */

.ctr-opportunities-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.ctr-opportunity-card {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    padding: 1.25rem;
    transition: all 0.3s ease;
}

.ctr-opportunity-card:hover {
    border-color: rgba(66, 133, 244, 0.5);
    transform: translateX(4px);
}

.opp-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 0.75rem;
}

.opp-rank {
    font-size: 1rem;
    font-weight: 700;
    color: rgba(255, 255, 255, 0.4);
}

.opp-potential {
    margin-left: auto;
    font-size: 0.85rem;
    font-weight: 600;
    color: #34A853;
}

.opp-url {
    margin-bottom: 0.75rem;
}

.opp-url a {
    color: #4285F4;
    text-decoration: none;
    font-size: 0.9rem;
}

.opp-url a:hover {
    text-decoration: underline;
}

.opp-metrics {
    display: flex;
    gap: 1.5rem;
    flex-wrap: wrap;
    margin-bottom: 1rem;
    padding: 0.75rem;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 6px;
}

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

.metric-label {
    font-size: 0.7rem;
    color: rgba(255, 255, 255, 0.5);
    text-transform: uppercase;
}

.metric-value {
    font-size: 1rem;
    font-weight: 600;
    color: #fff;
}

.metric-value.ctr-current {
    color: #EA4335;
}

.metric-value.ctr-expected {
    color: #34A853;
}

.metric-value.ctr-gap {
    color: #FBBC05;
}

.opp-keyword {
    font-size: 0.85rem;
    color: rgba(255, 255, 255, 0.7);
    margin-bottom: 1rem;
    padding: 0.5rem;
    background: rgba(66, 133, 244, 0.1);
    border-radius: 4px;
}

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

.suggestions-section h4 {
    font-size: 0.85rem;
    color: #fff;
    margin-bottom: 0.75rem;
}

.title-suggestions,
.meta-suggestions {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.title-suggestion,
.meta-suggestion {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 6px;
    padding: 0.75rem;
    border-left: 3px solid transparent;
}

.title-suggestion.optimal,
.meta-suggestion.optimal {
    border-left-color: #34A853;
}

.title-suggestion.trop_long,
.meta-suggestion.trop_long {
    border-left-color: #EA4335;
}

.title-suggestion.court,
.meta-suggestion.court {
    border-left-color: #FBBC05;
}

.title-text,
.meta-text {
    display: block;
    font-size: 0.85rem;
    color: rgba(255, 255, 255, 0.9);
    margin-bottom: 0.5rem;
    line-height: 1.4;
}

.title-meta,
.meta-info {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    align-items: center;
}

.char-count {
    font-size: 0.7rem;
    padding: 2px 6px;
    border-radius: 3px;
    background: rgba(255, 255, 255, 0.1);
    color: rgba(255, 255, 255, 0.6);
}

.char-count.optimal {
    background: rgba(52, 168, 83, 0.2);
    color: #34A853;
}

.char-count.trop_long {
    background: rgba(234, 67, 53, 0.2);
    color: #EA4335;
}

.char-count.court {
    background: rgba(251, 188, 5, 0.2);
    color: #FBBC05;
}

.badge {
    font-size: 0.65rem;
    padding: 2px 6px;
    border-radius: 3px;
    text-transform: uppercase;
}

.badge.power {
    background: rgba(156, 39, 176, 0.2);
    color: #BA68C8;
}

.badge.number {
    background: rgba(66, 133, 244, 0.2);
    color: #4285F4;
}

.badge.year {
    background: rgba(52, 168, 83, 0.2);
    color: #34A853;
}

.badge.cta {
    background: rgba(251, 188, 5, 0.2);
    color: #FBBC05;
}

.badge.emoji {
    background: rgba(234, 67, 53, 0.2);
    color: #EA4335;
}

/* ========== SEARCH INTENT ========== */

.intent-distribution {
    margin-bottom: 1.5rem;
}

.intent-distribution h4 {
    color: #fff;
    font-size: 1rem;
    margin-bottom: 1rem;
}

.intent-chart-container {
    height: 200px;
    max-width: 200px;
    margin: 0 auto 1rem;
}

.intent-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    justify-content: center;
}

.intent-legend-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 0.75rem;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 6px;
    font-size: 0.8rem;
}

.intent-color {
    width: 12px;
    height: 12px;
    border-radius: 3px;
}

.intent-icon {
    font-size: 1rem;
}

.intent-name {
    color: #fff;
    font-weight: 500;
}

.intent-percentage {
    color: rgba(255, 255, 255, 0.7);
    font-weight: 600;
}

.intent-count {
    color: rgba(255, 255, 255, 0.4);
    font-size: 0.75rem;
}

.intent-insights {
    margin-bottom: 1.5rem;
}

.intent-insights h4 {
    color: #fff;
    font-size: 1rem;
    margin-bottom: 1rem;
}

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

.insight-card {
    display: flex;
    gap: 0.75rem;
    padding: 1rem;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 8px;
    border-left: 3px solid #4285F4;
}

.insight-icon {
    font-size: 1.5rem;
}

.insight-content strong {
    display: block;
    color: #fff;
    font-size: 0.9rem;
    margin-bottom: 0.25rem;
}

.insight-content p {
    color: rgba(255, 255, 255, 0.7);
    font-size: 0.8rem;
    margin: 0;
    line-height: 1.4;
}

/* ========== TABS ========== */

.intent-tabs {
    background: rgba(0, 0, 0, 0.2);
    border-radius: 10px;
    overflow: hidden;
}

.tabs-header {
    display: flex;
    background: rgba(0, 0, 0, 0.3);
    overflow-x: auto;
}

.tab-btn {
    flex: 1;
    min-width: 150px;
    padding: 0.75rem 1rem;
    border: none;
    background: transparent;
    color: rgba(255, 255, 255, 0.6);
    font-size: 0.85rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    transition: all 0.3s ease;
    border-bottom: 2px solid transparent;
}

.tab-btn:hover {
    background: rgba(255, 255, 255, 0.05);
    color: #fff;
}

.tab-btn.active {
    background: rgba(66, 133, 244, 0.2);
    color: #fff;
    border-bottom-color: #4285F4;
}

.tab-count {
    background: rgba(255, 255, 255, 0.1);
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 0.75rem;
}

.tab-btn.active .tab-count {
    background: rgba(66, 133, 244, 0.3);
}

.tabs-content {
    padding: 1rem;
}

.tab-panel {
    display: none;
}

.tab-panel.active {
    display: block;
}

.intent-description {
    color: rgba(255, 255, 255, 0.6);
    font-size: 0.85rem;
    margin-bottom: 1rem;
    padding: 0.75rem;
    background: rgba(255, 255, 255, 0.03);
    border-radius: 6px;
}

.intent-queries-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
}

.intent-queries-table th,
.intent-queries-table td {
    padding: 0.6rem;
    text-align: left;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.intent-queries-table th {
    color: rgba(255, 255, 255, 0.6);
    font-weight: 500;
}

.intent-queries-table td {
    color: rgba(255, 255, 255, 0.85);
}

.query-text {
    font-weight: 500;
    color: #fff;
}

.confidence-bar {
    width: 50px;
    height: 4px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 2px;
    display: inline-block;
    vertical-align: middle;
}

.confidence-fill {
    height: 100%;
    border-radius: 2px;
}

.confidence-text {
    font-size: 0.75rem;
    color: rgba(255, 255, 255, 0.5);
    margin-left: 0.5rem;
}

.no-queries {
    text-align: center;
    padding: 2rem;
    color: rgba(255, 255, 255, 0.4);
}

/* ========== ÉTATS ========== */

.loading-state,
.error-state,
.empty-state {
    text-align: center;
    padding: 2rem;
}

.loading-state .spinner {
    width: 40px;
    height: 40px;
    border: 3px solid rgba(255, 255, 255, 0.1);
    border-top-color: #4285F4;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 1rem;
}

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

.loading-state p {
    color: rgba(255, 255, 255, 0.6);
}

.error-state p {
    color: #EA4335;
}

.empty-state p {
    color: #34A853;
    font-size: 1.1rem;
}

.empty-subtitle {
    color: rgba(255, 255, 255, 0.5) !important;
    font-size: 0.85rem !important;
    margin-top: 0.5rem;
}

/* ========== SEVERITY BADGE ========== */

.severity-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
}

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

@media (max-width: 768px) {
    .optimization-stats {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .opp-metrics {
        flex-direction: column;
        gap: 0.75rem;
    }
    
    .opp-suggestions {
        grid-template-columns: 1fr;
    }
    
    .tabs-header {
        flex-wrap: wrap;
    }
    
    .tab-btn {
        min-width: 120px;
    }
}


