/* Dashboard Styles */
:root {
    --primary-color: #3b82f6;
    --primary-dark: #2563eb;
    --success-color: #10b981;
    --warning-color: #f59e0b;
    --danger-color: #ef4444;
    --bg-color: #f1f5f9;
    --card-bg: #ffffff;
    --text-color: #1e293b;
    --text-muted: #64748b;
    --border-color: #e2e8f0;
    --shadow: 0 1px 3px rgba(0, 0, 0, 0.1), 0 1px 2px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    background-color: var(--bg-color);
    color: var(--text-color);
    line-height: 1.6;
}

.dashboard {
    max-width: 1600px;
    margin: 0 auto;
    padding: 20px;
}

/* Header */
.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
    padding: 20px 24px;
    background: var(--card-bg);
    border-radius: 12px;
    box-shadow: var(--shadow);
}

.header h1 {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--text-color);
}

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

#periodSelect {
    padding: 10px 16px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-size: 0.95rem;
    background: var(--card-bg);
    cursor: pointer;
    min-width: 150px;
}

#periodSelect:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.btn {
    padding: 10px 20px;
    border: none;
    border-radius: 8px;
    font-size: 0.95rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-primary {
    background: var(--primary-color);
    color: white;
}

.btn-primary:hover {
    background: var(--primary-dark);
    transform: translateY(-1px);
}

.btn-primary:active {
    transform: translateY(0);
}

.btn-logout {
    background: transparent;
    color: var(--text-muted);
    border: 1px solid var(--border-color);
}

.btn-logout:hover {
    color: var(--danger-color);
    border-color: var(--danger-color);
}

/* Cards */
.card {
    background: var(--card-bg);
    border-radius: 12px;
    box-shadow: var(--shadow);
    padding: 20px;
}

/* Summary Cards */
.summary-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.summary-card {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 20px;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.summary-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.card-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.visitors-icon {
    background: linear-gradient(135deg, #3b82f6, #1d4ed8);
}

.visitors-icon::before {
    content: '';
    width: 24px;
    height: 24px;
    background: white;
    mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='currentColor'%3E%3Cpath d='M12 12c2.21 0 4-1.79 4-4s-1.79-4-4-4-4 1.79-4 4 1.79 4 4 4zm0 2c-2.67 0-8 1.34-8 4v2h16v-2c0-2.66-5.33-4-8-4z'/%3E%3C/svg%3E") center/contain no-repeat;
}

.visits-icon {
    background: linear-gradient(135deg, #10b981, #059669);
}

.visits-icon::before {
    content: '';
    width: 24px;
    height: 24px;
    background: white;
    mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='currentColor'%3E%3Cpath d='M19 3H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2zm-5 14H7v-2h7v2zm3-4H7v-2h10v2zm0-4H7V7h10v2z'/%3E%3C/svg%3E") center/contain no-repeat;
}

.actions-icon {
    background: linear-gradient(135deg, #f59e0b, #d97706);
}

.actions-icon::before {
    content: '';
    width: 24px;
    height: 24px;
    background: white;
    mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='currentColor'%3E%3Cpath d='M13.5.67s.74 2.65.74 4.8c0 2.06-1.35 3.73-3.41 3.73-2.07 0-3.63-1.67-3.63-3.73l.03-.36C5.21 7.51 4 10.62 4 14c0 4.42 3.58 8 8 8s8-3.58 8-8C20 8.61 17.41 3.8 13.5.67z'/%3E%3C/svg%3E") center/contain no-repeat;
}

.bounce-icon {
    background: linear-gradient(135deg, #ef4444, #dc2626);
}

.bounce-icon::before {
    content: '';
    width: 24px;
    height: 24px;
    background: white;
    mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='currentColor'%3E%3Cpath d='M9 11H7v6h2v-6zm4-4h-2v10h2V7zm4 8h-2v2h2v-2z'/%3E%3C/svg%3E") center/contain no-repeat;
}

.time-icon {
    background: linear-gradient(135deg, #8b5cf6, #7c3aed);
}

.time-icon::before {
    content: '';
    width: 24px;
    height: 24px;
    background: white;
    mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='currentColor'%3E%3Cpath d='M11.99 2C6.47 2 2 6.48 2 12s4.47 10 9.99 10C17.52 22 22 17.52 22 12S17.52 2 11.99 2zM12 20c-4.42 0-8-3.58-8-8s3.58-8 8-8 8 3.58 8 8-3.58 8-8 8zm.5-13H11v6l5.25 3.15.75-1.23-4.5-2.67z'/%3E%3C/svg%3E") center/contain no-repeat;
}

.conversion-icon {
    background: linear-gradient(135deg, #ec4899, #db2777);
}

.conversion-icon::before {
    content: '';
    width: 24px;
    height: 24px;
    background: white;
    mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='currentColor'%3E%3Cpath d='M19 3H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2zm-2 10h-4v4h-2v-4H7v-2h4V7h2v4h4v2z'/%3E%3C/svg%3E") center/contain no-repeat;
}

.card-content h3 {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-muted);
    margin-bottom: 4px;
}

.metric {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--text-color);
}

/* Charts */
.charts-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
    gap: 20px;
    margin-bottom: 24px;
}

.chart-card {
    padding: 24px;
}

.chart-card h3 {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 16px;
    color: var(--text-color);
}

.chart-card canvas {
    max-height: 300px;
}

.chart-card.wide {
    grid-column: 1 / -1;
}

/* Funnel Section */
.funnel-section {
    margin-bottom: 24px;
}

.funnel-container {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 24px;
    align-items: start;
}

.funnel-chart-wrapper {
    min-height: 300px;
}

.funnel-stats {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.funnel-stat-card {
    padding: 20px;
    background: linear-gradient(135deg, var(--bg-color), #e2e8f0);
    border-radius: 12px;
    text-align: center;
    border-left: 4px solid var(--success-color);
}

.funnel-stat-value {
    font-size: 2rem;
    font-weight: 700;
    color: var(--success-color);
    margin-bottom: 4px;
}

.funnel-stat-label {
    font-size: 0.85rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Conversions Section */
.conversions-section {
    margin-bottom: 24px;
}

.conversions-section .table-container {
    max-height: 400px;
    overflow-y: auto;
}

.conversions-section td {
    vertical-align: middle;
}

.conversion-country {
    display: flex;
    align-items: center;
    gap: 8px;
}

.conversion-flag {
    font-size: 1.25rem;
}

/* Goals Section */
.goals-section {
    margin-bottom: 24px;
}

.full-width-card {
    padding: 24px;
}

.full-width-card h3 {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 20px;
}

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

.goal-item {
    padding: 16px;
    background: var(--bg-color);
    border-radius: 8px;
    border-left: 4px solid var(--primary-color);
}

.goal-item h4 {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 12px;
    color: var(--text-color);
}

.goal-stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
}

.goal-stat {
    text-align: center;
}

.goal-stat-value {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--primary-color);
}

.goal-stat-label {
    font-size: 0.75rem;
    color: var(--text-muted);
    text-transform: uppercase;
}

/* Stats Row */
.stats-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 20px;
    margin-bottom: 24px;
}

.stat-card h3 {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border-color);
}

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

.stat-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.stat-label {
    font-size: 0.9rem;
    color: var(--text-muted);
}

.stat-value {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-color);
}

/* Tables */
.table-container {
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
}

thead {
    background: var(--bg-color);
}

th, td {
    padding: 12px 16px;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}

th {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

td {
    font-size: 0.95rem;
}

tbody tr:hover {
    background: var(--bg-color);
}

/* Live Visits */
.live-section {
    margin-bottom: 24px;
}

.live-visits {
    display: flex;
    flex-direction: column;
    gap: 12px;
    max-height: 400px;
    overflow-y: auto;
}

.visit-item {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 12px 16px;
    background: var(--bg-color);
    border-radius: 8px;
}

.visit-flag {
    font-size: 1.5rem;
}

.visit-info {
    flex: 1;
}

.visit-country {
    font-weight: 600;
    font-size: 0.95rem;
}

.visit-details {
    font-size: 0.85rem;
    color: var(--text-muted);
}

.visit-time {
    font-size: 0.85rem;
    color: var(--text-muted);
}

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

.visit-action {
    padding: 4px 8px;
    background: var(--primary-color);
    color: white;
    border-radius: 4px;
    font-size: 0.75rem;
}

/* Footer */
.footer {
    text-align: center;
    padding: 20px;
    color: var(--text-muted);
    font-size: 0.9rem;
}

.footer p {
    margin-bottom: 4px;
}

/* Loading State */
.loading {
    opacity: 0.6;
    pointer-events: none;
}

.loading::after {
    content: '';
    position: fixed;
    top: 50%;
    left: 50%;
    width: 40px;
    height: 40px;
    margin: -20px 0 0 -20px;
    border: 3px solid var(--border-color);
    border-top-color: var(--primary-color);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

/* Responsive */
@media (max-width: 768px) {
    .header {
        flex-direction: column;
        gap: 16px;
        text-align: center;
    }

    .controls {
        width: 100%;
        justify-content: center;
    }

    .summary-cards {
        grid-template-columns: repeat(2, 1fr);
    }

    .charts-row {
        grid-template-columns: 1fr;
    }

    .chart-card canvas {
        max-height: 250px;
    }

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

    .funnel-stats {
        flex-direction: row;
        flex-wrap: wrap;
    }

    .funnel-stat-card {
        flex: 1;
        min-width: 120px;
    }

    .funnel-stat-value {
        font-size: 1.5rem;
    }
}

@media (max-width: 480px) {
    .summary-cards {
        grid-template-columns: 1fr;
    }

    .summary-card {
        padding: 16px;
    }

    .metric {
        font-size: 1.5rem;
    }
}

/* ============================================================================
   Phase 2 & 3: ML Intelligence Styles
   ============================================================================ */

/* Intelligence Header */
.intelligence-header {
    margin: 32px 0 24px;
    padding-bottom: 16px;
    border-bottom: 2px solid var(--primary-color);
}

.section-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary-color);
    display: flex;
    align-items: center;
    gap: 12px;
}

.section-title::before {
    content: '🤖';
    font-size: 1.75rem;
}

/* ML Metrics Cards */
.ml-metrics-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.ml-metric-card {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 20px;
    border-radius: 16px;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.ml-metric-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
}

.ml-metric-icon {
    font-size: 2rem;
    width: 56px;
    height: 56px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.9);
    border-radius: 12px;
}

.ml-metric-content {
    flex: 1;
}

.ml-metric-value {
    font-size: 1.75rem;
    font-weight: 700;
    color: white;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

.ml-metric-label {
    font-size: 0.8rem;
    color: rgba(255, 255, 255, 0.9);
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Gradient backgrounds */
.gradient-green {
    background: linear-gradient(135deg, #10b981, #059669);
}

.gradient-red {
    background: linear-gradient(135deg, #ef4444, #dc2626);
}

.gradient-blue {
    background: linear-gradient(135deg, #3b82f6, #2563eb);
}

.gradient-purple {
    background: linear-gradient(135deg, #8b5cf6, #7c3aed);
}

.gradient-amber {
    background: linear-gradient(135deg, #f59e0b, #d97706);
}

.gradient-cyan {
    background: linear-gradient(135deg, #06b6d4, #0891b2);
}

/* Prediction Tables Row */
.prediction-tables-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(450px, 1fr));
    gap: 20px;
    margin-bottom: 24px;
}

.prediction-tables-row .card {
    padding: 24px;
}

.converter-card {
    border-left: 4px solid var(--success-color);
}

.converter-card h3 {
    color: var(--success-color);
}

/* Power Users Section */
.power-users-section {
    margin-bottom: 24px;
}

.power-users-section h3 {
    color: var(--primary-color);
}

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

.power-user-card {
    background: linear-gradient(135deg, var(--bg-color), #e2e8f0);
    border-radius: 12px;
    padding: 16px;
    border-left: 4px solid var(--primary-color);
    transition: transform 0.2s ease;
}

.power-user-card:hover {
    transform: translateY(-2px);
}

.power-user-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 12px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--border-color);
}

.power-user-medal {
    font-size: 1.5rem;
}

.power-user-id {
    flex: 1;
    font-weight: 600;
    font-size: 0.95rem;
}

.power-user-rank {
    background: var(--primary-color);
    color: white;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
}

.power-user-stats {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
    margin-bottom: 12px;
}

.power-user-stat {
    text-align: center;
}

.power-user-stat .stat-value {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-color);
}

.power-user-stat .stat-value.engagement {
    color: var(--primary-color);
}

.power-user-stat .stat-value.conversion {
    color: var(--success-color);
}

.power-user-stat .stat-label {
    font-size: 0.7rem;
    color: var(--text-muted);
    text-transform: uppercase;
}

.power-user-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.85rem;
}

.power-user-downloads {
    color: var(--text-muted);
}

.power-user-stage {
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 0.75rem;
    font-weight: 500;
    background: rgba(107, 114, 128, 0.1);
    color: #6b7280;
}

.power-user-stage.stage-4 {
    background: rgba(16, 185, 129, 0.15);
    color: #059669;
}

.power-user-stage.stage-3 {
    background: rgba(139, 92, 246, 0.15);
    color: #7c3aed;
}

.power-user-stage.stage-2 {
    background: rgba(245, 158, 11, 0.15);
    color: #d97706;
}

.power-user-stage.stage-1 {
    background: rgba(59, 130, 246, 0.15);
    color: #2563eb;
}

/* Cohort Metrics Section */
.cohort-metrics-section {
    display: grid;
    grid-template-columns: 1fr 2fr 1fr;
    gap: 20px;
    margin-bottom: 24px;
}

.cohort-card h3 {
    color: var(--primary-color);
}

.retention-card h3 {
    color: var(--success-color);
}

/* Cohort value colors */
.cohort-platinum {
    color: #7c3aed !important;
    font-weight: 700;
}

.cohort-gold {
    color: #d97706 !important;
    font-weight: 700;
}

.cohort-silver {
    color: #9ca3af !important;
    font-weight: 700;
}

.cohort-bronze {
    color: #b45309 !important;
    font-weight: 700;
}

/* Highlight colors for stats */
.highlight-purple {
    color: var(--primary-color) !important;
}

.highlight-warning {
    color: var(--warning-color) !important;
}

.no-data {
    text-align: center;
    color: var(--text-muted);
    padding: 40px;
    font-style: italic;
}

/* Highlighted Stats */
.stat-item.highlight-green .stat-value {
    color: var(--success-color);
    font-size: 1.3rem;
}

.stat-item.highlight-red .stat-value {
    color: var(--danger-color);
    font-size: 1.3rem;
}

/* Alerts Section */
.alerts-section {
    margin-bottom: 24px;
}

.alert-card {
    border-left: 4px solid var(--danger-color);
}

.alert-card h3 {
    color: var(--danger-color);
}

/* Converters Section */
.converters-section {
    margin-bottom: 24px;
}

.converters-section h3 {
    color: var(--success-color);
}

/* Risk Badges */
.risk-badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 0.85rem;
    font-weight: 600;
}

.risk-badge.risk-critical {
    background: rgba(239, 68, 68, 0.15);
    color: #dc2626;
}

.risk-badge.risk-high {
    background: rgba(245, 158, 11, 0.15);
    color: #d97706;
}

/* Score Badges */
.score-badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 0.85rem;
    font-weight: 600;
}

.score-badge.score-high {
    background: rgba(16, 185, 129, 0.15);
    color: #059669;
}

/* Action Badges */
.action-badge {
    display: inline-block;
    padding: 4px 10px;
    background: rgba(59, 130, 246, 0.1);
    color: var(--primary-color);
    border-radius: 6px;
    font-size: 0.8rem;
    font-weight: 500;
}

/* Engagement Badges */
.engagement-badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 0.8rem;
    font-weight: 500;
}

.engagement-badge.high {
    background: rgba(16, 185, 129, 0.15);
    color: #059669;
}

.engagement-badge.medium {
    background: rgba(245, 158, 11, 0.15);
    color: #d97706;
}

.engagement-badge.low {
    background: rgba(107, 114, 128, 0.15);
    color: #6b7280;
}

/* Code styling in tables */
table code {
    background: var(--bg-color);
    padding: 2px 6px;
    border-radius: 4px;
    font-family: 'Monaco', 'Menlo', monospace;
    font-size: 0.85rem;
}

/* Responsive for intelligence section */
@media (max-width: 1200px) {
    .cohort-metrics-section {
        grid-template-columns: 1fr 1fr;
    }

    .cohort-metrics-section .chart-card {
        grid-column: 1 / -1;
    }
}

@media (max-width: 768px) {
    .ml-metrics-cards {
        grid-template-columns: repeat(2, 1fr);
    }

    .ml-metric-card {
        padding: 16px;
    }

    .ml-metric-value {
        font-size: 1.5rem;
    }

    .prediction-tables-row {
        grid-template-columns: 1fr;
    }

    .power-users-grid {
        grid-template-columns: 1fr;
    }

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

@media (max-width: 480px) {
    .ml-metrics-cards {
        grid-template-columns: 1fr;
    }

    .power-user-stats {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* ============================================================================
   Phase 4: Conversion Breakdown Styles
   ============================================================================ */

/* Conversion Breakdown Header */
.conversion-breakdown-header {
    margin: 32px 0 24px;
    padding-bottom: 16px;
    border-bottom: 2px solid var(--success-color);
}

.conversion-breakdown-header .section-title {
    color: var(--success-color);
}

.conversion-breakdown-header .section-title::before {
    content: '';
}

/* Conversion Summary Cards */
.conversion-summary-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.conversion-summary-card {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 20px 24px;
    background: linear-gradient(135deg, #10b981, #059669);
    border-radius: 16px;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.conversion-summary-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
}

.conversion-summary-icon {
    font-size: 2rem;
    width: 56px;
    height: 56px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.9);
    border-radius: 12px;
}

.conversion-summary-content {
    flex: 1;
}

.conversion-summary-value {
    font-size: 2rem;
    font-weight: 700;
    color: white;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

.conversion-summary-label {
    font-size: 0.85rem;
    color: rgba(255, 255, 255, 0.9);
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Alert Section (single card) */
.alert-section {
    margin-bottom: 24px;
}

.alert-section .full-width-card {
    border-left: 4px solid var(--danger-color);
}

.alert-section h3 {
    color: var(--danger-color);
}

/* Responsive for conversion breakdown */
@media (max-width: 768px) {
    .conversion-summary-cards {
        grid-template-columns: 1fr;
    }

    .conversion-summary-card {
        padding: 16px 20px;
    }

    .conversion-summary-value {
        font-size: 1.5rem;
    }
}

@media (max-width: 480px) {
    .conversion-summary-icon {
        width: 48px;
        height: 48px;
        font-size: 1.5rem;
    }
}

/* ============================================================================
   Phase 5: Percentile Distribution Styles
   ============================================================================ */

/* Percentile Header */
.percentile-header {
    margin: 32px 0 24px;
    padding-bottom: 16px;
    border-bottom: 2px solid #8b5cf6;
}

.percentile-header .section-title {
    color: #8b5cf6;
}

.percentile-header .section-title::before {
    content: '';
}

/* Percentile Summary Cards */
.percentile-summary-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.percentile-summary-card {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 20px 24px;
    background: linear-gradient(135deg, #8b5cf6, #7c3aed);
    border-radius: 16px;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.percentile-summary-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
}

.percentile-summary-icon {
    font-size: 2rem;
    width: 56px;
    height: 56px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.9);
    border-radius: 12px;
}

.percentile-summary-content {
    flex: 1;
}

.percentile-summary-value {
    font-size: 2rem;
    font-weight: 700;
    color: white;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

.percentile-summary-label {
    font-size: 0.85rem;
    color: rgba(255, 255, 255, 0.9);
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Percentile Charts Grid */
.percentile-charts-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
    gap: 20px;
    margin-bottom: 24px;
}

.percentile-chart-card {
    padding: 24px;
}

.percentile-chart-card h3 {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 16px;
    color: var(--text-color);
}

.percentile-chart-card canvas {
    max-height: 280px;
}

/* Percentile Table */
.percentile-table-section {
    margin-bottom: 24px;
}

.percentile-table-section h3 {
    color: #8b5cf6;
}

.percentile-table {
    width: 100%;
    border-collapse: collapse;
}

.percentile-table th {
    background: linear-gradient(135deg, #f3e8ff, #ede9fe);
    color: #6b21a8;
    font-weight: 600;
    padding: 12px 16px;
    text-align: left;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 2px solid #c4b5fd;
}

.percentile-table td {
    padding: 12px 16px;
    border-bottom: 1px solid var(--border-color);
}

.percentile-table tbody tr:hover {
    background: #f5f3ff;
}

.percentile-table .category-cell {
    font-weight: 600;
    color: #6b21a8;
    text-transform: capitalize;
}

.percentile-table .metric-cell {
    font-weight: 500;
    color: var(--text-color);
}

.percentile-table .p1-cell {
    color: #991b1b;
    font-weight: 500;
}

.percentile-table .p5-cell {
    color: #dc2626;
    font-weight: 500;
}

.percentile-table .p10-cell {
    color: #ea580c;
    font-weight: 500;
}

.percentile-table .p25-cell {
    color: #d97706;
    font-weight: 500;
}

.percentile-table .p50-cell {
    color: #2563eb;
    font-weight: 600;
}

.percentile-table .p75-cell {
    color: #0891b2;
    font-weight: 500;
}

.percentile-table .p90-cell {
    color: #059669;
    font-weight: 500;
}

.percentile-table .p95-cell {
    color: #10b981;
    font-weight: 500;
}

.percentile-table .p99-cell {
    color: #14532d;
    font-weight: 500;
}

.percentile-table .mean-cell {
    color: var(--text-muted);
}

.percentile-table .spread-cell {
    color: #7c3aed;
    font-weight: 600;
}

.percentile-table .iqr-cell {
    color: #6d28d9;
    font-weight: 600;
}

/* Percentile Badge Colors for Legend */
.percentile-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 600;
}

.percentile-badge.p10 {
    background: rgba(220, 38, 38, 0.15);
    color: #dc2626;
}

.percentile-badge.p50 {
    background: rgba(37, 99, 235, 0.15);
    color: #2563eb;
}

.percentile-badge.p90 {
    background: rgba(5, 150, 105, 0.15);
    color: #059669;
}

/* Responsive for percentile section */
@media (max-width: 1200px) {
    .percentile-charts-row {
        grid-template-columns: 1fr 1fr;
    }
}

@media (max-width: 768px) {
    .percentile-summary-cards {
        grid-template-columns: 1fr;
    }

    .percentile-summary-card {
        padding: 16px 20px;
    }

    .percentile-summary-value {
        font-size: 1.5rem;
    }

    .percentile-charts-row {
        grid-template-columns: 1fr;
    }

    .percentile-table {
        font-size: 0.85rem;
    }

    .percentile-table th,
    .percentile-table td {
        padding: 8px 12px;
    }
}

@media (max-width: 480px) {
    .percentile-summary-icon {
        width: 48px;
        height: 48px;
        font-size: 1.5rem;
    }

    .percentile-table {
        font-size: 0.8rem;
    }
}
