.compare-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin: 20px 0;
}


.compare-team {
    background: var(--card-bg);
    border-radius: 8px;
    padding: 20px;
    box-shadow: 0 2px 4px var(--shadow);
}

.compare-team h2 {
    margin-top: 0;
    color: var(--text-primary);
    border-bottom: 2px solid var(--border-color);
    padding-bottom: 10px;
    text-align: center;
}

.stat-group {
    background: var(--bg-secondary);
    border-radius: 4px;
    padding: 10px;
    margin: 10px 0;
}

.stat-comparison {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    align-items: center;
    margin: 0;
    padding: 8px 0;
    border-bottom: 1px solid var(--border-color);
    position: relative;
}

.stat-comparison:last-child {
    border-bottom: none;
}

.stat-label {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    text-align: center;
    font-weight: bold;
    color: var(--text-secondary);
    padding: 0 10px;
    white-space: nowrap;
    background: var(--bg-secondary);
    z-index: 1;
}

.stat-value {
    text-align: center;
    font-size: 1.1em;
}

.stat-value.better {
    color: #155724; /* Darker green for WCAG AA contrast in light mode */
    font-weight: bold;
}

[data-theme="dark"] .stat-value.better {
    color: #4ade80; /* Lighter green for dark mode */
}

.stat-value.worse {
    color: #dc3545; /* Red for light mode */
    font-weight: bold;
}

[data-theme="dark"] .stat-value.worse {
    color: #f87171; /* Lighter red for dark mode */
}

.stat-value.equal {
    color: var(--text-primary);
}

.stat-value.positive {
    color: #155724; /* Darker green for WCAG AA contrast in light mode */
    font-weight: bold;
}

[data-theme="dark"] .stat-value.positive {
    color: #4ade80; /* Lighter green for dark mode */
}

.stat-value.negative {
    color: #dc3545; /* Red for light mode */
    font-weight: bold;
}

[data-theme="dark"] .stat-value.negative {
    color: #f87171; /* Lighter red for dark mode */
}

.comparison-section {
    margin: 30px 0;
}

.comparison-section h3,
.comparison-section h4,
.comparison-section h5 {
    margin: 15px 0 12px 0;
    padding-bottom: 5px;
    text-align: center;
    border-bottom: 1px solid var(--border-color);
    color: var(--text-primary);
    font-size: 1.3rem;
}

.compare-section {
    margin: 20px 0;
    padding: 15px;
    background: var(--bg-secondary);
    border-radius: 8px;
}

.compare-section form {
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
}

.compare-section label {
    font-weight: bold;
    color: var(--text-primary);
}

.compare-section select {
    flex: 1;
    min-width: 200px;
    padding: 8px;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    background: var(--bg-primary);
    color: var(--text-primary);
}

.compare-section button {
    padding: 8px 16px;
    background: var(--hover-bg);
    color: var(--hover-text);
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-weight: bold;
}

.compare-section button:hover {
    opacity: 0.9;
}

.loading {
    text-align: center;
    padding: 40px;
    color: var(--text-secondary);
}

.error {
    background: #f8d7da;
    color: #721c24;
    padding: 15px;
    border-radius: 4px;
    margin: 20px 0;
}

/* Tablet-specific styles */
@media (max-width: 1024px) {
    .compare-container {
        gap: 15px;
    }
    
    .compare-team {
        padding: 15px;
    }
}

/* Mobile-specific styles (max-width: 768px) */
@media (max-width: 768px) {
    /* Ensure containers don't interfere with sticky */
    .container {
        overflow: visible;
    }
    
    /* Ensure main-content doesn't interfere with sticky */
    .main-content {
        overflow-x: auto;
        overflow-y: visible;
    }
    
    #comparison-content {
        position: relative;
    }
    
    #comparison-content > .compare-container:first-of-type {
        grid-template-columns: 1fr 1fr !important;
        gap: 10px;
        margin: 0 0 15px 0 !important;
        position: -webkit-sticky !important;
        position: sticky !important;
        top: 60px !important;
        background: var(--bg-primary) !important;
        backdrop-filter: blur(10px);
        z-index: 50 !important;
        padding: 10px 0;
        box-shadow: 0 2px 8px var(--shadow);
        border-bottom: 2px solid var(--border-color);
        margin-left: -1rem;
        margin-right: -1rem;
        padding-left: 1rem;
        padding-right: 1rem;
    }
    
    .compare-container {
        grid-template-columns: 1fr 1fr;
        gap: 10px;
        margin: 15px 0;
    }
    
    
    .compare-team {
        padding: 12px;
        margin-bottom: 0;
    }
    
    .compare-team h2 {
        font-size: 1.2rem;
        padding-bottom: 8px;
        text-align: center;
        word-break: break-word;
    }
    
    .stat-group {
        margin: 15px 0;
        padding: 12px;
    }
    
    .stat-comparison {
        grid-template-columns: 1fr 1fr;
        text-align: center;
        gap: 20px;
        padding: 8px 0;
        margin: 0;
        border-bottom: 1px solid var(--border-color);
        position: relative;
    }
    
    .stat-comparison:last-child {
        border-bottom: none;
    }
    
    .stat-label {
        position: absolute;
        left: 50%;
        transform: translateX(-50%);
        font-size: 0.95rem;
        padding: 0 8px;
        text-align: center;
        white-space: nowrap;
        background: var(--bg-secondary);
        z-index: 1;
    }
    
    .stat-value {
        margin: 0;
        font-size: 1rem;
    }
    
    .comparison-section {
        margin: 20px 0;
    }
    
    .comparison-section h3,
    .comparison-section h4,
    .comparison-section h5 {
        font-size: 1.3rem;
        margin: 15px 0 12px 0;
        padding-bottom: 5px;
        text-align: center;
        border-bottom: 1px solid var(--border-color);
    }
    
    .compare-section {
        margin: 15px 0;
        padding: 12px;
    }
    
    .compare-section form {
        flex-direction: column;
        align-items: stretch;
        gap: 12px;
    }
    
    .compare-section label {
        font-size: 1rem;
    }
    
    .compare-section select {
        width: 100%;
        min-width: unset;
        min-height: 44px; /* Touch-friendly size */
        font-size: 16px; /* Prevents zoom on iOS */
        padding: 10px;
    }
    
    .compare-section button {
        width: 100%;
        min-height: 44px; /* Touch-friendly size */
        font-size: 16px; /* Prevents zoom on iOS */
        padding: 12px;
    }
    
    /* Touch-friendly controls */
    button, select {
        min-height: 44px;
        min-width: 44px;
    }
    
    /* Spacing adjustments */
    .main-content {
        padding: 1rem;
    }
}
