/* User Stats styles
 * Includes: Shared statistics styles (merged from shared-stats.css)
 */

/* Header */
header {
    background: linear-gradient(135deg, var(--accent-primary) 0%, var(--accent-secondary) 100%);
    color: white;
    padding: 40px;
    text-align: center;
}

header h1 {
    font-size: 3em;
    margin-bottom: 10px;
    text-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
}

.subtitle {
    font-size: 1.2em;
    opacity: 0.9;
}

.container {
    background: transparent;
}

/* Disclaimer section */
.disclaimer-section {
    margin-bottom: 20px;
    padding: 15px 20px;
    background: var(--hover-bg);
    border-left: 4px solid var(--accent-secondary);
    border-radius: 8px;
}

.disclaimer-text {
    margin: 0;
    font-size: 0.95em;
    color: var(--text-secondary);
    line-height: 1.6;
}

.disclaimer-text strong {
    color: var(--accent-secondary);
    font-weight: 700;
}

.disclaimer-text em {
    font-style: italic;
    color: var(--text-primary);
}

/* Controls section */
.controls-section {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    margin-bottom: 30px;
    padding: 20px;
    background: var(--hover-bg);
    border-radius: 12px;
    border: 2px solid var(--border-color);
}

.control-group {
    display: flex;
    align-items: center;
    gap: 15px;
}

.control-group label {
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.control-group select {
    padding: 12px;
    padding-right: 40px;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    font-size: 1em;
    background: var(--card-bg);
    color: var(--text-primary);
    cursor: pointer;
    transition: border-color 0.3s;
    min-height: 48px;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23666' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 12px center;
    background-size: 18px;
}

@media (prefers-color-scheme: dark) {
    .control-group select {
        background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23b0b0b0' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e");
    }
}

.control-group select:focus {
    outline: none;
    border-color: var(--accent-primary);
}

/* Loading indicator */
.loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px;
    gap: 20px;
}

.spinner {
    width: 50px;
    height: 50px;
    border: 4px solid var(--border-color);
    border-top: 4px solid var(--accent-primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.loading p {
    font-size: 1.2em;
    color: var(--text-secondary);
}

/* Error message */
.error-message {
    background: var(--error-bg);
    border: 2px solid var(--error-bg);
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 20px;
    color: white;
    font-weight: 600;
    opacity: 0.9;
}

/* Table container */
.table-container {
    overflow-x: auto;
    max-width: 100%;
}

/* Stats table */
.stats-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    font-size: 0.9em;
}

.stats-table thead {
    background: var(--card-bg);
    color: var(--text-primary);
    border-bottom: 2px solid var(--border-color);
}

.stats-table th {
    padding: 15px 12px;
    text-align: right;
    font-weight: 600;
    white-space: nowrap;
    position: sticky;
    top: 0;
    z-index: 10;
    background: var(--card-bg);
    border-bottom: 2px solid var(--border-color);
}

.stats-table th.sticky-col {
    position: sticky;
    left: 0;
    z-index: 20;
    background: var(--card-bg);
    box-shadow: 2px 0 5px var(--card-shadow);
    text-align: left;
}

.stats-table tbody tr {
    border-bottom: 1px solid var(--border-color);
    transition: background-color 0.2s;
}

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

.stats-table tbody tr:last-child {
    border-bottom: none;
}

.stats-table td {
    padding: 12px;
    vertical-align: top;
    background: var(--card-bg);
}

.stats-table td.sticky-col {
    position: sticky;
    left: 0;
    z-index: 5;
    background: var(--card-bg);
    box-shadow: 2px 0 5px var(--card-shadow);
    font-weight: 600;
}

.stats-table tbody tr:hover td.sticky-col {
    background-color: var(--hover-bg);
}

.user-name {
    min-width: 200px;
    max-width: 200px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.user-link {
    color: var(--accent-primary);
    text-decoration: none;
    transition: color 0.3s ease;
    font-weight: 600;
}

.user-link:hover {
    color: var(--accent-secondary);
    text-decoration: underline;
}

/* Stat cell */
.stat-cell {
    text-align: right;
    font-size: 1.2em;
    font-weight: 600;
    color: var(--text-primary);
    min-width: 100px;
    padding: 15px 12px !important;
}

.no-data {
    color: var(--text-tertiary);
    font-size: 1.5em;
    font-weight: normal;
}

/* Community Stats Section */
.community-stats-section {
    padding: 30px 40px;
    margin-top: 40px;
}

.community-stats-section.stats-grid-2 {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 30px;
}

.community-stats-section h2 {
    font-size: 2.5em;
    margin-bottom: 30px;
    color: var(--text-primary);
    text-align: center;
}

/* Stats Overview */
.stats-overview {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 0;
}

.overview-stat {
    background: linear-gradient(135deg, var(--accent-primary) 0%, var(--accent-secondary) 100%);
    color: white;
    padding: 25px;
    border-radius: 16px;
    text-align: center;
    box-shadow: 0 4px 15px var(--card-shadow);
}

.overview-value {
    display: block;
    font-size: 2.5em;
    font-weight: bold;
}

.overview-label {
    display: block;
    font-size: 1em;
    opacity: 0.9;
    text-transform: uppercase;
    letter-spacing: 1px;
}

/* User List Items (page-specific) */
.user-list {
    display: flex;
    flex-direction: column;
    gap: 0;
}

/* User Items */
.user-item {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 12px;
    border-radius: 8px;
    transition: all 0.3s ease;
}

.user-item:hover {
    background: var(--hover-bg-alt);
    transform: translateX(5px);
}

.user-item .rank {
    font-size: 1.5em;
    font-weight: bold;
    color: var(--text-tertiary);
    min-width: 40px;
    text-align: center;
}

.user-profile {
    display: flex;
    align-items: center;
    gap: 12px;
    flex: 1;
    text-decoration: none;
    color: inherit;
}

.user-avatar {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    object-fit: cover;
    border: 3px solid var(--accent-primary);
}

.user-name {
    font-weight: 600;
    color: var(--text-primary);
}

.user-profile:hover .user-name {
    color: var(--accent-primary);
}

.user-item .value {
    font-weight: 600;
    color: var(--accent-secondary);
}

/* Performance Metrics */
.performance-metrics {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.metric-card {
    background: linear-gradient(135deg, var(--accent-primary) 0%, var(--accent-secondary) 100%);
    color: white;
    padding: 30px;
    border-radius: 16px;
    text-align: center;
    box-shadow: 0 4px 15px var(--card-shadow);
}

.metric-value {
    display: block;
    font-size: 2.5em;
    font-weight: bold;
    margin-bottom: 10px;
}

.metric-label {
    display: block;
    font-size: 1em;
    opacity: 0.9;
    text-transform: uppercase;
    letter-spacing: 1px;
}


/* Responsive design */
@media (max-width: 768px) {
    body {
        padding: 10px;
    }

    header {
        padding: 30px 20px;
    }

    header h1 {
        font-size: 2em;
    }

    .subtitle {
        font-size: 1em;
    }

    .stats-section, .community-stats-section {
        padding: 20px;
    }

    .stats-table {
        font-size: 0.8em;
    }

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

    .user-name {
        min-width: 150px;
        max-width: 150px;
    }

    .stat-cell {
        min-width: 120px;
    }

    .stats-overview {
        grid-template-columns: 1fr;
    }

    .community-stats-section.stats-grid-2 {
        grid-template-columns: 1fr;
    }
}

/* ==============================================
   SHARED STATISTICS (merged from shared-stats.css)
   ============================================== */

/* Stat Cards */

.stat-card.full-width {
    grid-column: 1 / -1;
}

.stat-card h3 {
    font-size: 1.8em;
    margin-bottom: 10px;
    color: var(--text-primary);
    border-bottom: 3px solid var(--accent-primary);
    padding-bottom: 10px;
}

.stat-description {
    color: var(--text-secondary);
    font-size: 0.9em;
    margin-bottom: 20px;
    font-style: italic;
}

/* Stat Lists */
.stat-list {
    display: flex;
    flex-direction: column;
    gap: 0;
}

.stat-item {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 12px;
    border-radius: 8px;
    transition: all 0.3s ease;
}

.stat-item:hover {
    background: var(--hover-bg);
    transform: translateX(5px);
}

.stat-item .rank {
    font-size: 1.5em;
    font-weight: bold;
    color: var(--text-tertiary);
    min-width: 40px;
    text-align: center;
}

.stat-item .name {
    flex: 1;
    font-weight: 600;
    color: var(--text-primary);
}

.stat-item .value {
    font-weight: 600;
    color: var(--accent-secondary);
    white-space: nowrap;
}

/* Car Make Links */
.car-make-link {
    flex: 1;
    font-weight: 600;
    color: var(--text-primary);
    text-decoration: none;
    transition: color 0.3s ease;
}

.car-make-link:hover {
    color: var(--accent-secondary);
    text-decoration: underline;
}

/* Stats Grid Layouts */
.stats-grid-2 {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 30px;
    margin-bottom: 30px;
}

/* Yearly Popularity */
.yearly-popularity {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
    gap: 30px;
}

.year-section h4 {
    font-size: 1.5em;
    color: var(--accent-primary);
    margin-bottom: 15px;
    text-align: left;
}

.year-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

/* Responsive Design for shared stats */
@media (max-width: 768px) {
    .stats-grid-2 {
        grid-template-columns: 1fr;
    }

    .yearly-popularity {
        grid-template-columns: 1fr;
    }

    .stat-item .rank {
        font-size: 1.2em;
        min-width: 30px;
    }

    .stat-card h3 {
        font-size: 1.5em;
    }
}
