﻿/* =====================================================
   GEAR TAB - Gear Cards, Filters, Stats
   Mobile-first responsive with centralized colors
   ===================================================== */

#gear-tab.active {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-md);
    padding: var(--spacing-sm);
}

@media (min-width: 768px) {
    #gear-tab.active {
        padding: var(--spacing-md);
    }
}

/* ─── Gear Header ──────────────────────── */
.gear-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--spacing-lg);
    padding-bottom: var(--spacing-md);
    border-bottom: 2px solid var(--color-border);
    flex-wrap: wrap;
    gap: var(--spacing-md);
}

.gear-header h3 {
    font-size: var(--font-size-2xl);
    font-weight: var(--font-weight-bold);
    color: var(--color-text-dark);
    margin: 0;
}

@media (min-width: 768px) {
    .gear-header h3 {
        font-size: var(--font-size-3xl);
    }
}

/* ─── Edit Toggle Button ──────────────────────── */
.edit-toggle-btn {
    padding: var(--spacing-sm) var(--spacing-lg);
    background: linear-gradient(135deg, var(--color-secondary), #8b5cf6);
    color: white;
    border: none;
    border-radius: var(--radius-md);
    font-weight: var(--font-weight-semibold);
    font-size: var(--font-size-sm);
    cursor: pointer;
    transition: all var(--transition-fast);
    box-shadow: var(--shadow-sm);
}

.edit-toggle-btn:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

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

/* ─── Summary Bar ──────────────────────── */
.gear-summary-bar {
    display: flex;
    gap: var(--spacing-md);
    flex-wrap: wrap;
    margin-bottom: var(--spacing-lg);
    padding: var(--spacing-lg);
    background: linear-gradient(135deg, var(--color-bg-hover) 0%, var(--color-bg-main) 100%);
    border-radius: var(--radius-lg);
    border: 1px solid var(--color-border);
}

.gear-summary-stat {
    display: flex;
    align-items: center;
    gap: var(--spacing-md);
    flex: 1 1 120px;
    min-width: 0;
}

.gear-summary-stat>div {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-xs);
}

.summary-icon {
    font-size: var(--font-size-2xl);
    line-height: 1;
}

.summary-value {
    font-size: var(--font-size-xl);
    font-weight: var(--font-weight-bold);
    color: var(--color-text-dark);
    line-height: 1.2;
}

.summary-label {
    font-size: var(--font-size-xs);
    color: var(--color-text-light);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-weight: var(--font-weight-semibold);
}

.gear-summary-stat--alert .summary-value {
    color: var(--color-danger);
}

/* ─── Filter Bar ──────────────────────── */
#gear-filters {
    display: flex;
    gap: var(--spacing-sm);
    margin-bottom: var(--spacing-lg);
    flex-wrap: wrap;
    align-items: center;
}

.gear-filter-group {
    display: flex;
    gap: 0;
    background: var(--color-bg-hover);
    border-radius: var(--radius-md);
    padding: 3px;
    border: 1px solid var(--color-border-light);
}

.gear-filter-btn {
    background: transparent;
    border: none;
    border-radius: var(--radius-sm);
    padding: var(--spacing-sm) var(--spacing-md);
    cursor: pointer;
    transition: all var(--transition-fast);
    font-size: var(--font-size-sm);
    font-weight: var(--font-weight-semibold);
    color: var(--color-text-light);
}

.gear-filter-btn:hover {
    color: var(--color-text-dark);
    background: var(--color-bg-card);
}

.gear-filter-btn.active {
    background: var(--color-primary);
    color: white;
    box-shadow: var(--shadow-sm);
}

.gear-retired-toggle {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    font-size: var(--font-size-sm);
    color: var(--color-text-light);
    cursor: pointer;
    margin-left: auto;
    user-select: none;
}

.gear-retired-toggle input[type="checkbox"] {
    accent-color: var(--color-primary);
    width: 18px;
    height: 18px;
    cursor: pointer;
}

/* ─── Grid Layout ──────────────────────── */
.gear-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: var(--spacing-md);
}

@media (min-width: 640px) {
    .gear-grid {
        grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    }
}

@media (min-width: 1024px) {
    .gear-grid {
        grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
        gap: var(--spacing-lg);
    }
}


/* ÔöÇÔöÇ Gear Card ÔöÇÔöÇÔöÇÔöÇÔöÇÔöÇÔöÇÔöÇÔöÇÔöÇÔöÇÔöÇÔöÇÔöÇÔöÇÔöÇÔöÇÔöÇÔöÇÔöÇÔöÇÔöÇÔöÇÔöÇÔöÇÔöÇÔöÇÔöÇÔöÇÔöÇÔöÇ */
.gear-card {
    --accent: #3b82f6;
    background: white;
    border-radius: 16px;
    padding: 0;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06), 0 6px 16px rgba(0, 0, 0, 0.04);
    transition: all 0.35s cubic-bezier(.4, 0, .2, 1);
    position: relative;
    overflow: hidden;
    border: 1px solid #e5e7eb;
    display: flex;
    flex-direction: column;
}

.gear-card__accent {
    height: 4px;
    background: var(--accent);
    width: 100%;
    flex-shrink: 0;
}

.gear-card>*:not(.gear-card__accent):not(.status-badges) {
    padding-left: 1.25rem;
    padding-right: 1.25rem;
}

.gear-card>.status-badges {
    padding: 0.75rem 1.25rem 0;
}

.gear-card>*:last-child {
    padding-bottom: 1.25rem;
}

.gear-card:hover {
    transform: translateY(-6px);
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.1), 0 4px 12px rgba(0, 0, 0, 0.06);
    border-color: var(--accent);
}

.gear-card.retired {
    opacity: 0.65;
    border-color: #d1d5db;
    filter: grayscale(0.2);
}

.gear-card.retired:hover {
    transform: none;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06), 0 6px 16px rgba(0, 0, 0, 0.04);
}

.gear-card.retired .gear-card__accent {
    background: #9ca3af;
}

.gear-card.needs-replacement {
    border-color: #fca5a5;
    background: linear-gradient(180deg, #fff 60%, #fef2f2 100%);
}

.gear-card.needs-replacement .gear-card__accent {
    background: linear-gradient(90deg, #ef4444, #f97316);
    height: 5px;
}

/* Status Badges */
.status-badges {
    display: flex;
    gap: 0.4rem;
    flex-wrap: wrap;
}

.status-badge {
    display: inline-flex;
    align-items: center;
    padding: 0.2rem 0.65rem;
    border-radius: 20px;
    font-size: 0.65rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.6px;
}

.status-badge.retired {
    background: #f3f4f6;
    color: #6b7280;
}

.status-badge.primary {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    color: white;
}

.status-badge.alert {
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
    color: white;
    animation: pulse 2s infinite;
}

@keyframes pulse {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.7;
    }
}

/* Card Header */
.gear-card-header {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    padding-top: 1rem;
    padding-bottom: 0;
}

.gear-icon {
    font-size: 1.6rem;
    width: 46px;
    height: 46px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 12px;
    flex-shrink: 0;
}

.gear-title {
    min-width: 0;
    flex: 1;
}

.gear-title h4 {
    margin: 0;
    font-size: 1.05rem;
    font-weight: 700;
    color: #111827;
    line-height: 1.3;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.gear-type-chip {
    display: inline-block;
    margin-top: 0.3rem;
    padding: 0.15rem 0.55rem;
    border-radius: 6px;
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.gear-brand {
    margin: 0.2rem 0 0;
    font-size: 0.75rem;
    color: #9ca3af;
}

/* Distance Display */
.gear-distance-display {
    text-align: center;
    margin: 0.75rem 0 0.5rem;
    padding: 0.8rem 0.75rem;
    background: linear-gradient(135deg, #fafafa 0%, #f3f4f6 100%);
    border-radius: 12px;
    border: 1px solid #f0f0f0;
}

.distance-value {
    font-size: 2rem;
    font-weight: 800;
    background: linear-gradient(135deg, var(--accent), color-mix(in srgb, var(--accent) 70%, #000));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    line-height: 1;
}

.distance-unit {
    font-size: 0.95rem;
    color: #6b7280;
    font-weight: 600;
    margin-left: 0.2rem;
}

/* Durability Section */
.durability-section {
    margin: 0.5rem 0;
}

.durability-bar {
    height: 7px;
    background: #e5e7eb;
    border-radius: 999px;
    overflow: hidden;
    position: relative;
}

.durability-fill {
    height: 100%;
    border-radius: 999px;
    transition: all 0.6s ease;
    position: relative;
    overflow: hidden;
}

.durability-fill::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.35), transparent);
    animation: shimmer 2.5s infinite;
}

@keyframes shimmer {
    0% {
        transform: translateX(-100%);
    }

    100% {
        transform: translateX(100%);
    }
}

.durability-text {
    display: block;
    margin-top: 0.35rem;
    font-size: 0.78rem;
    color: #6b7280;
    text-align: center;
    font-weight: 500;
}

/* Replacement Estimate */
.gear-replacement-est {
    font-size: 0.78rem;
    color: #6b7280;
    text-align: center;
    padding: 0.35rem 0.5rem;
    margin: 0.25rem 0;
    background: #f0fdf4;
    border-radius: 8px;
    border: 1px solid #bbf7d0;
}

/* Stats Section */
.gear-stats {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    margin: 0.75rem 0 0.5rem;
    border-top: none;
    justify-content: initial;
}

.gear-stats .stat-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.4rem;
}

.gear-stats .stat-item {
    background: #f9fafb;
    padding: 0.55rem 0.65rem;
    border-radius: 10px;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    border: 1px solid #f3f4f6;
    transition: background 0.2s;
}

.gear-card:hover .stat-item {
    background: #f3f4f6;
}

.stat-icon-mini {
    font-size: 1rem;
    flex-shrink: 0;
    line-height: 1;
}

.stat-content {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.gear-stats .stat-label {
    font-size: 0.62rem;
    color: #9ca3af;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    line-height: 1.2;
}

.gear-stats .stat-value {
    font-size: 0.85rem;
    color: #111827;
    font-weight: 700;
    line-height: 1.3;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Replacement Alert */
.replacement-alert {
    background: linear-gradient(135deg, #fee2e2 0%, #fecaca 100%);
    color: #991b1b;
    padding: 0.75rem;
    border-radius: 10px;
    font-weight: 700;
    font-size: 0.85rem;
    text-align: center;
    margin-top: 0.5rem;
    border: 1px solid #fca5a5;
    animation: alertPulse 2s infinite;
}

@keyframes alertPulse {

    0%,
    100% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.01);
    }
}

/* Edit Section */
.gear-edit-section {
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 2px dashed #e5e7eb;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.edit-input-group {
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
}

.edit-input-group label {
    font-size: 0.8rem;
    font-weight: 600;
    color: #374151;
}

.edit-input-group input {
    padding: 0.55rem 0.75rem;
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    font-size: 0.85rem;
    transition: all 0.3s ease;
    width: 100%;
    box-sizing: border-box;
}

.edit-input-group input:focus {
    outline: none;
    border-color: #6366f1;
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

.save-gear-btn {
    padding: 0.65rem;
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    color: white;
    border: none;
    border-radius: 8px;
    font-weight: 600;
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(16, 185, 129, 0.3);
}

.save-gear-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.4);
}

.save-gear-btn.saved {
    background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
}

/* State Messages */
.empty-state,
.error-state,
.loading-state {
    text-align: center;
    padding: 3rem 2rem;
    font-size: 1.1rem;
    color: #6b7280;
}

.empty-state {
    background: linear-gradient(135deg, #f9fafb 0%, #f3f4f6 100%);
    border-radius: 16px;
    border: 2px dashed #d1d5db;
}

.error-state {
    background: linear-gradient(135deg, #fee2e2 0%, #fecaca 100%);
    color: #991b1b;
    border-radius: 16px;
    border: 2px solid #fca5a5;
}

.loading-state {
    background: linear-gradient(135deg, #dbeafe 0%, #bfdbfe 100%);
    color: #1e40af;
    border-radius: 16px;
    animation: loadingPulse 1.5s infinite;
}

@keyframes loadingPulse {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.7;
    }
}

/* Notification System */
.notification {
    position: fixed;
    top: 2rem;
    right: 2rem;
    padding: 1rem 1.5rem;
    border-radius: 12px;
    font-weight: 600;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.15);
    transform: translateX(400px);
    transition: transform 0.3s ease;
    z-index: 1000;
}

.notification.show {
    transform: translateX(0);
}

.notification-success {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    color: white;
}

.notification-error {
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
    color: white;
}

.notification-info {
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
    color: white;
}

/* ÔöÇÔöÇ Responsive ÔöÇÔöÇÔöÇÔöÇÔöÇÔöÇÔöÇÔöÇÔöÇÔöÇÔöÇÔöÇÔöÇÔöÇÔöÇÔöÇÔöÇÔöÇÔöÇÔöÇÔöÇÔöÇÔöÇÔöÇÔöÇÔöÇÔöÇÔöÇÔöÇÔöÇÔöÇ */
@media (max-width: 768px) {
    .gear-grid {
        grid-template-columns: 1fr;
    }

    .gear-summary-bar {
        gap: 0.75rem;
        padding: 0.85rem 1rem;
    }

    .gear-summary-stat {
        flex: 1 1 45%;
    }

    .summary-value {
        font-size: 1.1rem;
    }
}

@media (max-width: 480px) {
    .gear-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.75rem;
    }

    .gear-card-header {
        gap: 0.6rem;
    }

    .gear-icon {
        width: 40px;
        height: 40px;
        font-size: 1.4rem;
    }

    .gear-title h4 {
        font-size: 0.95rem;
    }

    .distance-value {
        font-size: 1.7rem;
    }

    .gear-stats .stat-item {
        padding: 0.45rem 0.5rem;
    }

    .gear-stats .stat-value {
        font-size: 0.78rem;
    }

    .gear-filter-group {
        width: 100%;
    }

    .gear-filter-btn {
        flex: 1;
        text-align: center;
    }

    .gear-retired-toggle {
        margin-left: 0;
    }

    .notification {
        right: 1rem;
        left: 1rem;
        top: 1rem;
    }
}



/* wrapped */
/* General Layout & Responsiveness */
.stats-grid,
.sport-breakdown,
.pb-grid,
.extras-grid {
    display: grid;
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.stats-grid {
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
}

.sport-breakdown {
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
}

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

.extras-grid {
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
}

@media (max-width: 768px) {

    .stats-grid,
    .sport-breakdown,
    .pb-grid,
    .extras-grid {
        grid-template-columns: 1fr;
    }
}

/* Section Headers */
.section-header {
    text-align: center;
    margin-bottom: 2rem;
    padding: 1rem 0;
    border-bottom: 1px solid rgba(0, 0, 0, 0.1);
}

.section-header h3 {
    font-size: 1.8rem;
    color: #333;
    margin-bottom: 0.5rem;
}

.section-subtitle {
    font-size: 0.95rem;
    color: #666;
}

/* --- Summary Cards --- */
.stat-card {
    background-color: #fff;
    padding: 1.5rem;
    border-radius: 12px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.08);
    text-align: center;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.stat-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.12);
}

.stat-icon {
    font-size: 2.3rem;
    margin-bottom: 0.8rem;
}

.stat-value {
    font-size: 1.2rem;
    font-weight: 700;
    color: #222;
    margin-bottom: 0.4rem;
}

.stat-label {
    font-size: 0.90rem;
    color: #777;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.quick-stats {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 1.5rem;
    margin-top: 1.5rem;
    margin-bottom: 3rem;
    background-color: #f8f9fa;
    padding: 1.5rem;
    border-radius: 12px;
    box-shadow: inset 0 2px 8px rgba(0, 0, 0, 0.05);
}

.quick-stat-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    min-width: 120px;
}

.quick-stat-label {
    font-size: 0.9rem;
    color: #888;
    margin-bottom: 0.3rem;
}

.quick-stat-value {
    font-size: 1.5rem;
    font-weight: 600;
    color: #444;
}

/* --- Sport Breakdown --- */
.sport-card {
    background-color: #fff;
    padding: 1.5rem;
    border-radius: 12px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.08);
    display: flex;
    flex-direction: column;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.sport-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.12);
}

.sport-card-header {
    display: flex;
    align-items: center;
    margin-bottom: 1rem;
}

.sport-icon {
    font-size: 2rem;
    margin-right: 1rem;
    width: 40px;
    text-align: center;
}

.sport-title {
    flex-grow: 1;
}

.sport-title h4 {
    margin: 0;
    font-size: 1.3rem;
    color: #333;
}

.sport-count {
    font-size: 0.85rem;
    color: #777;
}

.sport-share {
    font-size: 1.2rem;
    font-weight: 600;
    color: #007bff;
    /* Example accent color */
}

.sport-metrics {
    display: flex;
    justify-content: space-around;
    margin-bottom: 1rem;
    border-top: 1px solid #eee;
    padding-top: 1rem;
}

.metric {
    text-align: center;
}

.metric-label {
    font-size: 0.8rem;
    color: #888;
    margin-bottom: 0.2rem;
}

.metric-value {
    font-size: 1.1rem;
    font-weight: 600;
    color: #333;
}

.metric-change {
    font-size: 0.85rem;
    font-weight: 500;
}

.sport-progress {
    height: 8px;
    background-color: #e9ecef;
    border-radius: 4px;
    overflow: hidden;
    margin-top: 0.5rem;
}

.sport-progress-bar {
    height: 100%;
    background-color: #007bff;
    /* Example accent color */
    border-radius: 4px;
}

/* --- Activity Patterns (Histograms) --- */
.insights-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.insight-card {
    background-color: #fff;
    padding: 1.5rem;
    border-radius: 12px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.06);
    display: flex;
    align-items: center;
}

.insight-icon {
    font-size: 2rem;
    margin-right: 1rem;
}

.insight-label {
    font-size: 0.85rem;
    color: #888;
    margin-bottom: 0.2rem;
}

.insight-value {
    font-size: 1.3rem;
    font-weight: 600;
    color: #333;
}

.insight-detail {
    font-size: 0.8rem;
    color: #666;
}

/* Temporal Charts Combined */
.temporal-charts-combined {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    /* Adjust minmax as needed */
    gap: 1.5rem;
    margin-top: 2rem;
    margin-bottom: 3rem;
}

.chart-section {
    background-color: #fff;
    padding: 1.5rem;
    border-radius: 12px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.06);
}

.chart-title-sm {
    font-size: 1.1rem;
    color: #444;
    margin-bottom: 1rem;
    text-align: center;
    border-bottom: 1px dashed #eee;
    padding-bottom: 0.5rem;
}

.chart-container-compact {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    max-height: 250px;
    /* Limit height for monthly/weekly bars */
    overflow-y: auto;
    /* Scroll if too many months/days */
    padding-right: 5px;
    /* Space for scrollbar */
}

.chart-row {
    display: flex;
    align-items: center;
    font-size: 0.85rem;
}

.chart-label-sm {
    width: 60px;
    /* Adjust width for labels */
    flex-shrink: 0;
    color: #555;
    text-align: right;
    padding-right: 5px;
}

.chart-bar-container-sm {
    flex-grow: 1;
    height: 12px;
    background-color: #e9ecef;
    border-radius: 6px;
    margin: 0 8px;
    position: relative;
}

.chart-bar {
    height: 100%;
    background-color: #007bff;
    border-radius: 6px;
    transition: width 0.5s ease-out;
}

.chart-bar-secondary {
    background-color: #28a745;
    /* Green for weekly */
}

.chart-value-sm {
    width: 50px;
    /* Adjust width for values */
    flex-shrink: 0;
    color: #333;
    font-weight: 500;
    text-align: left;
}

.sport-hours {
    display: block;
    margin-top: 0.35rem;
    font-size: 2rem;
    line-height: 1;
    font-weight: 800;
    color: #111827;
}

.sport-hours-caption {
    display: block;
    margin-top: 0.2rem;
    font-size: 0.75rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: #6b7280;
}


/* Hour Chart Compact */
.hour-chart-compact {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    /* Bars start from bottom */
    height: 120px;
    /* Fixed height for the hour chart */
    margin-top: 1rem;
    padding: 0 5px;
    overflow-x: auto;
    /* Allow scrolling for many hours */
}

.hour-bar-compact {
    flex-shrink: 0;
    width: 15px;
    /* Fixed width for each hour bar */
    margin: 0 1px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-end;
    position: relative;
}

.hour-bar-fill-compact {
    width: 100%;
    background-color: #fd7e14;
    /* Orange for hourly */
    border-radius: 3px 3px 0 0;
    transition: height 0.5s ease-out;
}

.hour-label-compact {
    font-size: 0.7rem;
    color: #777;
    margin-top: 5px;
    transform: rotate(-45deg);
    /* Rotate labels for compactness */
    white-space: nowrap;
    position: absolute;
    bottom: -20px;
    /* Adjust as needed */
}

/* --- Hardest Workouts (compact version) --- */
.efforts-list-compact {
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
    /* Smaller gap */
}

.effort-card-compact {
    background-color: #fff;
    padding: 0.8rem 1.2rem;
    /* Reduced padding */
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
    display: flex;
    align-items: center;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.effort-card-compact:hover {
    transform: translateX(5px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

/* Compact preview + toggle helpers for Hardest Workouts */
.efforts-preview {
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
    margin-bottom: 0.5rem;
}

.efforts-full {
    margin-top: 0.6rem;
    max-height: 420px;
    overflow: auto;
    padding-right: 6px;
}

/* ================================================================= */
/* MOBILE OPTIMIZATIONS - PWA (max-width: 480px)                   */
/* ================================================================= */

@media (max-width: 480px) {
    :root {
        --border-radius-lg: 12px;
        --border-radius-md: 6px;
    }

    body {
        font-size: 14px;
        padding-bottom: 52px;
    }

    .container {
        padding: 0.5rem;
    }

    /* Header optimizations */
    .top-bar {
        flex-wrap: wrap;
        padding: 0.4rem 0;
        margin-bottom: 0.25rem;
    }

    .top-bar__brand {
        order: 1;
    }

    .top-bar__actions {
        order: 2;
        margin-left: auto;
    }

    .top-bar__logo {
        width: 24px;
        height: 24px;
    }

    .top-bar__title {
        font-size: 0.95rem;
    }

    .action-btn {
        width: 30px;
        height: 30px;
    }

    /* Tab Navigation - Make it sticky bottom */
    .tabs {
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        order: 3;
        width: 100%;
        display: flex;
        gap: 0;
        padding: 0;
        margin: 0;
        background: white;
        border-top: 1px solid var(--border-color);
        border-bottom: none;
        z-index: 999;
        box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.05);
        overflow-x: auto;
        overflow-y: hidden;
        flex: none;
    }

    .tab-link {
        flex: 0 0 auto;
        padding: 0.55rem 0.65rem;
        font-size: 0.68rem;
        text-align: center;
        min-width: 55px;
        border: none;
        border-radius: 0;
        background: transparent;
        color: var(--text-medium);
    }

    .tab-link.active {
        border-top: 2px solid var(--strava-orange);
        background: #fff5f0;
        color: var(--strava-orange);
    }

    .tab-wip-badge {
        top: 2px;
        right: 2px;
        font-size: 0.5rem;
        padding: 2px 3px;
    }

    /* Cards */
    .card,
    .chart-container {
        padding: 1rem 0.75rem;
        margin-bottom: 1rem;
        border-radius: 12px;
    }

    /* Grids */
    .summary-grid {
        grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
        gap: 0.75rem;
        margin-bottom: 1.5rem;
    }

    .charts-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
        margin-bottom: 1.5rem;
    }

    /* Settings Panel */
    .settings-panel {
        position: fixed;
        top: 0;
        right: 0;
        left: 0;
        width: 100%;
        height: 100%;
        max-width: 100%;
        background: rgba(0, 0, 0, 0.5);
        backdrop-filter: blur(4px);
        border: none;
        border-radius: 0;
        padding: 2rem 1rem 1rem;
        display: none;
        flex-direction: column;
        z-index: 2000;
        border-radius: 16px 16px 0 0;
        max-height: 70vh;
        overflow-y: auto;
    }

    .settings-panel.show {
        display: flex;
        background: white;
        top: auto;
        bottom: 0;
        border-radius: 16px 16px 0 0;
        box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.15);
    }

    .settings-panel select,
    .settings-panel input[type="number"] {
        width: 100%;
        padding: 0.5rem;
    }

    /* Buttons */
    button {
        padding: 0.6rem 1.2rem;
        font-size: 0.9rem;
        width: 100%;
        margin: 0.5rem 0;
    }

    /* Forms */
    input[type="date"],
    input[type="text"],
    input[type="number"],
    select {
        width: 100%;
        padding: 0.6rem;
        font-size: 16px;
        /* iOS fix: prevents zoom on input focus */
    }

    /* Stats cards */
    .stat-value {
        font-size: 1.3rem;
    }

    .stat-label {
        font-size: 0.8rem;
    }

    /* Charts */
    .chart-container canvas {
        aspect-ratio: 16 / 9;
        min-height: 180px;
        height: auto !important;
    }

    #global-map {
        height: 400px !important;
    }

    /* Maps */
    #global-map {
        height: 500px !important;
        border-radius: 12px;
    }

    .map-controls {
        flex-direction: column;
        gap: 0.5rem;
    }

    .map-controls .filter-group {
        width: 100%;
        flex-direction: column;
    }

    .map-controls button {
        width: 100%;
    }

    /* Activity list */
    .activity-item {
        padding: 1rem 0.75rem;
        margin-bottom: 0.75rem;
    }

    /* Heatmap/Calendar */
    .cal-heatmap {
        width: 100% !important;
        overflow-x: auto;
    }

    /* Tables */
    table {
        font-size: 0.85rem;
    }

    table th,
    table td {
        padding: 0.5rem;
    }

    /* Modal/Dialog */
    .modal-content,
    .dialog-box {
        width: 90vw;
        max-height: 90vh;
        margin: auto;
        padding: 1.5rem;
        border-radius: 12px;
    }

    /* Text sizes */
    h1 {
        font-size: 1.3rem;
    }

    h2 {
        font-size: 1.1rem;
    }

    h3 {
        font-size: 1rem;
    }

    p {
        font-size: 0.9rem;
        line-height: 1.4;
    }

    /* Margins & Padding */
    main {
        padding-bottom: 80px;
        /* Extra space for bottom nav */
    }
}

/* =============================================
   AI CHAT TAB
   ============================================= */

.ai-chat-wrapper {
    display: flex;
    flex-direction: column;
    height: calc(100vh - 180px);
    min-height: 500px;
    max-width: 860px;
    margin: 0 auto;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 2px 16px rgba(0, 0, 0, 0.08);
    overflow: hidden;
}

.ai-chat-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.25rem;
    background: linear-gradient(135deg, #FC5200 0%, #e04800 100%);
    color: #fff;
    flex-shrink: 0;
}

.ai-chat-title {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.ai-chat-icon {
    font-size: 1.8rem;
    line-height: 1;
}

.ai-chat-title h2 {
    margin: 0;
    font-size: 1.2rem;
    color: #fff;
}

.ai-chat-subtitle {
    margin: 0;
    font-size: 0.72rem;
    opacity: 0.85;
}

.ai-chat-clear-btn {
    background: rgba(255, 255, 255, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.4);
    color: #fff;
    border-radius: 6px;
    padding: 0.35rem 0.75rem;
    cursor: pointer;
    font-size: 0.82rem;
    transition: background 0.15s;
}

.ai-chat-clear-btn:hover {
    background: rgba(255, 255, 255, 0.35);
}

/* API Key banner */
.ai-apikey-banner {
    background: #fff8f0;
    border-bottom: 1px solid #ffe0cc;
    padding: 0.85rem 1.25rem;
    flex-shrink: 0;
}

.ai-apikey-info strong {
    display: block;
    margin-bottom: 0.2rem;
    color: #c04000;
}

.ai-apikey-info p {
    margin: 0 0 0.6rem;
    font-size: 0.85rem;
    color: #555;
}

.ai-apikey-info a {
    color: #FC5200;
}

.ai-apikey-form {
    display: flex;
    gap: 0.5rem;
}

.ai-apikey-form input {
    flex: 1;
    padding: 0.45rem 0.75rem;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 0.9rem;
}

.ai-apikey-form button {
    background: #FC5200;
    color: #fff;
    border: none;
    border-radius: 6px;
    padding: 0.45rem 1rem;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 600;
    transition: background 0.15s;
}

.ai-apikey-form button:hover {
    background: #e04800;
}

.ai-apikey-set {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.55rem 1.25rem;
    background: #f0fff0;
    border-bottom: 1px solid #c8e6c9;
    font-size: 0.85rem;
    color: #2e7d32;
    flex-shrink: 0;
}

.ai-apikey-set button {
    background: none;
    border: 1px solid #2e7d32;
    color: #2e7d32;
    border-radius: 5px;
    padding: 0.2rem 0.6rem;
    cursor: pointer;
    font-size: 0.8rem;
}

.ai-apikey-set button:hover {
    background: #e8f5e9;
}

/* Messages area */
.ai-chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 1rem 1.25rem;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    background: #f9f9f9;
}

.ai-chat-welcome {
    margin: auto;
    text-align: center;
    color: #666;
    max-width: 480px;
}

.ai-chat-welcome p {
    margin-bottom: 0.85rem;
    font-size: 0.95rem;
}

.ai-chat-suggestions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    justify-content: center;
}

.ai-suggestion-btn {
    background: #fff;
    border: 1.5px solid #FC5200;
    color: #FC5200;
    border-radius: 20px;
    padding: 0.4rem 0.9rem;
    font-size: 0.82rem;
    cursor: pointer;
    transition: all 0.15s;
    text-align: left;
}

.ai-suggestion-btn:hover {
    background: #FC5200;
    color: #fff;
}

/* Individual messages */
.ai-msg {
    display: flex;
    max-width: 80%;
}

.ai-msg--user {
    align-self: flex-end;
    flex-direction: row-reverse;
}

.ai-msg--model {
    align-self: flex-start;
}

.ai-msg-bubble {
    padding: 0.65rem 1rem;
    border-radius: 16px;
    font-size: 0.9rem;
    line-height: 1.55;
    word-break: break-word;
}

.ai-msg--user .ai-msg-bubble {
    background: #FC5200;
    color: #fff;
    border-bottom-right-radius: 4px;
}

.ai-msg--model .ai-msg-bubble {
    background: #fff;
    color: #222;
    border: 1px solid #e8e8e8;
    border-bottom-left-radius: 4px;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.06);
}

/* Typing indicator */
.ai-typing .ai-msg-bubble {
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 0.75rem 1rem;
}

.ai-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #aaa;
    animation: ai-bounce 1.2s infinite ease-in-out;
}

.ai-dot:nth-child(2) {
    animation-delay: 0.2s;
}

.ai-dot:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes ai-bounce {

    0%,
    80%,
    100% {
        transform: scale(0.7);
        opacity: 0.5;
    }

    40% {
        transform: scale(1);
        opacity: 1;
    }
}

/* Input area */
.ai-chat-input-area {
    display: flex;
    align-items: flex-end;
    gap: 0.5rem;
    padding: 0.75rem 1rem;
    border-top: 1px solid #eee;
    background: #fff;
    flex-shrink: 0;
}

.ai-chat-input-area textarea {
    flex: 1;
    border: 1.5px solid #ddd;
    border-radius: 10px;
    padding: 0.6rem 0.9rem;
    font-size: 0.92rem;
    resize: none;
    font-family: inherit;
    outline: none;
    transition: border-color 0.15s;
    line-height: 1.45;
}

.ai-chat-input-area textarea:focus {
    border-color: #FC5200;
}

.ai-chat-input-area textarea:disabled {
    background: #f5f5f5;
    color: #999;
}

.ai-chat-input-area button {
    background: #FC5200;
    border: none;
    border-radius: 10px;
    width: 42px;
    height: 42px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: #fff;
    flex-shrink: 0;
    transition: background 0.15s;
}

.ai-chat-input-area button:hover:not(:disabled) {
    background: #e04800;
}

.ai-chat-input-area button:disabled {
    background: #ccc;
    cursor: not-allowed;
}

/* Mobile adjustments */
@media (max-width: 600px) {
    .ai-chat-wrapper {
        height: calc(100vh - 140px);
        border-radius: 0;
        box-shadow: none;
    }

    .ai-msg {
        max-width: 92%;
    }

    .ai-chat-subtitle {
        display: none;
    }
}

.btn-small {
    background: linear-gradient(90deg, var(--accent) 0%, var(--accent-2) 100%);
    color: #fff;
    border: none;
    padding: 0.45rem 0.8rem;
    border-radius: 8px;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    box-shadow: 0 4px 10px rgba(79, 70, 229, 0.12);
}

.btn-small:hover {
    transform: translateY(-1px);
}

.effort-rank {
    font-size: 1.1rem;
    font-weight: 700;
    color: #007bff;
    margin-right: 1rem;
    min-width: 30px;
    text-align: center;
}

.effort-content-compact {
    flex-grow: 1;
}

.effort-title-compact {
    margin: 0;
    font-size: 1rem;
    color: #333;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.effort-meta-compact {
    font-size: 0.75rem;
    color: #888;
    margin-bottom: 0.4rem;
}

.effort-score-bar-compact {
    height: 6px;
    /* Smaller bar */
    background-color: #eee;
    border-radius: 3px;
    overflow: hidden;
}

.effort-score-fill-compact {
    height: 100%;
    background-color: #dc3545;
    /* Red accent */
    border-radius: 3px;
    transition: width 0.4s ease-out;
}

.effort-score-compact {
    font-size: 1.1rem;
    font-weight: 600;
    color: #dc3545;
    margin-left: 1rem;
    min-width: 40px;
    text-align: right;
}

/* --- Personal Bests --- */
.pb-category {
    background-color: #fff;
    padding: 1.5rem;
    border-radius: 12px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.08);
}

.pb-category-header {
    display: flex;
    align-items: center;
    margin-bottom: 1rem;
    padding-bottom: 0.8rem;
    border-bottom: 1px dashed #eee;
}

.pb-icon {
    font-size: 1.8rem;
    margin-right: 0.8rem;
}

.pb-category-header h4 {
    margin: 0;
    font-size: 1.25rem;
    color: #333;
}

.pb-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.6rem 0;
    border-bottom: 1px dotted #f0f0f0;
}

.pb-item:last-child {
    border-bottom: none;
}

.pb-distance {
    font-weight: 600;
    color: #444;
    flex-grow: 1;
}

.pb-time {
    font-size: 0.95rem;
    color: #555;
    margin-left: 1rem;
}

.pb-attempts {
    font-size: 0.8rem;
    color: #888;
    margin-left: 0.5rem;
}

.pb-highlights .pb-highlight {
    padding: 0.6rem;
    border-bottom: none;
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
    flex: 1 1 220px;
    min-width: 220px;
}

.pb-highlights .pb-highlight:last-child {
    margin-right: 0;
}

.pb-highlight-label {
    font-size: 0.85rem;
    color: #888;
    margin-bottom: 0.3rem;
}

.pb-activity strong {
    font-size: 1rem;
    color: #333;
    display: block;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.pb-details,
.pb-date {
    font-size: 0.75rem;
    color: #777;
}

/* --- Gear & Countries (Extras) --- */
.extra-section {
    background-color: #fff;
    padding: 1.5rem;
    border-radius: 12px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.08);
}

.gear-list,
.country-list {
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
}

.gear-item,
.country-item {
    display: flex;
    align-items: center;
    font-size: 0.9rem;
    padding: 0.3rem 0;
}

.gear-name,
.country-name {
    flex-basis: 100px;
    /* Fixed width for names */
    flex-shrink: 0;
    color: #444;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.gear-bar-container,
.country-bar-container {
    flex-grow: 1;
    height: 8px;
    background-color: #e9ecef;
    border-radius: 4px;
    margin: 0 10px;
    overflow: hidden;
}

.gear-bar {
    height: 100%;
    background-color: #ffc107;
    /* Yellow accent */
    border-radius: 4px;
    transition: width 0.5s ease-out;
}

.gear-hours,
.country-count {
    width: 50px;
    /* Fixed width for values */
    text-align: right;
    font-weight: 500;
    color: #555;
}

.country-bar {
    height: 100%;
    background-color: #17a2b8;
    /* Cyan accent */
    border-radius: 4px;
    transition: width 0.5s ease-out;
}

/* --- Global Heatmap --- */
#wrapped-heatmap {
    height: 500px;
    /* Ensure map has a height */
    width: 100%;
    margin-top: 2rem;
    margin-bottom: 3rem;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    overflow: hidden;
    /* Important for map corners */
    position: relative;
    /* For header positioning */
}

#wrapped-heatmap .leaflet-pane {
    z-index: 10;
    /* Ensure map content is above other page elements if needed */
}

.heatmap-header {
    position: absolute;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 1000;
    /* Ensure header is above the map */
    background: rgba(255, 255, 255, 0.85);
    padding: 0.8rem 1.5rem;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
    width: auto;
    /* Adjust width based on content */
    border-bottom: none;
    /* Remove border-bottom from general header */
}

.heatmap-header h3 {
    margin: 0;
    font-size: 1.4rem;
    color: #333;
}

.heatmap-header .section-subtitle {
    margin-top: 0.3rem;
    font-size: 0.85rem;
    color: #666;
}

/* --- Activities Table --- */
.activities-table-container {
    overflow-x: auto;
    margin-top: 2rem;
    margin-bottom: 3rem;
    background-color: #fff;
    border-radius: 12px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.08);
}

.activities-table {
    width: 100%;
    border-collapse: collapse;
    min-width: 700px;
    /* Ensure table doesn't get too cramped */
}

.activities-table th,
.activities-table td {
    padding: 1rem 1.2rem;
    text-align: left;
    border-bottom: 1px solid #eee;
}

.activities-table th {
    background-color: #f8f9fa;
    color: #555;
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.85rem;
    letter-spacing: 0.5px;
    position: sticky;
    top: 0;
    z-index: 2;
    /* Keep header visible on scroll */
}

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

.activities-table tbody tr:hover {
    background-color: #f4f7fa;
}

.table-date {
    font-size: 0.9rem;
    color: #777;
}

.table-name {
    font-weight: 500;
    color: #333;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 250px;
    /* Limit width */
}

.type-badge {
    background-color: #e0f2f7;
    /* Light blue */
    color: #007bff;
    padding: 0.3em 0.7em;
    border-radius: 15px;
    font-size: 0.75rem;
    font-weight: 500;
}

.table-distance,
.table-time {
    color: #555;
    font-size: 0.9rem;
}

.table-pace {
    font-style: italic;
    color: #666;
    font-size: 0.9rem;
}

.table-link {
    color: #007bff;
    text-decoration: none;
    font-weight: 500;
    transition: color 0.2s ease;
}

.table-link:hover {
    color: #0056b3;
}

/* Utility classes for animations */
.fade-in-up {
    opacity: 0;
    transform: translateY(20px);
    animation: fadeInUp 0.5s ease-out forwards;
}

@keyframes fadeInUp {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 2rem;
    color: #777;
    font-style: italic;
    background-color: #f8f8f8;
    border-radius: 8px;
    margin-bottom: 2rem;
}

/* ------------------------------------------------------------------
   Overrides & modern tweaks (final layer)
   Ensures stat values fit inside cards and modern Solo vs Group look
------------------------------------------------------------------ */

/* Force stat values to be compact and wrap where needed */
.stats-grid .stat-card .stat-value,
.stat-card .stat-value {
    font-size: 1.2rem;
    font-weight: 700;
    line-height: 1.05;
    white-space: normal;
    overflow-wrap: anywhere;
}

/* Ensure monthly/compact charts show all rows without overflow */
.chart-container-compact {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    max-height: none;
}

.chart-container-compact .chart-row {
    padding: 0.28rem 0;
}

.chart-container-compact .chart-label {
    width: 78px;
    font-size: 0.78rem;
}

.chart-container-compact .chart-bar {
    height: 9px;
}

/* Modern Solo vs Group widget (final polish) */
.solo-compare-card {
    display: block;
    width: 100%;
    background: linear-gradient(180deg, #ffffff 0%, #fbfbff 100%);
    border-radius: 12px;
    padding: 0.85rem;
    box-shadow: 0 6px 24px rgba(15, 23, 42, 0.04);
    border: 1px solid rgba(15, 23, 42, 0.04);
}

.mini-bar {
    background: #f1f5f9;
    height: 9px;
    border-radius: 999px;
    overflow: hidden;
}

.mini-bar-fill {
    height: 100%;
    border-radius: 999px;
    transition: width 0.5s ease;
}

.mini-bar-fill.solo {
    background: linear-gradient(90deg, #667eea 0%, #764ba2 100%);
}

.mini-bar-fill.group {
    background: linear-gradient(90deg, #06b6d4 0%, #00b894 100%);
}

@media (max-width: 700px) {
    .stats-grid .stat-card .stat-value {
        font-size: 1rem;
    }

    .chart-container-compact .chart-label {
        width: 60px;
        font-size: 0.72rem;
    }
}

/* ------------------------------------------------------------------
   Unified card styling for a consistent, professional look
------------------------------------------------------------------ */
.stat-card,
.sport-card,
.pb-category,
.effort-card,
.effort-card-compact,
.extra-section,
.chart-container {
    background: #fff;
    border-radius: 12px;
    border: 1px solid rgba(15, 23, 42, 0.04);
    box-shadow: 0 8px 26px rgba(15, 23, 42, 0.04);
}

/* Make stat icons purely decorative (no emoji) and consistent */
.stat-icon {
    width: 56px;
    height: 56px;
    border-radius: 10px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--accent) 0%, var(--accent-2) 100%);
    color: #fff;
    box-shadow: 0 6px 14px rgba(79, 70, 229, 0.08);
}

/* Sport breakdown responsive: 3 cols desktop, 2 tablet, 1 mobile */
.sport-breakdown {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
}

@media (max-width: 1000px) {
    .sport-breakdown {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 640px) {
    .sport-breakdown {
        grid-template-columns: 1fr;
    }
}

/* Slight padding/tone unification for sport-card header */
.sport-card-header {
    padding-bottom: 0.6rem;
    border-bottom: 1px solid rgba(0, 0, 0, 0.04);
}

/* ==========================================================================
   GEAR DETAIL PAGE STYLES
   ========================================================================== */

.gear-stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin-top: 1rem;
}

.gear-stats-grid .stat-card {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    padding: 1rem;
    border-radius: 12px;
    color: white;
    text-align: center;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.2);
}

.gear-advanced-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 1.5rem;
    margin-top: 1rem;
}

.advanced-section {
    background: #f8f9fa;
    padding: 1.5rem;
    border-radius: 12px;
    border: 1px solid #e9ecef;
}

.advanced-section h4 {
    margin: 0 0 1rem 0;
    color: #495057;
    font-size: 1.1rem;
}

.advanced-stats {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.advanced-stats .stat-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.5rem 0;
    border-bottom: 1px solid #dee2e6;
}

.advanced-stats .stat-item:last-child {
    border-bottom: none;
}

.advanced-stats .stat-label {
    font-weight: 600;
    color: #6c757d;
    font-size: 0.9rem;
}

.advanced-stats .stat-value {
    font-weight: 700;
    color: #495057;
    font-size: 0.95rem;
}

.gear-activities-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
    gap: 1rem;
    margin-top: 1rem;
}

.gear-activity-card {
    background: white;
    border: 1px solid #e9ecef;
    border-radius: 12px;
    padding: 1.25rem;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    transition: transform 0.2s, box-shadow 0.2s;
}

.gear-activity-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
}

.activity-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 1rem;
}

.activity-header h4 {
    margin: 0;
    font-size: 1.1rem;
    color: #495057;
    flex: 1;
    margin-right: 1rem;
}

.activity-date {
    font-size: 0.85rem;
    color: #6c757d;
    white-space: nowrap;
}

.activity-stats {
    display: flex;
    gap: 1rem;
    margin-bottom: 0.75rem;
}

.activity-stat {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
}

.activity-stat .stat-value {
    font-size: 1.2rem;
    font-weight: 700;
    color: #495057;
}

.activity-stat .stat-unit {
    font-size: 0.75rem;
    color: #6c757d;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.achievement-badge {
    background: linear-gradient(135deg, #ffd700 0%, #ffb347 100%);
    color: #8b4513;
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 600;
    display: inline-block;
    margin-top: 0.5rem;
}

.activities-summary {
    background: #e7f3ff;
    padding: 1rem;
    border-radius: 8px;
    margin-bottom: 1rem;
    text-align: center;
    color: #0066cc;
    font-weight: 600;
}

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

thead {
    background: #03a9f4;
}

tbody tr:nth-child(even) {
    background: #f5f5f5;
}

tbody tr:hover {
    background: #e8f4ff;
}

tbody tr:nth-child(even) {
    background: #f5f5f5;
}

tbody tr:hover {
    background: #e8f4ff;
}

.swim-badge {
    padding: 2px 8px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 600;
}

.swim-badge.pool {
    background: #0077cc20;
    color: #0077cc;
}

.swim-badge.openwater {
    background: #00b89420;
    color: #00b894;
}

td,
th {
    padding: 8px 10px;
}

.pool-badge {
    padding: 3px 8px;
    border-radius: 6px;
    font-size: 11px;
    font-weight: 600;
    color: white;
}

/* 20m */
.pool-20 {
    background-color: #10b981;
}

/* 25m */
.pool-25 {
    background-color: #2563eb;
}

/* 50m */
.pool-50 {
    background-color: #7c3aed;
}

/* unknown */
.pool-unknown {
    background-color: #9ca3af;
}

.bike-type-badge {
    padding: 3px 8px;
    border-radius: 6px;
    font-size: 11px;
    font-weight: 600;
    color: white;
    display: inline-block;
}

.bike-type-road {
    background-color: #fc5200;
}

.bike-type-mtb {
    background-color: #2e7d32;
}

.bike-type-indoor {
    background-color: #1976d2;
}

.bike-type-gravel {
    background-color: #b58600;
}

.bike-type-electric {
    background-color: #7c3aed;
}

/* =================================================================
   TAB BACKGROUND IMAGES
   Place photos in /media/ using the names listed in media/README.md.
   Adjust --tab-bg-overlay to control how transparent the overlay is
   (0 = full photo, 1 = no photo visible).
   ================================================================= */

:root {
    --tab-bg-overlay: rgba(255, 255, 255, 0.55);
}

.tab-content {
    background-size: cover;
    background-position: center center;
    background-repeat: no-repeat;
    background-attachment: fixed;
}

html[data-tab-background-images='off'] .tab-content {
    background-image: none !important;
    background-color: var(--bg-page);
}

#dashboard-tab.tab-content {
    background-image:
        linear-gradient(var(--tab-bg-overlay), var(--tab-bg-overlay)),
        url('../media/bg-dashboard.jpg');
}

#run-tab.tab-content {
    background-image:
        linear-gradient(var(--tab-bg-overlay), var(--tab-bg-overlay)),
        url('../media/bg-run.jpg');
}

#bike-tab.tab-content {
    background-image:
        linear-gradient(var(--tab-bg-overlay), var(--tab-bg-overlay)),
        url('../media/bg-bike.jpg');
}

#swim-tab.tab-content {
    background-image:
        linear-gradient(var(--tab-bg-overlay), var(--tab-bg-overlay)),
        url('../media/bg-swim.jpg');
}


/* Legacy gear/country lists */
.gear-list,
.country-list {
    display: grid;
    gap: 1rem;
}

.gear-item,
.country-item {
    display: grid;
    grid-template-columns: 1fr 2fr auto;
    align-items: center;
    gap: 1rem;
    padding: 0.5rem;
    border-radius: 6px;
    transition: background 0.2s ease;
}

.gear-item:hover,
.country-item:hover {
    background: #f8f9fa;
}

.gear-name,
.country-name {
    font-weight: 500;
    color: #1a1a1a;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.gear-bar-container,
.country-bar-container {
    height: 8px;
    background: #f1f3f5;
    border-radius: 4px;
    overflow: hidden;
}

.gear-bar,
.country-bar {
    height: 100%;
    background: linear-gradient(90deg, #10b981 0%, #059669 100%);
    border-radius: 4px;
    animation: slideIn 0.8s ease-out;
    box-shadow: 0 0 8px rgba(16, 185, 129, 0.3);
}

.gear-hours,
.country-count {
    font-weight: 600;
    color: #10b981;
    text-align: right;
}