/* ============================================================================
   ADVANCED FEATURES STYLING
   ============================================================================ */

/* ============================================================================
   FEATURE GROUP 1: PEER BENCHMARKING & MARKET ANALYSIS
   ============================================================================ */

.peer-benchmark-section {
    margin-bottom: 40px;
}

.benchmark-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin: 24px 0;
}

.benchmark-card {
    background: #f8f9fa;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 20px;
    transition: all 0.3s ease;
}

.benchmark-card:hover {
    background: white;
    border-color: #000;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.benchmark-card label {
    font-size: 12px;
    color: #666;
    font-weight: 600;
    text-transform: uppercase;
    display: block;
    margin-bottom: 12px;
}

.metric-display {
    display: flex;
    align-items: baseline;
    gap: 12px;
    margin-bottom: 8px;
}

.metric-value {
    font-size: 28px;
    font-weight: 700;
    color: #000;
}

.metric-badge {
    font-size: 12px;
    color: #666;
    background: #f0f0f0;
    padding: 4px 8px;
    border-radius: 4px;
}

.metric-rank {
    font-size: 13px;
    color: #667eea;
    font-weight: 600;
    margin-top: 8px;
}

.benchmark-comparison-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 24px;
    background: white;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    overflow: hidden;
}

.benchmark-comparison-table thead {
    background: #f8f9fa;
    border-bottom: 2px solid #e0e0e0;
}

.benchmark-comparison-table th {
    padding: 12px 16px;
    text-align: left;
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    color: #333;
}

.benchmark-comparison-table td {
    padding: 12px 16px;
    border-bottom: 1px solid #e0e0e0;
    font-size: 13px;
}

.benchmark-comparison-table tr:last-child td {
    border-bottom: none;
}

.benchmark-comparison-table tbody tr:hover {
    background: #f8f9fa;
}

/* Market Opportunity Cards */
.opportunity-section {
    margin: 40px 0;
}

.opportunity-section h3 {
    margin-bottom: 8px;
}

.section-description {
    font-size: 13px;
    color: #666;
    margin-bottom: 20px;
}

.opportunity-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 20px;
}

.opportunity-card {
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    padding: 24px;
    background: white;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.opportunity-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    height: 4px;
    width: 100%;
    background: #667eea;
}

.opportunity-card--opportunity-rank-1::before {
    background: #00a870;
}

.opportunity-card--opportunity-rank-2::before {
    background: #667eea;
}

.opportunity-card--opportunity-rank-3::before {
    background: #e67e22;
}

.opportunity-card:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    border-color: #000;
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}

.market-label {
    font-size: 16px;
    font-weight: 700;
}

.rank-badge {
    background: #f0f0f0;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
}

.opportunity-metrics {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

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

.metric-label {
    font-size: 11px;
    color: #999;
    text-transform: uppercase;
    margin-bottom: 4px;
}

.metric-value {
    font-size: 18px;
    font-weight: 700;
    color: #000;
}

/* ============================================================================
   FEATURE GROUP 2: HISTORICAL ANALYSIS
   ============================================================================ */

.historical-campaigns-section {
    margin-bottom: 40px;
}

.historical-table {
    width: 100%;
    border-collapse: collapse;
    background: white;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    overflow: hidden;
}

.historical-table thead {
    background: #f8f9fa;
    border-bottom: 2px solid #e0e0e0;
}

.historical-table th {
    padding: 12px 16px;
    text-align: left;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    color: #333;
}

.historical-table td {
    padding: 12px 16px;
    border-bottom: 1px solid #f0f0f0;
    font-size: 13px;
}

.historical-table tbody tr:hover {
    background: #f8f9fa;
}

.campaign-name {
    font-weight: 600;
    color: #667eea;
}

.badge {
    display: inline-block;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 600;
}

.badge-new {
    background: #e6f7f0;
    color: #00a870;
}

.badge-returning {
    background: #e8f0ff;
    color: #0052cc;
}

.metric-cpa {
    color: #e67e22;
    font-weight: 600;
}

.metric-roas {
    color: #00a870;
    font-weight: 600;
}

.cpa-trend-container {
    margin-top: 32px;
    padding: 20px;
    background: #f8f9fa;
    border-radius: 8px;
}

.cpa-trend-container h4 {
    margin-top: 0;
    margin-bottom: 16px;
}

/* ============================================================================
   FEATURE GROUP 3: SEASONALITY ANALYSIS
   ============================================================================ */

.seasonality-section {
    margin-bottom: 40px;
}

.seasonality-insights {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
    margin: 24px 0;
}

.insight-card {
    background: white;
    border: 1px solid #e0e0e0;
    padding: 16px;
    border-radius: 8px;
}

.insight-card label {
    display: block;
    font-size: 12px;
    color: #666;
    font-weight: 600;
    margin-bottom: 8px;
    text-transform: uppercase;
}

.insight-card p {
    font-size: 24px;
    font-weight: 700;
    margin: 0;
    color: #000;
}

.seasonality-table {
    width: 100%;
    border-collapse: collapse;
    background: white;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    margin: 20px 0;
}

.seasonality-table th,
.seasonality-table td {
    padding: 12px 16px;
    text-align: left;
    font-size: 13px;
}

.seasonality-table th {
    background: #f8f9fa;
    border-bottom: 2px solid #e0e0e0;
    font-weight: 700;
    font-size: 12px;
    text-transform: uppercase;
}

.seasonality-table tbody tr {
    border-bottom: 1px solid #f0f0f0;
}

.seasonality-table tbody tr.anomaly {
    background: #fff3e6;
}

.seasonality-recommendation {
    background: #f0f0f0;
    padding: 16px;
    border-radius: 8px;
    font-size: 13px;
    color: #333;
    margin-top: 20px;
}

/* ============================================================================
   FEATURE GROUP 4: CUSTOMER HEALTH
   ============================================================================ */

.customer-health-section {
    margin-bottom: 40px;
}

.health-overview {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 20px;
    margin: 24px 0;
}

.health-card {
    background: white;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    padding: 20px;
    transition: all 0.3s ease;
}

.health-card:hover {
    border-color: #000;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.health-card label {
    display: block;
    font-size: 12px;
    color: #666;
    font-weight: 600;
    text-transform: uppercase;
    margin-bottom: 12px;
}

.health-card .big-number {
    font-size: 28px;
    font-weight: 700;
    margin: 0 0 12px 0;
}

.health-card .breakdown {
    display: flex;
    flex-direction: column;
    gap: 4px;
    font-size: 12px;
    color: #666;
}

.health-card .breakdown span {
    display: inline;
}

.metric-small {
    display: block;
    font-size: 12px;
    color: #666;
    margin-top: 8px;
}

.health-card.reactivation-highlight {
    background: #e6f7f0;
    border-color: #00a870;
}

.lapsed-table {
    width: 100%;
    border-collapse: collapse;
    background: white;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    margin: 20px 0;
}

.lapsed-table th,
.lapsed-table td {
    padding: 12px 16px;
    text-align: left;
    font-size: 13px;
}

.lapsed-table th {
    background: #f8f9fa;
    border-bottom: 2px solid #e0e0e0;
    font-weight: 700;
    font-size: 12px;
}

.revenue-highlight {
    font-weight: 700;
    color: #00a870;
}

.health-insight {
    background: #f8f9fa;
    padding: 16px;
    border-radius: 8px;
    font-size: 13px;
    margin-top: 24px;
}

.health-insight p {
    margin: 0;
}

/* ============================================================================
   FEATURE GROUP 5: SENSITIVITY ANALYSIS
   ============================================================================ */

.sensitivity-section {
    margin-bottom: 40px;
}

.sensitivity-controls {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 24px;
    padding: 24px;
    background: #f8f9fa;
    border-radius: 8px;
    margin: 24px 0;
}

.control-group {
    display: flex;
    flex-direction: column;
}

.control-group label {
    font-size: 12px;
    font-weight: 600;
    color: #333;
    margin-bottom: 8px;
}

.control-group input[type="range"] {
    width: 100%;
    margin-bottom: 8px;
}

.control-group input[type="number"] {
    padding: 8px 12px;
    border: 1px solid #e0e0e0;
    border-radius: 4px;
    font-size: 14px;
}

.checkbox-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.checkbox-group label {
    display: flex;
    align-items: center;
    font-size: 13px;
    font-weight: 400;
    margin-bottom: 0;
    cursor: pointer;
}

.checkbox-group input[type="checkbox"] {
    margin-right: 8px;
}

.sensitivity-results {
    background: white;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 24px;
}

.sensitivity-result-item {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 20px;
    margin-bottom: 20px;
}

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

.result-label {
    font-size: 12px;
    color: #666;
    margin-bottom: 8px;
    font-weight: 600;
}

.result-value {
    font-size: 22px;
    font-weight: 700;
}

/* ============================================================================
   FEATURE GROUP 6: COMPETITIVE BENCHMARKING
   ============================================================================ */

.competitive-benchmark-card {
    background: white;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 20px;
    margin: 20px 0;
}

.competitive-benchmark-card h4 {
    margin-top: 0;
}

.benchmark-display {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 16px;
    margin: 16px 0;
}

.benchmark-item {
    text-align: center;
    padding: 16px;
    background: #f8f9fa;
    border-radius: 8px;
}

.benchmark-item label {
    display: block;
    font-size: 12px;
    color: #666;
    margin-bottom: 8px;
    font-weight: 600;
}

.benchmark-item .value {
    display: block;
    font-size: 20px;
    font-weight: 700;
    color: #000;
}

.your-value {
    color: #667eea;
}

.median-value {
    color: #999;
}

.top-value {
    color: #00a870;
}

.percentile-badge {
    display: inline-block;
    padding: 12px 16px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    margin: 16px 0;
}

.percentile-top_10 {
    background: #e6f7f0;
    color: #00a870;
}

.percentile-above_median {
    background: #e8f0ff;
    color: #0052cc;
}

.percentile-below_median {
    background: #fff3e6;
    color: #e67e22;
}

.benchmark-recommendation {
    padding: 16px;
    background: #f8f9fa;
    border-radius: 8px;
    margin-top: 16px;
}

.benchmark-recommendation p {
    margin: 0;
    font-size: 13px;
    color: #333;
}

/* ============================================================================
   FEATURE GROUP 7: LTV VALIDATION
   ============================================================================ */

.ltv-validation-section {
    margin-bottom: 40px;
}

.ltv-comparison {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 20px;
    margin: 24px 0;
}

.comparison-card {
    background: white;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    padding: 20px;
    text-align: center;
}

.comparison-card label {
    display: block;
    font-size: 12px;
    color: #666;
    font-weight: 600;
    margin-bottom: 12px;
    text-transform: uppercase;
}

.comparison-card .metric-value {
    font-size: 24px;
    font-weight: 700;
    color: #000;
}

.comparison-card.variance-card .metric-value.negative {
    color: #e67e22;
}

.comparison-card.variance-card .metric-value.positive {
    color: #00a870;
}

.comparison-card .percent {
    font-size: 12px;
    color: #666;
    display: block;
    margin-top: 4px;
}

.cohort-table {
    width: 100%;
    border-collapse: collapse;
    background: white;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    margin: 20px 0;
}

.cohort-table th,
.cohort-table td {
    padding: 12px 16px;
    text-align: left;
    font-size: 13px;
}

.cohort-table th {
    background: #f8f9fa;
    border-bottom: 2px solid #e0e0e0;
    font-weight: 700;
    font-size: 12px;
    text-transform: uppercase;
}

.cohort-table td.negative {
    color: #e67e22;
    font-weight: 600;
}

.cohort-table td.positive {
    color: #00a870;
    font-weight: 600;
}

.confidence-badge {
    display: inline-block;
    padding: 8px 16px;
    border-radius: 8px;
    font-size: 12px;
    font-weight: 600;
    margin: 20px 0;
}

.confidence-badge.confidence-high {
    background: #e6f7f0;
    color: #00a870;
}

.confidence-badge.confidence-medium {
    background: #e8f0ff;
    color: #0052cc;
}

.confidence-badge.confidence-low {
    background: #fff3e6;
    color: #e67e22;
}

.learning-box {
    background: #f8f9fa;
    padding: 16px;
    border-radius: 8px;
    font-size: 13px;
    margin-top: 20px;
    border-left: 4px solid #667eea;
}

.learning-box strong {
    display: block;
    margin-bottom: 8px;
}

/* ============================================================================
   FEATURE GROUP 8: OPTIMIZATION ALERTS
   ============================================================================ */

.alerts-section {
    margin-bottom: 40px;
}

.alerts-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
    margin: 24px 0;
}

.alert-card {
    border-left: 4px solid #999;
    background: white;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 20px;
    transition: all 0.3s ease;
}

.alert-card.alert-high {
    border-left-color: #e67e22;
    background: #fff8f3;
}

.alert-card.alert-medium {
    border-left-color: #0052cc;
    background: #f0f4ff;
}

.alert-card.alert-low {
    border-left-color: #00a870;
    background: #f0faf7;
}

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

.alert-campaign {
    font-weight: 700;
    color: #000;
}

.alert-urgency {
    font-size: 12px;
    font-weight: 600;
}

.alert-issue,
.alert-recommendation,
.alert-impact {
    margin-bottom: 12px;
    font-size: 13px;
}

.alert-issue strong,
.alert-recommendation strong,
.alert-impact strong {
    display: block;
    margin-bottom: 4px;
    font-size: 12px;
    text-transform: uppercase;
    color: #666;
}

.btn-implement {
    width: 100%;
    padding: 10px;
    background: #667eea;
    color: white;
    border: none;
    border-radius: 4px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-implement:hover {
    background: #5568d3;
}

/* ============================================================================
   FEATURE GROUP 9: GROWTH ATTRIBUTION
   ============================================================================ */

.growth-attribution-section {
    margin-bottom: 40px;
}

.attribution-display {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 40px;
    margin: 24px 0;
}

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

.attribution-metric label {
    font-size: 14px;
    font-weight: 700;
    margin-bottom: 16px;
}

.pie-chart-container {
    position: relative;
    height: 200px;
    margin-bottom: 16px;
}

.attribution-breakdown {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.attribution-breakdown .item {
    display: flex;
    justify-content: space-between;
    padding: 12px;
    background: #f8f9fa;
    border-radius: 4px;
}

.attribution-breakdown .label {
    font-size: 13px;
    font-weight: 600;
}

.attribution-breakdown .value {
    font-size: 13px;
    font-weight: 700;
    color: #667eea;
}

.attribution-insight {
    background: #f8f9fa;
    padding: 16px;
    border-radius: 8px;
    font-size: 13px;
    margin-top: 24px;
}

.attribution-insight p {
    margin: 0;
}

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

@media (max-width: 768px) {
    .benchmark-grid,
    .opportunity-cards,
    .health-overview,
    .seasonality-insights,
    .ltv-comparison,
    .sensitivity-controls,
    .attribution-display {
        grid-template-columns: 1fr;
    }

    .opportunity-metrics {
        grid-template-columns: 1fr;
    }

    .benchmark-comparison-table,
    .historical-table,
    .seasonality-table,
    .lapsed-table,
    .cohort-table {
        font-size: 12px;
    }

    .benchmark-comparison-table th,
    .historical-table th,
    .seasonality-table th,
    .lapsed-table th,
    .cohort-table th {
        padding: 10px 12px;
    }

    .benchmark-comparison-table td,
    .historical-table td,
    .seasonality-table td,
    .lapsed-table td,
    .cohort-table td {
        padding: 10px 12px;
    }

    .alerts-container {
        grid-template-columns: 1fr;
    }
}
