/* Charts and Analysis Components */

/* Modern Trends Section */
#trends {
    padding: 2rem;
    background-color: #1f2235;
    border-radius: 12px;
    margin-bottom: 24px;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

#trends h2 {
    font-size: 1.5em;
    font-weight: 600;
    margin-bottom: 1.5rem;
    text-align: center;
    color: #ffffff;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

#trends-chart-container {
    height: 500px;
    width: 100%;
    position: relative;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 8px;
    padding: 1.5rem 1.5rem 1.5rem 2rem;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

#trendsChart {
    width: 100% !important;
    height: 100% !important;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}




/* Ensure stats display doesn't clip content */
#stats-display {
    overflow: visible;
    position: relative;
}



/* Theme support */


/* Theme support for Trends */
body.theme #trends {
    background-color: #2d3748;
}

body.theme #trends h2 {
    color: #f7fafc;
}

body.theme #trends p {
    color: #a0aec0;
}

body.theme #trends-chart-container {
    background: rgba(255, 255, 255, 0.05);
}

/* Responsive design for Trends */
@media (max-width: 768px) {
    #trends {
        padding: 1.5rem;
    }
    
    #trends h2 {
        font-size: 1.25em;
        margin-bottom: 1rem;
    }
    
    #trends-chart-container {
        height: 450px;
        padding: 0.75rem;
    }
}

@media (max-width: 768px) {
    #trends {
        padding: 1.5rem;
    }
    
    #trends h2 {
        font-size: 1.25em;
        margin-bottom: 1rem;
    }
    
    #trends-chart-container {
        height: 450px;
        padding: 0.75rem;
    }
}

@media (max-width: 480px) {
    #trends {
        padding: 1rem;
    }
    
    #trends h2 {
        font-size: 1.1em;
        margin-bottom: 0.75rem;
    }
    
    #trends-chart-container {
        height: 400px;
        padding: 0.5rem;
    }
}

/* Modern Activity Section Styles */

/* CSS Variables for Activity theming */
:root {
    --activity-bg-gradient: linear-gradient(135deg, #f8fafc 0%, #e2e8f0 100%);
    --activity-card-shadow: 0 20px 40px rgba(0, 0, 0, 0.08);
    --activity-hover-shadow: 0 25px 50px rgba(0, 0, 0, 0.12);
    --activity-border: rgba(226, 232, 240, 0.8);
    --activity-accent: #667eea;
    --activity-accent-light: #7c3aed;
    --activity-text-primary: #1a202c;
    --activity-text-secondary: #4a5568;
    --activity-chart-bg: rgba(255, 255, 255, 0.7);
    --activity-bar-track: #f1f5f9;
    --activity-bar-border: #e2e8f0;
}

/* Modern Activity Container */
.activity-container {
    background: var(--activity-bg-gradient);
    border-radius: 24px;
    padding: 32px;
    margin-bottom: 24px;
    box-shadow: var(--activity-card-shadow);
    position: relative;
    border: 1px solid var(--activity-border);
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    overflow: visible;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

/* Add subtle gradient overlay */
.activity-container::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 100px;
    background: linear-gradient(180deg, rgba(102, 126, 234, 0.03) 0%, transparent 100%);
    pointer-events: none;
    z-index: 1;
}

.activity-container:hover {
    transform: translateY(-4px);
    box-shadow: var(--activity-hover-shadow);
    border-color: var(--activity-accent);
}

/* Activity Title */
.activity-title {
    font-size: 1.5em;
    font-weight: 800;
    color: var(--activity-text-primary);
    margin-bottom: 28px;
    text-align: center;
    letter-spacing: -0.5px;
    position: relative;
    z-index: 2;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

/* Add decorative line under title */
.activity-title::after {
    content: '';
    position: absolute;
    bottom: -8px;
    left: 50%;
    transform: translateX(-50%);
    width: 60px;
    height: 3px;
    background: var(--activity-accent);
    border-radius: 2px;
    transition: width 0.3s ease;
}

.activity-container:hover .activity-title::after {
    width: 100px;
}

/* Activity Content Wrapper */
.activity-content {
    display: flex;
    gap: 32px;
    align-items: stretch;
    position: relative;
    z-index: 2;
    min-width: 0;
    overflow-x: auto;
    overflow-y: visible;
    padding-bottom: 12px;
    margin-bottom: -12px;
}

/* Weekly Table Container */
.weekly-table-container {
    flex: 1;
    background: var(--activity-chart-bg);
    border-radius: 16px;
    padding: 24px;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.6);
}

/* Chart Container */
.activity-chart-wrapper {
    flex: 0 0 400px;
    min-width: 0;
    background: var(--activity-chart-bg);
    border-radius: 16px;
    padding: 24px;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    width: 400px;
    height: 400px;
}

.activity-chart-wrapper canvas {
    max-width: 100% !important;
    max-height: 100% !important;
}

/* Modern Table Styling */
.weekly-breakdown-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0 8px;
    font-size: 0.9375rem;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

.weekly-breakdown-table thead tr {
    background: transparent !important;
}

.weekly-breakdown-table th {
    padding: 20px 16px !important;
    text-align: center !important;
    color: var(--activity-text-primary) !important;
    font-weight: 600 !important;
    text-transform: none;
    letter-spacing: 0.02em;
    font-size: 0.9375rem !important;
    border: none !important;
    background: transparent !important;
    border-bottom: 2px solid var(--activity-border) !important;
    white-space: nowrap;
    position: relative;
}

/* Add subtle dividers between headers */
.weekly-breakdown-table th:not(:last-child)::after {
    content: '';
    position: absolute;
    right: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 1px;
    height: 20px;
    background: var(--activity-border);
    opacity: 0.5;
}

/* Add subtitle styling */
.weekly-breakdown-table .subtitle {
    font-size: 0.7rem !important;
    font-weight: 400 !important;
    opacity: 0.7;
    margin-top: 4px;
    display: block;
    color: var(--activity-text-secondary) !important;
}

.weekly-breakdown-table tbody tr {
    background: white !important;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
    transition: all 0.2s ease;
    border: 1px solid var(--activity-border);
}

.weekly-breakdown-table tbody tr:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12);
    border-color: var(--activity-accent);
}

.weekly-breakdown-table td {
    padding: 18px 16px !important;
    text-align: center !important;
    border: none !important;
    font-weight: 500;
    vertical-align: middle;
    height: 60px;
    box-sizing: border-box;
}

.weekly-breakdown-table td:first-child {
    font-weight: 600;
    color: var(--activity-accent);
    border-right: 1px solid var(--activity-border);
}

/* Style for percentage column */
.weekly-breakdown-table td:nth-child(2) {
    font-weight: 700;
    color: var(--activity-text-primary);
}

/* Style for player data columns */
.weekly-breakdown-table td:nth-child(n+3) {
    color: var(--activity-text-secondary);
    font-family: 'SF Mono', 'Monaco', 'Inconsolata', monospace;
    font-size: 0.9375rem;
}

/* Heatmap styles */
.heatmap-container {
    background: var(--activity-bg-gradient);
    border-radius: 24px;
    padding: 32px;
    margin-bottom: 24px;
    box-shadow: var(--activity-card-shadow);
    border: 1px solid var(--activity-border);
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

.heatmap-container:hover {
    transform: translateY(-4px);
    box-shadow: var(--activity-hover-shadow);
    border-color: var(--activity-accent);
}

.heatmap-calendar {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 4px;
    margin-top: 24px;
    padding: 20px;
    background: var(--activity-chart-bg);
    border-radius: 16px;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.6);
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

.heatmap-day {
    aspect-ratio: 1;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.875em;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    position: relative;
    overflow: hidden;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

.heatmap-day::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    background: radial-gradient(circle, rgba(255,255,255,0.8) 0%, transparent 70%);
    transition: all 0.5s ease;
    transform: translate(-50%, -50%);
}

.heatmap-day:hover::before {
    width: 150%;
    height: 150%;
}

.heatmap-day:hover {
    transform: scale(1.15);
    z-index: 10;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.15);
}

.heatmap-legend {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 12px;
    margin-top: 24px;
    font-size: 0.875em;
    font-weight: 500;
    color: var(--activity-text-secondary);
}

.heatmap-legend-item {
    width: 16px;
    height: 16px;
    border-radius: 4px;
    transition: transform 0.2s ease;
}

.heatmap-legend-item:hover {
    transform: scale(1.2);
}

/* Theme support */
body.theme {
    --activity-bg-gradient: linear-gradient(135deg, #2d3748 0%, #1a202c 100%);
    --activity-card-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    --activity-hover-shadow: 0 15px 40px rgba(0, 0, 0, 0.4);
    --activity-border: rgba(74, 85, 104, 0.6);
    --activity-accent: #818cf8;
    --activity-accent-light: #a78bfa;
    --activity-text-primary: #f7fafc;
    --activity-text-secondary: #e2e8f0;
    --activity-chart-bg: rgba(45, 55, 72, 0.95);
    --activity-bar-track: #4a5568;
    --activity-bar-border: #6b7280;
}

body.theme .activity-container::before,
body.theme .heatmap-container::before {
    background: linear-gradient(180deg, rgba(129, 140, 248, 0.05) 0%, transparent 100%);
}

body.theme .weekly-table-container,
body.theme .activity-chart-wrapper,
body.theme .heatmap-calendar {
    background: var(--activity-chart-bg);
    border-color: rgba(255, 255, 255, 0.1);
}

body.theme .weekly-breakdown-table tbody tr {
    background: #374151 !important;
}

body.theme .weekly-breakdown-table tbody tr:hover {
    background: #4b5563 !important;
}

/* Responsive design for Activity */
@media (max-width: 1200px) {
    .activity-content {
        flex-direction: column;
        gap: 24px;
    }
    
    .activity-chart-wrapper {
        flex: 1;
        width: 100%;
        max-width: 400px;
        height: 400px;
        margin: 0 auto;
    }
}

@media (max-width: 768px) {
    .activity-container,
    .heatmap-container {
        padding: 20px;
        border-radius: 16px;
    }
    
    .activity-title {
        font-size: 1.2em;
        margin-bottom: 20px;
    }
    
    .activity-content {
        gap: 16px;
        overflow-x: visible;
    }
    
    .weekly-table-container {
        padding: 12px;
        border-radius: 12px;
        width: 100%;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    
    .activity-chart-wrapper {
        padding: 16px;
        border-radius: 12px;
        width: 100%;
        max-width: 350px;
        height: 350px;
        margin: 0 auto;
    }
    
    .weekly-breakdown-table {
        font-size: 0.7rem;
        min-width: 500px;
        white-space: nowrap;
    }
    
    .weekly-breakdown-table th,
    .weekly-breakdown-table td {
        padding: 6px 4px !important;
        min-width: 40px;
        text-align: center !important;
    }
    
    .weekly-breakdown-table th:first-child,
    .weekly-breakdown-table td:first-child {
        min-width: 80px;
        text-align: left !important;
        position: sticky;
        left: 0;
        background: var(--activity-chart-bg);
        z-index: 2;
    }
    
    .heatmap-calendar {
        gap: 2px;
        padding: 12px;
    }
}

@media (max-width: 480px) {
    .activity-container,
    .heatmap-container {
        padding: 12px;
        margin-bottom: 16px;
    }
    
    .activity-title {
        font-size: 1.1em;
        margin-bottom: 16px;
    }
    
    .weekly-table-container {
        padding: 8px;
        margin: 0 -4px;
    }
    
    .weekly-breakdown-table {
        font-size: 0.65rem;
        min-width: 450px;
    }
    
    .weekly-breakdown-table th,
    .weekly-breakdown-table td {
        padding: 4px 2px !important;
        min-width: 35px;
    }
    
    .weekly-breakdown-table th:first-child,
    .weekly-breakdown-table td:first-child {
        min-width: 70px;
        font-size: 0.6rem;
    }
    
    .activity-chart-wrapper {
        padding: 12px;
        width: 100%;
        max-width: 280px;
        height: 280px;
        margin: 0 auto;
    }
    
    .heatmap-day {
        font-size: 0.75em;
    }
    
    .heatmap-legend {
        font-size: 0.75em;
        gap: 8px;
    }
}

/* Modern Analysis Section Styles */

/* CSS Variables for Analysis theming */
:root {
    --analysis-bg-gradient: linear-gradient(135deg, #f8fafc 0%, #e2e8f0 100%);
    --analysis-card-shadow: 0 10px 30px rgba(0, 0, 0, 0.08);
    --analysis-hover-shadow: 0 20px 40px rgba(0, 0, 0, 0.12);
    --analysis-border: rgba(226, 232, 240, 0.8);
    --analysis-accent: #667eea;
    --analysis-success: #10b981;
    --analysis-danger: #ef4444;
    --analysis-warning: #f59e0b;
    --analysis-text-primary: #1a202c;
    --analysis-text-secondary: #4a5568;
    --analysis-item-bg: rgba(255, 255, 255, 0.8);
}

/* Analysis Container Grid */
.analysis-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(360px, 1fr));
    gap: 24px;
    margin-bottom: 32px;
    align-items: stretch;
}

/* Modern Analysis Card */
.analysis-card {
    background: var(--analysis-bg-gradient);
    border-radius: 20px;
    padding: 28px;
    box-shadow: var(--analysis-card-shadow);
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    min-height: 300px;
    height: auto;
    border: 1px solid var(--analysis-border);
    position: relative;
    overflow: visible;
    display: flex;
    flex-direction: column;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

/* Card gradient overlay */
.analysis-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 80px;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.5) 0%, transparent 100%);
    pointer-events: none;
    z-index: 1;
}

.analysis-card:hover {
    transform: translateY(-6px);
    box-shadow: var(--analysis-hover-shadow);
}

/* Specific card styles */
.worst-racing-card {
    border-left: 4px solid var(--analysis-danger);
}

.best-racing-card {
    border-left: 4px solid var(--analysis-success);
}

/* Analysis Title */
.analysis-title {
    font-size: 1.3em;
    font-weight: 800;
    margin-bottom: 8px;
    text-align: center;
    letter-spacing: -0.3px;
    position: relative;
    z-index: 2;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

/* Analysis Description */
.analysis-description {
    font-size: 0.9375rem;
    color: var(--analysis-text-secondary);
    text-align: center;
    margin-bottom: 20px;
    opacity: 0.9;
    line-height: 1.5;
    position: relative;
    z-index: 2;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

/* Modern List Containers */
.comeback-list,
.best-day-list,
.worst-day-list {
    list-style: none;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 10px;
    position: relative;
    z-index: 2;
    overflow-y: auto;
    overflow-x: hidden;
    max-height: 380px;
    padding-right: 8px;
    margin: 0;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

/* Base Item Style */
.comeback-item,
.best-day-item,
.worst-day-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    border-radius: 12px;
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
    border: 1px solid transparent;
    gap: 12px;
    min-height: fit-content;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

/* Specific Item Styles */
.best-day-item {
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.08) 0%, rgba(16, 185, 129, 0.04) 100%);
    border-color: rgba(16, 185, 129, 0.2);
}

.best-day-item:hover {
    transform: translateX(4px);
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.15);
    border-color: var(--analysis-success);
}

.worst-day-item {
    background: linear-gradient(135deg, rgba(239, 68, 68, 0.08) 0%, rgba(239, 68, 68, 0.04) 100%);
    border-color: rgba(239, 68, 68, 0.2);
}

.worst-day-item:hover {
    transform: translateX(4px);
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.15);
    border-color: var(--analysis-danger);
}

.comeback-item {
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.08) 0%, rgba(102, 126, 234, 0.04) 100%);
    border-color: rgba(102, 126, 234, 0.2);
}

.comeback-item:hover {
    transform: translateX(4px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.15);
    border-color: var(--analysis-accent);
}

/* Player Names */
.comeback-item > span,
.best-day-item > span,
.worst-day-item > span {
    flex: 0 0 140px;
    font-weight: 600;
    color: var(--analysis-text-primary);
    font-size: 0.95rem;
    display: flex;
    align-items: center;
    gap: 8px;
}

/* Score Containers */
.comeback-item > div,
.best-day-item > div,
.worst-day-item > div {
    flex: 1;
    text-align: right;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 4px;
}

/* Scores */
.comeback-score {
    font-weight: 800;
    color: var(--analysis-accent);
    font-size: 1.15em;
    letter-spacing: -0.5px;
}

.best-day-score {
    font-weight: 800;
    color: var(--analysis-success);
    font-size: 1.15em;
    letter-spacing: -0.5px;
}

.worst-day-score {
    font-weight: 800;
    color: var(--analysis-danger);
    font-size: 1.15em;
    letter-spacing: -0.5px;
}

/* Small text styling */
.best-day-item small,
.worst-day-item small,
.comeback-item small {
    font-size: 0.75rem;
    color: var(--analysis-text-secondary);
    opacity: 0.8;
    font-weight: 500;
}

/* Pattern Analysis Styling */
#pattern-analysis {
    position: relative;
    z-index: 2;
}

#pattern-analysis ul {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 10px;
    overflow-y: auto;
    overflow-x: hidden;
    max-height: 380px;
    padding-right: 8px;
}

#pattern-analysis li {
    padding: 10px 14px;
    background: var(--analysis-item-bg);
    border-radius: 10px;
    border-left: 3px solid var(--analysis-accent);
    font-size: 0.85rem;
    line-height: 1.5;
    transition: all 0.2s ease;
}

#pattern-analysis li:hover {
    transform: translateX(4px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

/* Theme support for Analysis */
body.theme {
    --analysis-bg-gradient: linear-gradient(135deg, #2d3748 0%, #1a202c 100%);
    --analysis-card-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    --analysis-hover-shadow: 0 20px 40px rgba(0, 0, 0, 0.4);
    --analysis-border: rgba(74, 85, 104, 0.6);
    --analysis-accent: #818cf8;
    --analysis-success: #34d399;
    --analysis-danger: #f87171;
    --analysis-warning: #fbbf24;
    --analysis-text-primary: #f7fafc;
    --analysis-text-secondary: #e2e8f0;
    --analysis-item-bg: rgba(45, 55, 72, 0.8);
}

body.theme .analysis-card::before {
    background: linear-gradient(180deg, rgba(129, 140, 248, 0.05) 0%, transparent 100%);
}

/* Theme text styling for analysis cards */
body.theme .analysis-title {
    color: var(--analysis-text-primary) !important;
}

body.theme .analysis-description {
    color: var(--analysis-text-secondary) !important;
}

/* Ensure all analysis card text is readable in theme */
body.theme .analysis-card {
    color: var(--analysis-text-primary) !important;
}

body.theme .analysis-card * {
    color: inherit;
}

body.theme .best-day-item {
    background: linear-gradient(135deg, rgba(52, 211, 153, 0.08) 0%, rgba(52, 211, 153, 0.04) 100%);
    border-color: rgba(52, 211, 153, 0.2);
}

body.theme .worst-day-item {
    background: linear-gradient(135deg, rgba(248, 113, 113, 0.08) 0%, rgba(248, 113, 113, 0.04) 100%);
    border-color: rgba(248, 113, 113, 0.2);
}

/* Scrollbar styling for analysis lists - matching activity content style */
.comeback-list::-webkit-scrollbar,
.best-day-list::-webkit-scrollbar,
.worst-day-list::-webkit-scrollbar,
#pattern-analysis ul::-webkit-scrollbar {
    width: 8px;
}

.comeback-list::-webkit-scrollbar-track,
.best-day-list::-webkit-scrollbar-track,
.worst-day-list::-webkit-scrollbar-track,
#pattern-analysis ul::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.05);
    border-radius: 4px;
    margin: 4px 0;
}

.comeback-list::-webkit-scrollbar-thumb,
.best-day-list::-webkit-scrollbar-thumb,
.worst-day-list::-webkit-scrollbar-thumb,
#pattern-analysis ul::-webkit-scrollbar-thumb {
    background: linear-gradient(180deg, #667eea 0%, #764ba2 100%);
    border-radius: 4px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
}

/* Note: :hover pseudo-class is not supported on scrollbar pseudo-elements in some browsers */

body.theme .comeback-list::-webkit-scrollbar-track,
body.theme .best-day-list::-webkit-scrollbar-track,
body.theme .worst-day-list::-webkit-scrollbar-track,
body.theme #pattern-analysis ul::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.05);
}

body.theme .comeback-list::-webkit-scrollbar-thumb,
body.theme .best-day-list::-webkit-scrollbar-thumb,
body.theme .worst-day-list::-webkit-scrollbar-thumb,
body.theme #pattern-analysis ul::-webkit-scrollbar-thumb {
    background: linear-gradient(180deg, #818cf8 0%, #a78bfa 100%);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

/* Note: :hover pseudo-class is not supported on scrollbar pseudo-elements in some browsers */

/* Pretty scrollbar for activity content */
.activity-content::-webkit-scrollbar {
    height: 8px;
}

.activity-content::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.05);
    border-radius: 4px;
    margin: 0 16px;
}

.activity-content::-webkit-scrollbar-thumb {
    background: linear-gradient(90deg, #667eea 0%, #764ba2 100%);
    border-radius: 4px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
}

/* Note: :hover pseudo-class is not supported on scrollbar pseudo-elements in some browsers */

body.theme .activity-content::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.05);
}

body.theme .activity-content::-webkit-scrollbar-thumb {
    background: linear-gradient(90deg, #818cf8 0%, #a78bfa 100%);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

/* Note: :hover pseudo-class is not supported on scrollbar pseudo-elements in some browsers */

/* Firefox scrollbar styling */
.activity-content {
    scrollbar-width: thin;
    scrollbar-color: #667eea rgba(0, 0, 0, 0.05);
}

body.theme .activity-content {
    scrollbar-color: #818cf8 rgba(255, 255, 255, 0.05);
}

/* Firefox scrollbar for analysis lists */
.comeback-list,
.best-day-list,
.worst-day-list,
#pattern-analysis ul {
    scrollbar-width: thin;
    scrollbar-color: #667eea rgba(0, 0, 0, 0.05);
}

body.theme .comeback-list,
body.theme .best-day-list,
body.theme .worst-day-list,
body.theme #pattern-analysis ul {
    scrollbar-color: #818cf8 rgba(255, 255, 255, 0.05);
}

body.theme .comeback-item {
    background: linear-gradient(135deg, rgba(129, 140, 248, 0.08) 0%, rgba(129, 140, 248, 0.04) 100%);
    border-color: rgba(129, 140, 248, 0.2);
}

/* Make dates white and bold in Analysis tables for theme */
body.theme .best-day-item small,
body.theme .worst-day-item small,
body.theme .comeback-item small {
    color: white !important;
    font-weight: bold !important;
}

/* Keep score colors but make them bold - best-day-score green, worst-day-score red */
body.theme .best-day-score {
    color: var(--analysis-success) !important;
    font-weight: bold !important;
}

body.theme .worst-day-score {
    color: var(--analysis-danger) !important;
    font-weight: bold !important;
}

body.theme .comeback-score {
    color: white !important;
    font-weight: bold !important;
}

/* Make dates white and bold in Global Performance Patterns for theme */
body.theme #pattern-analysis li,
body.theme .pattern-analysis li {
    color: white !important;
    font-weight: bold !important;
}

/* Responsive design for Analysis */
@media (max-width: 768px) {
    .analysis-container {
        grid-template-columns: 1fr;
        gap: 20px;
    }
    
    .analysis-card {
        padding: 20px;
        min-height: auto;
        border-radius: 16px;
    }
    
    .analysis-title {
        font-size: 1.15em;
    }
    
    .comeback-item,
    .best-day-item,
    .worst-day-item {
        padding: 12px 16px;
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }
    
    .comeback-item > span,
    .best-day-item > span,
    .worst-day-item > span {
        flex: none;
        width: 100%;
        margin-bottom: 4px;
    }
    
    .comeback-item > div,
    .best-day-item > div,
    .worst-day-item > div {
        width: 100%;
        align-items: flex-start;
        text-align: left;
    }
}

@media (max-width: 480px) {
    .analysis-container {
        gap: 16px;
        margin-bottom: 20px;
    }
    
    .analysis-card {
        padding: 16px;
        box-shadow: var(--analysis-card-shadow);
    }
    
    .analysis-title {
        font-size: 1.1em;
        margin-bottom: 6px;
    }
    
    .analysis-description {
        font-size: 0.8rem;
        margin-bottom: 16px;
    }
    
    .comeback-item,
    .best-day-item,
    .worst-day-item {
        padding: 10px 12px;
    }
}
