#close-timeline-modal:hover {
    cursor: pointer;
    background-color: rgba(0, 0, 0, 0.171);
    padding: 0 5px 2px 5px;
    border-radius: 50px;
    /* position: sticky; */
    margin-right: -5px
}



/* Activity Timeline Styles */

.timeline-viz-container {
    margin: 20px 0;
    padding: 10px;
    background: #fff;
    border: 1px solid #e1e4e8;
    border-radius: 6px;
    /* overflow: hidden; Removed to prevent clipping */
}

/* Heatmap */
.heatmap-wrapper {
    overflow-x: auto;
    overflow-y: hidden;
    /* explicit */
    padding-bottom: 25px;
    /* Increased to fit scrollbar */
    /* Custom Scrollbar for better UX */
    scrollbar-width: thin;
    scrollbar-color: #c1c1c1 #f1f1f1;
}

.heatmap-wrapper::-webkit-scrollbar {
    height: 8px;
}

.heatmap-wrapper::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 4px;
}

.heatmap-months {

    display: flex;
    margin-bottom: 5px;
    font-size: 10px;
    color: #767676;
    padding-left: 2px;
    position: relative;
    height: 15px;
}

.heatmap-grid {
    display: flex;
    /* Horizontal flow of weeks */
    gap: 3px;
    width: max-content;
    padding: 2px;
    /* Prevent clipping */
}

.heatmap-week {
    display: grid;
    grid-template-rows: repeat(7, 12px);
    gap: 3px;
}

.heatmap-cell {
    width: 12px;
    height: 12px;
    border-radius: 2px;
    background-color: #ebedf0;
    cursor: pointer;
    transition: transform 0.1s;
    border: 1px solid transparent;
    /* Prevent jitter */
}

.heatmap-cell:hover {
    transform: scale(1.3);
    border: 1px solid rgba(0, 0, 0, 0.2);
    z-index: 2;
    /* Bring to front */
}

.heatmap-legend {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 12px;
    color: #586069;
    margin-top: 10px;
    justify-content: flex-end;
}

.heatmap-legend .legend-item {
    width: 12px;
    height: 12px;
    border-radius: 2px;
    display: inline-block;
}

/* Timeline Controls */
.timeline-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    flex-wrap: wrap;
    gap: 15px;
    background: #fafbfc;
    padding: 10px 15px;
    border-radius: 6px;
    border: 1px solid #e1e4e8;
}

.timeline-controls .filter-group {
    display: flex;
    align-items: center;
    gap: 10px;
}

.timeline-controls label {
    font-weight: 600;
    font-size: 14px;
    color: #24292e;
}

.form-select {
    padding: 5px 10px;
    border-radius: 6px;
    border: 1px solid #d1d5da;
    background-color: #fff;
    font-size: 14px;
    cursor: pointer;
}

.btn-icon {
    background: none;
    border: 1px solid #d1d5da;
    border-radius: 6px;
    padding: 5px 10px;
    cursor: pointer;
    color: #586069;
}

.btn-icon:hover {
    background-color: #f3f4f6;
    color: #24292e;
}

/* Stats */
.timeline-stats {
    display: flex;
    gap: 20px;
    justify-content: center;
    margin-top: 20px;
    flex-wrap: wrap;
    border-top: 1px solid #eee;
    padding-top: 20px;
}

.stat-card {
    background: #f6f8fa;
    border: 1px solid #e1e4e8;
    border-radius: 6px;
    padding: 15px;
    text-align: center;
    min-width: 140px;
    flex: 1;
}

.stat-card h4 {
    margin: 0;
    color: #24292e;
    font-size: 24px;
    font-weight: 600;
}

.stat-card p {
    margin: 5px 0 0;
    font-size: 12px;
    color: #586069;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Chart Container */
#timeline-chart-container {
    height: 300px;
    position: relative;
    padding: 10px;
}

/* Details Popup */
#timeline-details-popup .modal-content {
    border-radius: 8px;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.12);
}

.activity-details-list {
    font-size: 14px;
}

.detail-group h4 {
    font-size: 14px;
    font-weight: 600;
    color: #24292e;
}

.detail-group li:last-child {
    border-bottom: none;
}

/* Dark Mode Overrides */
body.dark-mode .timeline-viz-container {
    background: #2a2c1d;
    border-color: #3a3c2d;
}

body.dark-mode .timeline-controls {
    background: #2a2c1d;
    border-color: #3a3c2d;
}

body.dark-mode .timeline-controls label {
    color: #d4dd93;
}

body.dark-mode .stat-card {
    background: #2a2c1d;
    border-color: #3a3c2d;
}

body.dark-mode .stat-card h4 {
    color: #d4dd93;
}

body.dark-mode .stat-card p {
    color: #a0a87a;
}

body.dark-mode .detail-group h4 {
    color: #d4dd93;
}

body.dark-mode .heatmap-legend {
    color: #a0a87a;
}

body.dark-mode .heatmap-months {
    color: #a0a87a;
}

body.dark-mode .btn-icon {
    color: #a0a87a;
}

body.dark-mode .form-select {
    background-color: #1a1c0d;
    color: #d4dd93;
    border-color: #3a3c2d;
}

/* Responsive */
@media (max-width: 600px) {
    .timeline-controls {
        flex-direction: column;
        align-items: stretch;
    }

    .timeline-controls .filter-group {
        justify-content: space-between;
    }

    .timeline-stats {
        flex-direction: column;
    }

    .stat-card {
        width: 100%;
    }

    .heatmap-cell {
        width: 10px;
        height: 10px;
    }
}

/* Gray Mode Overrides */
body.gray-mode .timeline-viz-container {
    background: var(--bg-lighter);
    border-color: var(--border-medium);
}

body.gray-mode .timeline-controls {
    background: var(--bg-lighter);
    border-color: var(--border-medium);
}

body.gray-mode .timeline-controls label {
    color: var(--text-dark);
}

body.gray-mode .stat-card {
    background: var(--bg-lighter);
    border-color: var(--border-medium);
}

body.gray-mode .stat-card h4 {
    color: var(--text-dark);
}

body.gray-mode .stat-card p {
    color: var(--text-light);
}

body.gray-mode .detail-group h4 {
    color: var(--text-dark);
}

body.gray-mode .heatmap-legend {
    color: var(--text-light);
}

body.gray-mode .heatmap-months {
    color: var(--text-light);
}

body.gray-mode .btn-icon {
    color: var(--text-light);
}

body.gray-mode .form-select {
    background-color: var(--bg-white);
    color: var(--text-dark);
    border-color: var(--border-medium);
}