:root {
    --bg-color: #1a202c;
    --text-color: #f7fafc;
    --accent-color: #68d391;
    --secondary-color: #a0aec0;
    --border-color: #2d3748;
    --progress-bg: #2d3748;
    --progress-border: #4a5568;
    --dot-inactive: #4a5568;
    --dot-active: var(--accent-color);
    --shadow-light: rgba(0, 0, 0, 0.3);
}

[data-theme="light"] {
    --bg-color: #fdfcfa;
    --text-color: #1a1612;
    --accent-color: #2f855a;
    --secondary-color: #3d4852;
    --border-color: #8b7d6b;
    --progress-bg: #f0ebe5;
    --progress-border: #8b7d6b;
    --dot-inactive: #d4c4b0;
    --dot-active: #22543d;
    --shadow-light: rgba(139, 125, 107, 0.2);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    font-weight: 400;
    font-size: 16px;
    background-color: var(--bg-color);
    color: var(--text-color);
    line-height: 1.6;
    transition: background-color 0.3s, color 0.3s;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

.header {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 0 10px;
    margin-bottom: 1em;
}

.profile-section {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1.8em;
    padding-top: 1.8em;
}

.profile-image {
    width: 12em;
    height: 12em;
    border-radius: 50%;
    overflow: hidden;
    border: 3px solid var(--accent-color);
    transition: transform 0.2s ease;
}

.profile-image:hover {
    transform: scale(1.05);
}

.profile-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.social-links-header {
    display: flex;
    gap: 15px;
    align-items: center;
}

.social-link-header {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 42px;
    height: 42px;
    border-radius: 50%;
    background: var(--bg-color);
    border: 2px solid var(--border-color);
    text-decoration: none;
    transition: all 0.2s ease;
    box-shadow: 0 2px 6px var(--shadow-light);
}

.social-link-header:hover {
    transform: scale(1.1);
    border-color: var(--accent-color);
    box-shadow: 0 4px 12px var(--shadow-light);
}

.social-icon-header {
    font-size: 1.2em;
}

.social-icon-svg {
    width: 20px;
    height: 20px;
    fill: var(--text-color);
    transition: fill 0.2s ease;
}

.social-link-header:hover .social-icon-svg {
    fill: var(--accent-color);
}

/* Milestones Button */
.milestones-button {
    font-size: 20px;
    background: var(--bg-color) !important;
    border: 2px solid var(--border-color) !important;
    cursor: pointer;
    position: relative;
}

.milestones-button:hover {
    border-color: var(--accent-color) !important;
    transform: scale(1.1);
}

.milestones-button.active {
    border-color: var(--accent-color) !important;
    background: var(--accent-color) !important;
    color: var(--bg-color);
}

/* Milestones Section */
.milestones-section {
    margin: 30px 0;
    padding: 25px;
    border: 1px solid var(--border-color);
    border-radius: 12px;
    background: var(--bg-color);
    animation: fadeIn 0.3s ease-in-out;
}

.milestones-section h2 {
    margin-bottom: 20px;
    color: var(--text-color);
    font-size: 1.5em;
    font-weight: 600;
}

.milestones-container {
    display: grid;
    gap: 15px;
}

.milestone-item {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 15px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background: var(--progress-bg);
    transition: all 0.2s ease;
}

.milestone-item:hover {
    border-color: var(--accent-color);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px var(--shadow-light);
}

.milestone-icon {
    font-size: 24px;
    line-height: 1;
    min-width: 24px;
}

.milestone-content {
    flex: 1;
}

.milestone-name {
    font-weight: 600;
    color: var(--text-color);
    margin-bottom: 4px;
}

.milestone-description {
    color: var(--secondary-color);
    font-size: 0.9em;
    margin-bottom: 8px;
}

.milestone-date {
    font-size: 0.85em;
    color: var(--secondary-color);
    font-style: italic;
}

.milestone-achieved {
    border-left: 4px solid var(--accent-color);
}

.milestone-pending {
    border-left: 4px solid var(--secondary-color);
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(-10px); }
    to { opacity: 1; transform: translateY(0); }
}

.footer {
    margin-top: 50px;
    padding: 20px 0;
    display: flex;
    justify-content: center;
    align-items: center;
    border-top: 1px solid var(--border-color);
}


.progress-section {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 25px;
    margin-bottom: 35px;
}

.progress-group h3 {
    font-family: 'Chicle', cursive;
    margin-bottom: 18px;
    font-size: 1.5em;
    font-weight: 400;
    color: var(--text-color);
    padding-bottom: 8px;
    letter-spacing: 0.5px;
    border-bottom: 3px solid var(--accent-color);
    border-radius: 2px;
}

.progress-bars {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.progress-item {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.progress-header {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
}

.progress-item label {
    font-size: 1.1em;
    font-weight: 500;
    color: var(--secondary-color);
}

.progress-bar {
    position: relative;
    height: 8px;
    background-color: var(--progress-bg);
    border-radius: 4px;
    overflow: visible;
    box-shadow: inset 0 1px 2px var(--shadow-light);
}


.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--accent-color) 0%, #38a169 100%);
    transition: width 0.4s ease-out;
    border-radius: 4px;
}

.progress-text {
    font-size: 0.95em;
    font-weight: 500;
    color: var(--secondary-color);
}

.macro-bar {
    display: flex;
    overflow: hidden;
    background-color: var(--progress-bg);
    box-shadow: inset 0 1px 2px var(--shadow-light);
    border-radius: 4px;
}

.macro-segment {
    height: 8px;
    border-radius: 0;
    transition: all 0.4s ease-out;
}

.protein-segment {
    background-color: #e74c3c;
    width: 30%;
}

.carbs-segment {
    background-color: #f39c12;
    width: 40%;
}

.fats-segment {
    background-color: #3498db;
    width: 30%;
}

.stats-grid {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.stat-item {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
}

.stat-header label {
    font-size: 1.1em;
    font-weight: 500;
    color: var(--secondary-color);
}

.stat-values {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 2px;
}

.stat-recent {
    font-size: 1.1em;
    font-weight: 600;
    color: var(--text-color);
}

.stat-total {
    font-size: 0.85em;
    font-weight: 400;
    color: var(--secondary-color);
}

.nutrition-section {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.nutrition-stats {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.category-stats {
    margin-bottom: 0;
    padding: 0;
    border: 2px solid var(--border-color);
    border-radius: 12px;
    background-color: var(--bg-color);
    box-shadow: 0 4px 12px var(--shadow-light);
    opacity: 0;
    transform: translateY(-10px);
    transition: all 0.7s ease-out;
    max-height: 0;
    overflow: hidden;
}

.category-stats.show {
    opacity: 1;
    transform: translateY(0);
    max-height: 1000px;
    padding: 30px;
    margin-bottom: 30px;
}

.cardio-stats {
    opacity: 0;
    max-height: 0;
    overflow: hidden;
    transition: all 0.5s ease-out;
}

.cardio-stats.show {
    opacity: 1;
    max-height: 1000px;
}

.lifting-stats {
    opacity: 0;
    max-height: 0;
    overflow: hidden;
    transition: all 0.3s ease-out;
}

.lifting-stats.show {
    opacity: 1;
    max-height: 1000px;
}

.diet-stats {
    opacity: 0;
    max-height: 0;
    overflow: hidden;
    transition: all 0.3s ease-out;
}

.diet-stats.show {
    opacity: 1;
    max-height: 1000px;
}

.cardio-detailed-stats {
    opacity: 0;
    max-height: 0;
    overflow: hidden;
    transition: all 0.5s ease-out;
}

.cardio-detailed-stats.show {
    opacity: 1;
    max-height: 1000px;
}

.cardio-stats h3,
.cardio-detailed-stats h3,
.lifting-stats h3,
.diet-stats h3 {
    font-family: 'Chicle', cursive;
    margin-bottom: 18px;
    font-size: 1.4em;
    font-weight: 400;
    color: var(--text-color);
    padding-bottom: 8px;
    letter-spacing: 0.5px;
    border-bottom: 3px solid var(--accent-color);
    border-radius: 2px;
}

.stats-grid-summary {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
}

.stat-group {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.stat-group h4 {
    font-size: 1.1em;
    font-weight: 600;
    color: var(--secondary-color);
    margin-bottom: 8px;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 4px;
}

.stat-row {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    padding: 4px 0;
}

.stat-label {
    font-size: 0.95em;
    color: var(--secondary-color);
    font-weight: 500;
}

.stat-value {
    font-size: 1em;
    font-weight: 600;
    color: var(--text-color);
}

.muscle-pair {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    flex: 1;
}

.stat-row .muscle-pair:not(:last-child) {
    margin-right: 20px;
}

.macro-layout {
    display: flex;
    gap: 20px;
    align-items: center;
}

.macro-legend {
    flex: 1;
}

.macro-chart {
    display: flex;
    justify-content: center;
    align-items: center;
    flex: 1;
}

.stat-value .macro-color {
    margin-right: 8px;
}

.activity-tooltip {
    position: absolute;
    background: var(--bg-color);
    border: 2px solid var(--border-color);
    border-radius: 8px;
    padding: 12px;
    box-shadow: 0 4px 12px var(--shadow-light);
    z-index: 1000;
    opacity: 0;
    pointer-events: none;
    transform: translateY(-10px);
    transition: opacity 0.2s ease, transform 0.2s ease;
    max-width: 320px;
    min-width: 240px;
}

@media (max-width: 768px) {
    .activity-tooltip {
        position: fixed;
        left: 50% !important;
        top: 50% !important;
        transform: translate(-50%, -50%) !important;
        max-width: 90vw;
        max-height: 80vh;
        overflow-y: auto;
    }
    
    .activity-tooltip.show {
        transform: translate(-50%, -50%) !important;
    }
}

.activity-tooltip.show {
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
}

.tooltip-content {
    color: var(--text-color);
}

.tooltip-date {
    font-family: 'Chicle', cursive;
    font-size: 1.3em;
    margin-bottom: 12px;
    color: white;
    text-align: center;
    border-bottom: 2px solid var(--border-color);
    padding-bottom: 8px;
}

.tooltip-activity {
    margin-bottom: 12px;
    padding: 10px;
    background: var(--progress-bg);
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
    border-left: 3px solid transparent;
}

.tooltip-activity:hover {
    background: var(--border-color);
    border-left-color: var(--accent-color);
    transform: translateX(2px);
}

.tooltip-activity-type {
    font-family: 'Inter', sans-serif;
    font-size: 1.1em;
    color: var(--accent-color);
    margin-bottom: 6px;
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 600;
}

.tooltip-activity-type::before {
    content: '●';
    font-size: 0.8em;
}

.tooltip-activity-details {
    font-size: 0.9em;
    line-height: 1.4;
    color: var(--text-color);
}

.tooltip-goal {
    color: var(--secondary-color);
    font-style: italic;
    font-size: 0.85em;
    margin-top: 4px;
    display: block;
    border-top: 1px solid var(--border-color);
    padding-top: 4px;
}

.tooltip-data-row {
    display: flex;
    justify-content: space-between;
    margin-bottom: 2px;
}

.tooltip-data-label {
    font-weight: 500;
    color: var(--secondary-color);
}

.tooltip-data-value {
    font-weight: bold;
    color: var(--text-color);
}

.tooltip-full-width {
    flex-direction: column;
    align-items: flex-start;
    margin-top: 4px;
}

.tooltip-full-width .tooltip-data-label {
    margin-bottom: 2px;
}

.tooltip-full-width .tooltip-data-value {
    width: 100%;
    padding: 4px 8px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 4px;
    border-left: 2px solid var(--accent-color);
    font-style: italic;
    line-height: 1.3;
}

/* Enhanced lifting tooltip styles */
.tooltip-exercise-section {
    margin-bottom: 8px;
    background: rgba(104, 211, 145, 0.1);
    border-radius: 4px;
    padding: 8px;
    border-left: 2px solid var(--accent-color);
}

.tooltip-exercise-name {
    font-weight: 600;
    color: var(--accent-color);
    font-size: 0.95em;
    margin-bottom: 4px;
}

.tooltip-sets {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    align-items: center;
}

.tooltip-set {
    background: var(--border-color);
    padding: 2px 6px;
    border-radius: 3px;
    font-size: 0.85em;
    font-weight: 500;
    color: var(--text-color);
    white-space: nowrap;
}

.set-separator {
    color: var(--secondary-color);
    font-weight: bold;
    font-size: 0.8em;
}

.macro-color {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    display: inline-block;
}

.macro-color.protein {
    background-color: #e74c3c;
}

.macro-color.carbs {
    background-color: #f39c12;
}

.macro-color.fat {
    background-color: #3498db;
}

.macro-label {
    font-size: 0.9em;
    color: var(--secondary-color);
    font-weight: 500;
}

.chart-container {
    display: flex;
    justify-content: center;
    margin-bottom: 15px;
    background: var(--bg-color);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 10px;
}

.chart-container canvas {
    max-width: 100%;
    max-height: 200px;
}


.filter-section {
    margin-bottom: 30px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px;
}

.main-filters {
    display: flex;
    gap: 10px;
}

.sub-filters {
    display: flex;
    gap: 10px;
    max-height: 0;
    overflow: hidden;
    opacity: 0;
    margin-top: 0;
    transition: all 0.3s ease-in-out;
}

.sub-filters.show {
    max-height: 80px;
    opacity: 1;
    margin-top: 15px;
}

.filter-btn,
.sub-filter-btn {
    background: var(--bg-color);
    border: 2px solid var(--border-color);
    border-radius: 24px;
    padding: 10px 16px;
    font-size: 1.5em;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 2px 4px var(--shadow-light);
}

.filter-btn:hover,
.sub-filter-btn:hover {
    border-color: var(--accent-color);
    transform: translateY(-1px);
    box-shadow: 0 4px 8px var(--shadow-light);
}

.filter-btn.active,
.sub-filter-btn.active {
    border-color: var(--accent-color);
    background-color: var(--accent-color);
    color: white;
    box-shadow: 0 4px 12px rgba(72, 187, 120, 0.25);
}

.calendar-section {
    max-width: 1000px;
    margin: 0 auto;
}


.calendar-container {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 30px;
    max-width: 100%;
}

.month-calendar {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.month-title {
    font-family: 'Chicle', cursive;
    font-size: 1.3em;
    font-weight: 400;
    text-align: center;
    color: var(--text-color);
    letter-spacing: 0.3px;
}

.calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 6px;
    max-width: 100%;
}

.calendar-day {
    aspect-ratio: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    cursor: pointer;
}

.calendar-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background-color: var(--dot-inactive);
    transition: all 0.2s ease;
}

.calendar-dot.achieved {
    background-color: var(--dot-active);
    box-shadow: 0 0 8px rgba(34, 84, 61, 0.6);
    border: 1px solid #1a472a;
}

.calendar-day.other-month {
    opacity: 0.15;
}

.calendar-day.today .calendar-dot {
    border: 2px solid var(--accent-color);
    width: 12px;
    height: 12px;
}

.calendar-day:hover .calendar-dot {
    transform: scale(1.3);
}

@media (max-width: 768px) {
    .container {
        padding: 15px;
    }
    
    .progress-section {
        grid-template-columns: 1fr;
        gap: 35px;
    }
    
    .main-filters {
        flex-wrap: wrap;
        justify-content: center;
    }
    
    .sub-filters {
        flex-wrap: wrap;
        justify-content: center;
    }
    
    .sub-filters.show {
        max-height: 120px; /* Increase for wrapped buttons on mobile */
    }
    
    .calendar-container {
        grid-template-columns: 1fr;
        gap: 20px;
    }
    
    .calendar-grid {
        gap: 4px;
    }
    
    .stats-grid-summary {
        grid-template-columns: 1fr;
        gap: 15px;
    }
    
    .muscle-pair {
        margin-bottom: 8px;
    }
    
    .stat-row .muscle-pair:not(:last-child) {
        margin-right: 0;
        margin-bottom: 8px;
    }
}

@media (max-width: 480px) {
    .progress-item {
        gap: 3px;
    }
    
    .progress-bar {
        height: 6px;
    }
    
    .progress-text {
        font-size: 0.7em;
    }
    
    .filter-btn,
    .sub-filter-btn {
        padding: 6px 10px;
        font-size: 1.1em;
    }
    
    .calendar-container {
        gap: 15px;
    }
    
    .calendar-grid {
        gap: 3px;
    }
    
    .calendar-dot {
        width: 6px;
        height: 6px;
    }
    
    .calendar-day.today .calendar-dot {
        width: 10px;
        height: 10px;
    }
}