How would you improve the following program ? suggest interface and graphic changes and how to make the program as user friendly as possible.
The program's code is the following:
import json
import os
import tkinter as tk
from tkinter import ttk, messagebox, scrolledtext
from datetime import datetime, timedelta
from typing import Dict, List, Tuple

class ConvictConditioningTracker:
    def __init__(self, data_file="cc_progress.json"):
        self.data_file = data_file
        
        # Define routines
        self.routines = {
            "good_behavior": {
                "name": "Good Behavior Routine",
                "description": "Designed for those with busy schedules or needing more rest",
                "frequency": "3 days per week",
                "schedule": {
                    "Monday": {"exercises": ["pushups", "legraises"], "sets": 2},
                    "Tuesday": {"exercises": [], "sets": 0, "rest": True},
                    "Wednesday": {"exercises": ["pullups", "squats"], "sets": 2},
                    "Thursday": {"exercises": [], "sets": 0, "rest": True},
                    "Friday": {"exercises": ["handstandpushups", "bridges"], "sets": 2},
                    "Saturday": {"exercises": [], "sets": 0, "rest": True},
                    "Sunday": {"exercises": [], "sets": 0, "rest": True}
                }
            },
            "veterano": {
                "name": "Veterano Routine",
                "description": "Focuses on one 'Big Six' movement per day, six days a week",
                "frequency": "6 days per week",
                "schedule": {
                    "Monday": {"exercises": ["pushups"], "sets": 3},
                    "Tuesday": {"exercises": ["squats"], "sets": 3},
                    "Wednesday": {"exercises": ["pullups"], "sets": 3},
                    "Thursday": {"exercises": ["legraises"], "sets": 3},
                    "Friday": {"exercises": ["bridges"], "sets": 3},
                    "Saturday": {"exercises": ["handstandpushups"], "sets": 3},
                    "Sunday": {"exercises": [], "sets": 0, "rest": True}
                }
            },
            "full_body": {
                "name": "Standard Full-Body Routine",
                "description": "Perform all six exercises in a single session, 2-3 times per week",
                "frequency": "2-3 days per week",
                "schedule": {
                    "Monday": {"exercises": ["pushups", "squats", "pullups", "legraises", "bridges", "handstandpushups"], "sets": 2},
                    "Tuesday": {"exercises": [], "sets": 0, "rest": True},
                    "Wednesday": {"exercises": ["pushups", "squats", "pullups", "legraises", "bridges", "handstandpushups"], "sets": 2},
                    "Thursday": {"exercises": [], "sets": 0, "rest": True},
                    "Friday": {"exercises": ["pushups", "squats", "pullups", "legraises", "bridges", "handstandpushups"], "sets": 2},
                    "Saturday": {"exercises": [], "sets": 0, "rest": True},
                    "Sunday": {"exercises": [], "sets": 0, "rest": True}
                }
            },
            "gtg": {
                "name": "Grease the Groove (GTG)",
                "description": "High-frequency, low-volume training spread throughout the day",
                "frequency": "Daily, multiple sessions",
                "schedule": {
                    "Monday": {"exercises": ["pushups", "squats", "pullups", "legraises", "bridges", "handstandpushups"], "sets": 1, "note": "Multiple times daily, never to failure"},
                    "Tuesday": {"exercises": ["pushups", "squats", "pullups", "legraises", "bridges", "handstandpushups"], "sets": 1, "note": "Multiple times daily, never to failure"},
                    "Wednesday": {"exercises": ["pushups", "squats", "pullups", "legraises", "bridges", "handstandpushups"], "sets": 1, "note": "Multiple times daily, never to failure"},
                    "Thursday": {"exercises": ["pushups", "squats", "pullups", "legraises", "bridges", "handstandpushups"], "sets": 1, "note": "Multiple times daily, never to failure"},
                    "Friday": {"exercises": ["pushups", "squats", "pullups", "legraises", "bridges", "handstandpushups"], "sets": 1, "note": "Multiple times daily, never to failure"},
                    "Saturday": {"exercises": ["pushups", "squats", "pullups", "legraises", "bridges", "handstandpushups"], "sets": 1, "note": "Multiple times daily, never to failure"},
                    "Sunday": {"exercises": ["pushups", "squats", "pullups", "legraises", "bridges", "handstandpushups"], "sets": 1, "note": "Multiple times daily, never to failure"}
                }
            }
        }
        
        # Define the exercise progressions with sets, reps and illustrations
        self.exercises = {
            "pushups": {
                "name": "Push-ups",
                "icon": "💪",
                "color": "#FF6B6B",
                "steps": {
                    1: {"name": "Wall Push-ups", "icon": "🏠", "beginner": {"sets": 1, "reps": 10}, "intermediate": {"sets": 2, "reps": 25}, "progression": {"sets": 3, "reps": 50}},
                    2: {"name": "Incline Push-ups", "icon": "📐", "beginner": {"sets": 1, "reps": 10}, "intermediate": {"sets": 2, "reps": 20}, "progression": {"sets": 3, "reps": 40}},
                    3: {"name": "Kneeling Push-ups", "icon": "🦵", "beginner": {"sets": 1, "reps": 10}, "intermediate": {"sets": 2, "reps": 15}, "progression": {"sets": 3, "reps": 30}},
                    4: {"name": "Half Push-ups", "icon": "📏", "beginner": {"sets": 1, "reps": 8}, "intermediate": {"sets": 2, "reps": 12}, "progression": {"sets": 2, "reps": 25}},
                    5: {"name": "Full Push-ups", "icon": "⭐", "beginner": {"sets": 1, "reps": 5}, "intermediate": {"sets": 2, "reps": 10}, "progression": {"sets": 2, "reps": 20}},
                    6: {"name": "Close Push-ups", "icon": "🤏", "beginner": {"sets": 1, "reps": 5}, "intermediate": {"sets": 2, "reps": 10}, "progression": {"sets": 2, "reps": 20}},
                    7: {"name": "Uneven Push-ups", "icon": "⚖️", "beginner": {"sets": 1, "reps": 5}, "intermediate": {"sets": 2, "reps": 10}, "progression": {"sets": 2, "reps": 20}},
                    8: {"name": "Half One-Arm Push-ups", "icon": "🦾", "beginner": {"sets": 1, "reps": 5}, "intermediate": {"sets": 2, "reps": 10}, "progression": {"sets": 2, "reps": 20}},
                    9: {"name": "Lever Push-ups", "icon": "🎯", "beginner": {"sets": 1, "reps": 5}, "intermediate": {"sets": 2, "reps": 10}, "progression": {"sets": 2, "reps": 20}},
                    10: {"name": "One-Arm Push-ups", "icon": "👑", "beginner": {"sets": 1, "reps": 5}, "intermediate": {"sets": 2, "reps": 10}, "progression": {"sets": 1, "reps": 100}}
                }
            },
            "squats": {
                "name": "Squats",
                "icon": "🍑",
                "color": "#4ECDC4",
                "steps": {
                    1: {"name": "Shoulderstand Squats", "icon": "🤸", "beginner": {"sets": 1, "reps": 10}, "intermediate": {"sets": 2, "reps": 25}, "progression": {"sets": 3, "reps": 50}},
                    2: {"name": "Jackknife Squats", "icon": "🔪", "beginner": {"sets": 1, "reps": 10}, "intermediate": {"sets": 2, "reps": 20}, "progression": {"sets": 3, "reps": 40}},
                    3: {"name": "Supported Squats", "icon": "🤝", "beginner": {"sets": 1, "reps": 10}, "intermediate": {"sets": 2, "reps": 15}, "progression": {"sets": 3, "reps": 30}},
                    4: {"name": "Half Squats", "icon": "📏", "beginner": {"sets": 1, "reps": 8}, "intermediate": {"sets": 2, "reps": 35}, "progression": {"sets": 2, "reps": 50}},
                    5: {"name": "Full Squats", "icon": "⭐", "beginner": {"sets": 1, "reps": 5}, "intermediate": {"sets": 2, "reps": 30}, "progression": {"sets": 2, "reps": 50}},
                    6: {"name": "Close Squats", "icon": "🤏", "beginner": {"sets": 1, "reps": 5}, "intermediate": {"sets": 2, "reps": 20}, "progression": {"sets": 2, "reps": 40}},
                    7: {"name": "Uneven Squats", "icon": "⚖️", "beginner": {"sets": 1, "reps": 5}, "intermediate": {"sets": 2, "reps": 20}, "progression": {"sets": 2, "reps": 40}},
                    8: {"name": "Half One-Leg Squats", "icon": "🦵", "beginner": {"sets": 1, "reps": 5}, "intermediate": {"sets": 2, "reps": 20}, "progression": {"sets": 2, "reps": 40}},
                    9: {"name": "Assisted One-Leg Squats", "icon": "🎯", "beginner": {"sets": 1, "reps": 5}, "intermediate": {"sets": 2, "reps": 10}, "progression": {"sets": 2, "reps": 20}},
                    10: {"name": "One-Leg Squats", "icon": "👑", "beginner": {"sets": 1, "reps": 5}, "intermediate": {"sets": 2, "reps": 10}, "progression": {"sets": 2, "reps": 50}}
                }
            },
            "pullups": {
                "name": "Pull-ups",
                "icon": "🏋️",
                "color": "#45B7D1",
                "steps": {
                    1: {"name": "Vertical Pulls", "icon": "📏", "beginner": {"sets": 1, "reps": 10}, "intermediate": {"sets": 2, "reps": 20}, "progression": {"sets": 3, "reps": 40}},
                    2: {"name": "Horizontal Pulls", "icon": "↔️", "beginner": {"sets": 1, "reps": 10}, "intermediate": {"sets": 2, "reps": 20}, "progression": {"sets": 3, "reps": 30}},
                    3: {"name": "Jackknife Pull-ups", "icon": "🔪", "beginner": {"sets": 1, "reps": 10}, "intermediate": {"sets": 2, "reps": 15}, "progression": {"sets": 3, "reps": 20}},
                    4: {"name": "Half Pull-ups", "icon": "📏", "beginner": {"sets": 1, "reps": 8}, "intermediate": {"sets": 2, "reps": 11}, "progression": {"sets": 2, "reps": 15}},
                    5: {"name": "Full Pull-ups", "icon": "⭐", "beginner": {"sets": 1, "reps": 5}, "intermediate": {"sets": 2, "reps": 9}, "progression": {"sets": 2, "reps": 15}},
                    6: {"name": "Close Pull-ups", "icon": "🤏", "beginner": {"sets": 1, "reps": 5}, "intermediate": {"sets": 2, "reps": 8}, "progression": {"sets": 2, "reps": 12}},
                    7: {"name": "Uneven Pull-ups", "icon": "⚖️", "beginner": {"sets": 1, "reps": 5}, "intermediate": {"sets": 2, "reps": 7}, "progression": {"sets": 2, "reps": 10}},
                    8: {"name": "Half One-Arm Pull-ups", "icon": "🦾", "beginner": {"sets": 1, "reps": 4}, "intermediate": {"sets": 2, "reps": 6}, "progression": {"sets": 2, "reps": 8}},
                    9: {"name": "Assisted One-Arm Pull-ups", "icon": "🎯", "beginner": {"sets": 1, "reps": 3}, "intermediate": {"sets": 2, "reps": 5}, "progression": {"sets": 2, "reps": 7}},
                    10: {"name": "One-Arm Pull-ups", "icon": "👑", "beginner": {"sets": 1, "reps": 1}, "intermediate": {"sets": 2, "reps": 3}, "progression": {"sets": 2, "reps": 6}}
                }
            },
            "legraises": {
                "name": "Leg Raises",
                "icon": "🦵",
                "color": "#96CEB4",
                "steps": {
                    1: {"name": "Knee Tucks", "icon": "🤱", "beginner": {"sets": 1, "reps": 10}, "intermediate": {"sets": 2, "reps": 25}, "progression": {"sets": 3, "reps": 40}},
                    2: {"name": "Flat Knee Raises", "icon": "📐", "beginner": {"sets": 1, "reps": 10}, "intermediate": {"sets": 2, "reps": 20}, "progression": {"sets": 3, "reps": 35}},
                    3: {"name": "Flat Bent Leg Raises", "icon": "🔄", "beginner": {"sets": 1, "reps": 10}, "intermediate": {"sets": 2, "reps": 15}, "progression": {"sets": 3, "reps": 30}},
                    4: {"name": "Flat Frog Raises", "icon": "🐸", "beginner": {"sets": 1, "reps": 8}, "intermediate": {"sets": 2, "reps": 15}, "progression": {"sets": 3, "reps": 25}},
                    5: {"name": "Flat Straight Leg Raises", "icon": "⭐", "beginner": {"sets": 1, "reps": 5}, "intermediate": {"sets": 2, "reps": 10}, "progression": {"sets": 2, "reps": 20}},
                    6: {"name": "Hanging Knee Raises", "icon": "🎪", "beginner": {"sets": 1, "reps": 5}, "intermediate": {"sets": 2, "reps": 10}, "progression": {"sets": 2, "reps": 15}},
                    7: {"name": "Hanging Bent Leg Raises", "icon": "🔄", "beginner": {"sets": 1, "reps": 5}, "intermediate": {"sets": 2, "reps": 10}, "progression": {"sets": 2, "reps": 15}},
                    8: {"name": "Hanging Frog Raises", "icon": "🐸", "beginner": {"sets": 1, "reps": 5}, "intermediate": {"sets": 2, "reps": 8}, "progression": {"sets": 2, "reps": 15}},
                    9: {"name": "Partial Straight Leg Raises", "icon": "🎯", "beginner": {"sets": 1, "reps": 5}, "intermediate": {"sets": 2, "reps": 8}, "progression": {"sets": 2, "reps": 15}},
                    10: {"name": "Hanging Straight Leg Raises", "icon": "👑", "beginner": {"sets": 1, "reps": 5}, "intermediate": {"sets": 2, "reps": 10}, "progression": {"sets": 2, "reps": 30}}
                }
            },
            "bridges": {
                "name": "Bridges",
                "icon": "🌉",
                "color": "#F7DC6F",
                "steps": {
                    1: {"name": "Short Bridges", "icon": "🔗", "beginner": {"sets": 1, "reps": 10}, "intermediate": {"sets": 2, "reps": 25}, "progression": {"sets": 3, "reps": 50}},
                    2: {"name": "Straight Bridges", "icon": "📏", "beginner": {"sets": 1, "reps": 10}, "intermediate": {"sets": 2, "reps": 20}, "progression": {"sets": 3, "reps": 40}},
                    3: {"name": "Angled Bridges", "icon": "📐", "beginner": {"sets": 1, "reps": 8}, "intermediate": {"sets": 2, "reps": 15}, "progression": {"sets": 3, "reps": 30}},
                    4: {"name": "Head Bridges", "icon": "🧠", "beginner": {"sets": 1, "reps": 8}, "intermediate": {"sets": 2, "reps": 15}, "progression": {"sets": 2, "reps": 25}},
                    5: {"name": "Half Bridges", "icon": "🌗", "beginner": {"sets": 1, "reps": 8}, "intermediate": {"sets": 2, "reps": 15}, "progression": {"sets": 2, "reps": 20}},
                    6: {"name": "Full Bridges", "icon": "⭐", "beginner": {"sets": 1, "reps": 5}, "intermediate": {"sets": 2, "reps": 10}, "progression": {"sets": 2, "reps": 15}},
                    7: {"name": "Wall Walking Bridges (down)", "icon": "⬇️", "beginner": {"sets": 1, "reps": 3}, "intermediate": {"sets": 2, "reps": 6}, "progression": {"sets": 2, "reps": 10}},
                    8: {"name": "Wall Walking Bridges (up)", "icon": "⬆️", "beginner": {"sets": 1, "reps": 2}, "intermediate": {"sets": 2, "reps": 4}, "progression": {"sets": 2, "reps": 8}},
                    9: {"name": "Closing Bridges", "icon": "🎯", "beginner": {"sets": 1, "reps": 1}, "intermediate": {"sets": 2, "reps": 3}, "progression": {"sets": 2, "reps": 6}},
                    10: {"name": "Stand-to-Stand Bridges", "icon": "👑", "beginner": {"sets": 1, "reps": 1}, "intermediate": {"sets": 2, "reps": 3}, "progression": {"sets": 2, "reps": 10}}
                }
            },
            "handstandpushups": {
                "name": "Handstand Push-ups",
                "icon": "🤸",
                "color": "#BB8FCE",
                "steps": {
                    1: {"name": "Wall Headstands", "icon": "🏠", "beginner": {"sets": 1, "reps": 30}, "intermediate": {"sets": 2, "reps": 60}, "progression": {"sets": 2, "reps": 120}},
                    2: {"name": "Crow Stands", "icon": "🐦", "beginner": {"sets": 1, "reps": 10}, "intermediate": {"sets": 2, "reps": 30}, "progression": {"sets": 2, "reps": 60}},
                    3: {"name": "Wall Handstands", "icon": "🏠", "beginner": {"sets": 1, "reps": 30}, "intermediate": {"sets": 2, "reps": 60}, "progression": {"sets": 2, "reps": 120}},
                    4: {"name": "Half Handstand Push-ups", "icon": "📏", "beginner": {"sets": 1, "reps": 5}, "intermediate": {"sets": 2, "reps": 10}, "progression": {"sets": 2, "reps": 20}},
                    5: {"name": "Handstand Push-ups", "icon": "⭐", "beginner": {"sets": 1, "reps": 5}, "intermediate": {"sets": 2, "reps": 10}, "progression": {"sets": 2, "reps": 15}},
                    6: {"name": "Close Handstand Push-ups", "icon": "🤏", "beginner": {"sets": 1, "reps": 5}, "intermediate": {"sets": 2, "reps": 9}, "progression": {"sets": 2, "reps": 12}},
                    7: {"name": "Uneven Handstand Push-ups", "icon": "⚖️", "beginner": {"sets": 1, "reps": 5}, "intermediate": {"sets": 2, "reps": 8}, "progression": {"sets": 2, "reps": 10}},
                    8: {"name": "Half One-Arm Handstand Push-ups", "icon": "🦾", "beginner": {"sets": 1, "reps": 4}, "intermediate": {"sets": 2, "reps": 6}, "progression": {"sets": 2, "reps": 8}},
                    9: {"name": "Lever Handstand Push-ups", "icon": "🎯", "beginner": {"sets": 1, "reps": 3}, "intermediate": {"sets": 2, "reps": 4}, "progression": {"sets": 2, "reps": 6}},
                    10: {"name": "One-Arm Handstand Push-ups", "icon": "👑", "beginner": {"sets": 1, "reps": 1}, "intermediate": {"sets": 2, "reps": 2}, "progression": {"sets": 2, "reps": 5}}
                }
            }
        }
        
        self.progress = self.load_progress()
    
    def load_progress(self) -> Dict:
        # Load existing progress if file exists
        progress = {}
        if os.path.exists(self.data_file):
            try:
                with open(self.data_file, 'r') as f:
                    progress = json.load(f)
            except:
                progress = {}
        
        # Ensure all current exercises are initialized
        for exercise in self.exercises:
            if exercise not in progress:
                progress[exercise] = {
                    "current_step": 1,
                    "current_level": "beginner",
                    "workout_log": []
                }
        
        # Initialize routine if not present
        if "selected_routine" not in progress:
            progress["selected_routine"] = None
        
        return progress
    
    def save_progress(self):
        with open(self.data_file, 'w') as f:
            json.dump(self.progress, f, indent=2)
    
    def set_routine(self, routine_key: str):
        """Set the selected routine"""
        if routine_key in self.routines:
            self.progress["selected_routine"] = routine_key
            self.save_progress()
            return True
        return False
    
    def get_current_routine(self):
        """Get the currently selected routine"""
        routine_key = self.progress.get("selected_routine")
        if routine_key and routine_key in self.routines:
            return self.routines[routine_key]
        return None
    
    def get_today_exercises(self):
        """Get exercises for today based on selected routine"""
        routine = self.get_current_routine()
        if not routine:
            return []
        
        today = datetime.now().strftime("%A")
        day_schedule = routine["schedule"].get(today, {})
        
        return day_schedule.get("exercises", [])
    
    def get_routine_sets_for_exercise(self, exercise_key: str):
        """Get recommended sets for exercise based on routine"""
        routine = self.get_current_routine()
        if not routine:
            return None
            
        today = datetime.now().strftime("%A")
        day_schedule = routine["schedule"].get(today, {})
        
        if exercise_key in day_schedule.get("exercises", []):
            return day_schedule.get("sets", 2)
        return None
    
    def reset_exercise_progress(self, exercise: str) -> bool:
        """Reset progress for a specific exercise"""
        if exercise not in self.exercises:
            return False
        
        self.progress[exercise] = {
            "current_step": 1,
            "current_level": "beginner",
            "workout_log": []
        }
        
        self.save_progress()
        return True
    
    def get_current_exercise_info(self, exercise: str) -> Dict:
        if exercise not in self.exercises:
            return None
        
        current_step = self.progress[exercise]["current_step"]
        current_level = self.progress[exercise]["current_level"]
        step_info = self.exercises[exercise]["steps"][current_step]
        
        return {
            "exercise": self.exercises[exercise]["name"],
            "step": current_step,
            "variation": step_info["name"],
            "current_level": current_level,
            "current_goal": step_info[current_level],
            "next_level": self.get_next_level(current_level),
            "next_goal": step_info.get(self.get_next_level(current_level)),
            "max_step": max(self.exercises[exercise]["steps"].keys()),
            "step_icon": step_info["icon"],
            "exercise_icon": self.exercises[exercise]["icon"],
            "exercise_color": self.exercises[exercise]["color"]
        }
    
    def get_next_level(self, current_level: str) -> str:
        levels = ["beginner", "intermediate", "progression"]
        current_index = levels.index(current_level)
        if current_index < len(levels) - 1:
            return levels[current_index + 1]
        return None
    
    def log_workout(self, exercise: str, set_reps: List[int]) -> bool:
        if exercise not in self.exercises:
            return False
        
        workout_entry = {
            "date": datetime.now().isoformat(),
            "set_reps": set_reps,
            "total_sets": len(set_reps),
            "step": self.progress[exercise]["current_step"],
            "level": self.progress[exercise]["current_level"]
        }
        
        self.progress[exercise]["workout_log"].append(workout_entry)
        progression_made = self.check_progression(exercise, set_reps)
        self.save_progress()
        
        return progression_made
    
    def check_progression(self, exercise: str, set_reps: List[int]) -> bool:
        current_step = self.progress[exercise]["current_step"]
        current_level = self.progress[exercise]["current_level"]
        
        step_info = self.exercises[exercise]["steps"][current_step]
        target_goal = step_info[current_level]
        target_sets = target_goal["sets"]
        target_reps = target_goal["reps"]
        
        # Check if the required number of sets were performed
        if len(set_reps) < target_sets:
            return False
        
        # Check if each set meets the minimum reps requirement
        for reps in set_reps[:target_sets]:  # Only check the required number of sets
            if reps < target_reps:
                return False
        
        return self.advance_progression(exercise)
    
    def advance_progression(self, exercise: str) -> bool:
        current_step = self.progress[exercise]["current_step"]
        current_level = self.progress[exercise]["current_level"]
        
        next_level = self.get_next_level(current_level)
        
        if next_level:
            self.progress[exercise]["current_level"] = next_level
            return True
        else:
            max_step = max(self.exercises[exercise]["steps"].keys())
            if current_step < max_step:
                self.progress[exercise]["current_step"] += 1
                self.progress[exercise]["current_level"] = "beginner"
                return True
        
        return False

class ModernConvictConditioningGUI:
    def __init__(self):
        self.tracker = ConvictConditioningTracker()
        self.root = tk.Tk()
        self.setup_window()
        
        # Check if routine is selected
        if not self.tracker.get_current_routine():
            self.show_routine_selection()
        else:
            self.create_main_interface()
        
    def setup_window(self):
        self.root.title("🏋️ Convict Conditioning Tracker")
        self.root.geometry("1200x800")
        self.root.configure(bg='#0F0F23')
        
        # Modern styles
        style = ttk.Style()
        style.theme_use('clam')
        
        # Configure modern styles
        style.configure('Title.TLabel', 
                       font=('Segoe UI', 28, 'bold'), 
                       background='#0F0F23', 
                       foreground='#FFFFFF')
        
        style.configure('Header.TLabel', 
                       font=('Segoe UI', 18, 'bold'), 
                       background='#0F0F23', 
                       foreground='#FFFFFF')
        
        style.configure('Info.TLabel', 
                       font=('Segoe UI', 12), 
                       background='#0F0F23', 
                       foreground='#B8B8B8')
        
        style.configure('Success.TLabel', 
                       font=('Segoe UI', 12, 'bold'), 
                       background='#0F0F23', 
                       foreground='#00FF88')
        
        style.configure('Modern.TButton', 
                       font=('Segoe UI', 12, 'bold'),
                       relief='flat',
                       padding=(20, 15))
        
        style.configure('Danger.TButton', 
                       font=('Segoe UI', 10), 
                       foreground='#FF4757')
    
    def show_routine_selection(self):
        """Show routine selection screen with scrolling"""
        self.clear_screen()
        
        # Main container
        main_frame = tk.Frame(self.root, bg='#0F0F23')
        main_frame.pack(fill='both', expand=True, padx=20, pady=20)
        
        # Title (fixed at top)
        title_frame = tk.Frame(main_frame, bg='#0F0F23')
        title_frame.pack(fill='x', pady=(20, 0))
        
        title_label = tk.Label(title_frame, 
                              text="🎯 SELECT YOUR ROUTINE", 
                              font=('Segoe UI', 28, 'bold'), 
                              bg='#0F0F23', 
                              fg='#FFFFFF')
        title_label.pack()
        
        subtitle_label = tk.Label(title_frame, 
                                 text="Choose a training routine that fits your schedule and goals", 
                                 font=('Segoe UI', 14), 
                                 bg='#0F0F23', 
                                 fg='#B8B8B8')
        subtitle_label.pack(pady=(10, 30))
        
        # Create scrollable frame for routine cards
        canvas = tk.Canvas(main_frame, bg='#0F0F23', highlightthickness=0)
        scrollbar = ttk.Scrollbar(main_frame, orient="vertical", command=canvas.yview)
        scrollable_frame = tk.Frame(canvas, bg='#0F0F23')
        
        scrollable_frame.bind(
            "<Configure>",
            lambda e: canvas.configure(scrollregion=canvas.bbox("all"))
        )
        
        canvas.create_window((0, 0), window=scrollable_frame, anchor="nw")
        canvas.configure(yscrollcommand=scrollbar.set)
        
        # Create routine cards in 2x2 grid
        routine_items = list(self.tracker.routines.items())
        
        for i, (routine_key, routine_data) in enumerate(routine_items):
            row = i // 2
            col = i % 2
            self.create_routine_card(scrollable_frame, routine_key, routine_data, row, col)
        
        # Configure grid weights for scrollable frame
        scrollable_frame.grid_columnconfigure(0, weight=1)
        scrollable_frame.grid_columnconfigure(1, weight=1)
        
        # Pack canvas and scrollbar
        canvas.pack(side="left", fill="both", expand=True)
        scrollbar.pack(side="right", fill="y")
        
        # Mouse wheel scrolling
        def _on_mousewheel(event):
            canvas.yview_scroll(int(-1*(event.delta/120)), "units")
        canvas.bind_all("<MouseWheel>", _on_mousewheel)
    
    def create_routine_card(self, parent, routine_key, routine_data, row, col):
        """Create a card for routine selection"""
        # Card container
        card_frame = tk.Frame(parent, bg='#1E1E3A', relief='flat', bd=0)
        card_frame.grid(row=row, column=col, padx=20, pady=20, sticky='nsew', ipadx=25, ipady=25)
        
        # Routine name
        name_label = tk.Label(card_frame, 
                             text=routine_data["name"], 
                             font=('Segoe UI', 20, 'bold'), 
                             bg='#1E1E3A', 
                             fg='#FFFFFF')
        name_label.pack(pady=(0, 10))
        
        # Frequency
        freq_label = tk.Label(card_frame, 
                             text=f"📅 {routine_data['frequency']}", 
                             font=('Segoe UI', 14, 'bold'), 
                             bg='#1E1E3A', 
                             fg='#4ECDC4')
        freq_label.pack(pady=(0, 15))
        
        # Description
        desc_label = tk.Label(card_frame, 
                             text=routine_data["description"], 
                             font=('Segoe UI', 12), 
                             bg='#1E1E3A', 
                             fg='#B8B8B8',
                             wraplength=250,
                             justify='center')
        desc_label.pack(pady=(0, 20))
        
        # Schedule preview
        schedule_frame = tk.Frame(card_frame, bg='#2D2D5A', relief='flat')
        schedule_frame.pack(fill='x', pady=(0, 20), ipady=10)
        
        schedule_title = tk.Label(schedule_frame, 
                                 text="Weekly Schedule:", 
                                 font=('Segoe UI', 11, 'bold'), 
                                 bg='#2D2D5A', 
                                 fg='#FFFFFF')
        schedule_title.pack(pady=(0, 5))
        
        # Show first few days as example
        example_days = list(routine_data["schedule"].items())[:3]
        for day, schedule in example_days:
            if schedule.get("exercises"):
                exercises_text = ", ".join([self.tracker.exercises[ex]["name"] for ex in schedule["exercises"]])
                if len(exercises_text) > 40:
                    exercises_text = exercises_text[:40] + "..."
                day_text = f"{day}: {exercises_text}"
            else:
                day_text = f"{day}: Rest"
            
            day_label = tk.Label(schedule_frame, 
                               text=day_text, 
                               font=('Segoe UI', 9), 
                               bg='#2D2D5A', 
                               fg='#B8B8B8')
            day_label.pack()
        
        # Select button
        select_btn = tk.Button(card_frame, 
                              text="SELECT ROUTINE", 
                              font=('Segoe UI', 14, 'bold'),
                              bg='#00FF88',
                              fg='#000000',
                              relief='flat',
                              padx=30, pady=15,
                              command=lambda: self.select_routine(routine_key))
        select_btn.pack(fill='x')
    
    def select_routine(self, routine_key):
        """Select a routine and proceed to main interface"""
        self.tracker.set_routine(routine_key)
        self.create_main_interface()
    
    def create_main_interface(self):
        """Create the main interface with exercise cards"""
        self.clear_screen()
        
        # Main container
        main_frame = tk.Frame(self.root, bg='#0F0F23')
        main_frame.pack(fill='both', expand=True, padx=30, pady=30)
        
        # Header with routine info
        self.create_header(main_frame)
        
        # Create scrollable frame for exercise cards
        canvas = tk.Canvas(main_frame, bg='#0F0F23', highlightthickness=0)
        scrollbar = ttk.Scrollbar(main_frame, orient="vertical", command=canvas.yview)
        scrollable_frame = tk.Frame(canvas, bg='#0F0F23')
        
        scrollable_frame.bind(
            "<Configure>",
            lambda e: canvas.configure(scrollregion=canvas.bbox("all"))
        )
        
        canvas.create_window((0, 0), window=scrollable_frame, anchor="nw")
        canvas.configure(yscrollcommand=scrollbar.set)
        
        # Today's exercises section
        self.create_today_section(scrollable_frame)
        
        # All exercises grid
        self.create_exercise_grid(scrollable_frame)
        
        # Pack canvas and scrollbar
        canvas.pack(side="left", fill="both", expand=True)
        scrollbar.pack(side="right", fill="y")
        
        # Mouse wheel scrolling
        def _on_mousewheel(event):
            canvas.yview_scroll(int(-1*(event.delta/120)), "units")
        canvas.bind_all("<MouseWheel>", _on_mousewheel)
    
    def create_header(self, parent):
        """Create header with routine information"""
        header_frame = tk.Frame(parent, bg='#0F0F23')
        header_frame.pack(fill='x', pady=(0, 30))
        
        # Title and routine name
        title_frame = tk.Frame(header_frame, bg='#0F0F23')
        title_frame.pack(fill='x')
        
        title_label = tk.Label(title_frame, 
                              text="💪 CONVICT CONDITIONING TRACKER", 
                              font=('Segoe UI', 24, 'bold'), 
                              bg='#0F0F23', 
                              fg='#FFFFFF')
        title_label.pack(side='left')
        
        # Change routine button
        change_btn = tk.Button(title_frame, 
                              text="🔄 Change Routine", 
                              font=('Segoe UI', 12),
                              bg='#2D2D5A',
                              fg='#FFFFFF',
                              relief='flat',
                              padx=20, pady=10,
                              command=self.show_routine_selection)
        change_btn.pack(side='right')
        
        # Current routine info
        routine = self.tracker.get_current_routine()
        if routine:
            routine_label = tk.Label(header_frame, 
                                   text=f"📋 Current Routine: {routine['name']}", 
                                   font=('Segoe UI', 14, 'bold'), 
                                   bg='#0F0F23', 
                                   fg='#4ECDC4')
            routine_label.pack(anchor='w', pady=(10, 0))
    
    def create_today_section(self, parent):
        """Create today's workout section with clickable exercises"""
        today_exercises = self.tracker.get_today_exercises()
        
        if not today_exercises:
            # Rest day
            rest_frame = tk.Frame(parent, bg='#1E1E3A', relief='flat')
            rest_frame.pack(fill='x', pady=(0, 30), ipady=20)
            
            rest_label = tk.Label(rest_frame, 
                                 text="🛌 REST DAY", 
                                 font=('Segoe UI', 24, 'bold'), 
                                 bg='#1E1E3A', 
                                 fg='#FFD93D')
            rest_label.pack()
            
            rest_desc = tk.Label(rest_frame, 
                                text="Take a well-deserved break and let your muscles recover", 
                                font=('Segoe UI', 14), 
                                bg='#1E1E3A', 
                                fg='#B8B8B8')
            rest_desc.pack(pady=(5, 0))
        else:
            # Today's exercises
            today_frame = tk.Frame(parent, bg='#1E1E3A', relief='flat')
            today_frame.pack(fill='x', pady=(0, 30), ipady=20)
            
            today_label = tk.Label(today_frame, 
                                  text=f"🗓️ TODAY'S WORKOUT - {datetime.now().strftime('%A')}", 
                                  font=('Segoe UI', 20, 'bold'), 
                                  bg='#1E1E3A', 
                                  fg='#FFFFFF')
            today_label.pack(pady=(0, 15))
            
            # Add instruction for clickable exercises
            instruction_label = tk.Label(today_frame, 
                                        text="👆 Click on any exercise to start workout", 
                                        font=('Segoe UI', 12, 'italic'), 
                                        bg='#1E1E3A', 
                                        fg='#B8B8B8')
            instruction_label.pack(pady=(0, 15))
            
            exercises_frame = tk.Frame(today_frame, bg='#1E1E3A')
            exercises_frame.pack()
            
            for i, exercise_key in enumerate(today_exercises):
                exercise_data = self.tracker.exercises[exercise_key]
                
                # Create clickable exercise frame
                ex_frame = tk.Frame(exercises_frame, bg='#2D2D5A', relief='flat', cursor='hand2')
                ex_frame.pack(side='left', padx=10, pady=5, ipady=15, ipadx=20)
                
                # Bind click events to frame and all its children
                def make_click_handler(ex_key):
                    return lambda event: self.show_exercise_detail(ex_key)
                
                click_handler = make_click_handler(exercise_key)
                ex_frame.bind("<Button-1>", click_handler)
                
                # Bind hover effects
                def on_enter(event, frame=ex_frame, color=exercise_data["color"]):
                    frame.configure(bg=color)
                    for child in frame.winfo_children():
                        if isinstance(child, tk.Label):
                            child.configure(bg=color)
                
                def on_leave(event, frame=ex_frame):
                    frame.configure(bg='#2D2D5A')
                    for child in frame.winfo_children():
                        if isinstance(child, tk.Label):
                            child.configure(bg='#2D2D5A')
                
                ex_frame.bind("<Enter>", on_enter)
                ex_frame.bind("<Leave>", on_leave)
                
                # Exercise icon
                icon_label = tk.Label(ex_frame, 
                                     text=exercise_data["icon"], 
                                     font=('Segoe UI', 32), 
                                     bg='#2D2D5A',
                                     cursor='hand2')
                icon_label.pack()
                icon_label.bind("<Button-1>", click_handler)
                icon_label.bind("<Enter>", on_enter)
                icon_label.bind("<Leave>", on_leave)
                
                # Exercise name
                name_label = tk.Label(ex_frame, 
                                     text=exercise_data["name"], 
                                     font=('Segoe UI', 14, 'bold'), 
                                     bg='#2D2D5A', 
                                     fg='#FFFFFF',
                                     cursor='hand2')
                name_label.pack(pady=(5, 0))
                name_label.bind("<Button-1>", click_handler)
                name_label.bind("<Enter>", on_enter)
                name_label.bind("<Leave>", on_leave)
                
                # Sets recommendation
                sets_recommended = self.tracker.get_routine_sets_for_exercise(exercise_key)
                if sets_recommended:
                    sets_label = tk.Label(ex_frame, 
                                        text=f"{sets_recommended} sets", 
                                        font=('Segoe UI', 12), 
                                        bg='#2D2D5A', 
                                        fg='#B8B8B8',
                                        cursor='hand2')
                    sets_label.pack(pady=(2, 0))
                    sets_label.bind("<Button-1>", click_handler)
                    sets_label.bind("<Enter>", on_enter)
                    sets_label.bind("<Leave>", on_leave)
                
                # Current step info
                info = self.tracker.get_current_exercise_info(exercise_key)
                step_label = tk.Label(ex_frame, 
                                    text=f"Step {info['step']} - {info['current_level'].title()}", 
                                    font=('Segoe UI', 10), 
                                    bg='#2D2D5A', 
                                    fg='#B8B8B8',
                                    cursor='hand2')
                step_label.pack(pady=(2, 0))
                step_label.bind("<Button-1>", click_handler)
                step_label.bind("<Enter>", on_enter)
                step_label.bind("<Leave>", on_leave)
    
    def create_exercise_grid(self, parent):
        """Create a grid of exercise cards"""
        # Section title
        section_label = tk.Label(parent, 
                                text="📚 ALL EXERCISES", 
                                font=('Segoe UI', 18, 'bold'), 
                                bg='#0F0F23', 
                                fg='#FFFFFF')
        section_label.pack(pady=(20, 20))
        
        # Grid container
        grid_frame = tk.Frame(parent, bg='#0F0F23')
        grid_frame.pack(fill='x')
        
        exercises = list(self.tracker.exercises.items())
        
        for i, (exercise_key, exercise_data) in enumerate(exercises):
            row = i // 2
            col = i % 2
            
            self.create_exercise_card(grid_frame, exercise_key, exercise_data, row, col)
    
    def create_exercise_card(self, parent, exercise_key, exercise_data, row, col):
        """Create a modern card for each exercise"""
        info = self.tracker.get_current_exercise_info(exercise_key)
        
        # Card container with modern styling
        card_frame = tk.Frame(parent, bg='#1E1E3A', relief='flat', bd=0)
        card_frame.grid(row=row, column=col, padx=15, pady=15, sticky='nsew', ipadx=20, ipady=20)
        
        # Configure grid weights
        parent.grid_columnconfigure(0, weight=1)
        parent.grid_columnconfigure(1, weight=1)
        
        # Exercise header with icon and name
        header_frame = tk.Frame(card_frame, bg='#1E1E3A')
        header_frame.pack(fill='x', pady=(0, 20))
        
        # Large exercise icon
        icon_label = tk.Label(header_frame, 
                             text=exercise_data["icon"], 
                             font=('Segoe UI', 48), 
                             bg='#1E1E3A', 
                             fg=exercise_data["color"])
        icon_label.pack(side='left', padx=(0, 15))
        
        # Exercise name and current step
        name_frame = tk.Frame(header_frame, bg='#1E1E3A')
        name_frame.pack(side='left', fill='x', expand=True)
        
        name_label = tk.Label(name_frame, 
                             text=exercise_data["name"], 
                             font=('Segoe UI', 20, 'bold'), 
                             bg='#1E1E3A', 
                             fg='#FFFFFF')
        name_label.pack(anchor='w')
        
        step_label = tk.Label(name_frame, 
                             text=f"Step {info['step']}/10", 
                             font=('Segoe UI', 14), 
                             bg='#1E1E3A', 
                             fg='#B8B8B8')
        step_label.pack(anchor='w')
        
        # Today indicator
        today_exercises = self.tracker.get_today_exercises()
        if exercise_key in today_exercises:
            today_indicator = tk.Label(header_frame, 
                                     text="📍 TODAY", 
                                     font=('Segoe UI', 12, 'bold'), 
                                     bg='#00FF88', 
                                     fg='#000000',
                                     padx=8, pady=4)
            today_indicator.pack(side='right')
        
        # Current variation with step icon
        variation_frame = tk.Frame(card_frame, bg='#1E1E3A')
        variation_frame.pack(fill='x', pady=(0, 15))
        
        step_icon_label = tk.Label(variation_frame, 
                                  text=info["step_icon"], 
                                  font=('Segoe UI', 24), 
                                  bg='#1E1E3A')
        step_icon_label.pack(side='left', padx=(0, 10))
        
        variation_label = tk.Label(variation_frame, 
                                  text=info['variation'], 
                                  font=('Segoe UI', 16, 'bold'), 
                                  bg='#1E1E3A', 
                                  fg='#FFFFFF')
        variation_label.pack(side='left')
        
        # Level and goal info
        level_frame = tk.Frame(card_frame, bg='#1E1E3A')
        level_frame.pack(fill='x', pady=(0, 15))
        
        level_colors = {"beginner": "#FFD93D", "intermediate": "#6BCF7F", "progression": "#4D96FF"}
        level_color = level_colors.get(info['current_level'], "#FFFFFF")
        
        level_label = tk.Label(level_frame, 
                              text=f"● {info['current_level'].title()}", 
                              font=('Segoe UI', 12, 'bold'), 
                              bg='#1E1E3A', 
                              fg=level_color)
        level_label.pack(side='left')
        
        current_goal = info['current_goal']
        goal_label = tk.Label(level_frame, 
                             text=f"Goal: {current_goal['sets']} sets × {current_goal['reps']} reps", 
                             font=('Segoe UI', 12), 
                             bg='#1E1E3A', 
                             fg='#B8B8B8')
        goal_label.pack(side='right')
        
        # Progress bar with modern styling
        progress_frame = tk.Frame(card_frame, bg='#1E1E3A')
        progress_frame.pack(fill='x', pady=(0, 20))
        
        # Custom progress bar
        progress_bg = tk.Frame(progress_frame, bg='#0F0F23', height=8)
        progress_bg.pack(fill='x')
        
        total_progress = ((info['step'] - 1) * 3 + 
                         ["beginner", "intermediate", "progression"].index(info['current_level']) + 1) / 30
        
        progress_fill = tk.Frame(progress_bg, bg=exercise_data["color"], height=8)
        progress_fill.place(x=0, y=0, relwidth=total_progress)
        
        progress_label = tk.Label(progress_frame, 
                                 text=f"{total_progress*100:.1f}% Complete", 
                                 font=('Segoe UI', 10), 
                                 bg='#1E1E3A', 
                                 fg='#B8B8B8')
        progress_label.pack(anchor='e', pady=(5, 0))
        
        # Action buttons
        button_frame = tk.Frame(card_frame, bg='#1E1E3A')
        button_frame.pack(fill='x')
        
        # Main action button
        action_btn = tk.Button(button_frame, 
                              text="START WORKOUT", 
                              font=('Segoe UI', 12, 'bold'),
                              bg=exercise_data["color"],
                              fg='#FFFFFF',
                              relief='flat',
                              padx=20, pady=10,
                              command=lambda: self.show_exercise_detail(exercise_key))
        action_btn.pack(side='left', fill='x', expand=True, padx=(0, 10))
        
        # History button
        history_btn = tk.Button(button_frame, 
                               text="📊", 
                               font=('Segoe UI', 14),
                               bg='#2D2D5A',
                               fg='#FFFFFF',
                               relief='flat',
                               padx=15, pady=10,
                               command=lambda: self.show_history(exercise_key))
        history_btn.pack(side='right', padx=(5, 0))
        
        # Reset button
        reset_btn = tk.Button(button_frame, 
                             text="🔄", 
                             font=('Segoe UI', 14),
                             bg='#2D2D5A',
                             fg='#FF4757',
                             relief='flat',
                             padx=15, pady=10,
                             command=lambda: self.reset_exercise(exercise_key))
        reset_btn.pack(side='right')
    
    def show_exercise_detail(self, exercise_key):
        """Show exercise detail window"""
        detail_window = tk.Toplevel(self.root)
        detail_window.title(f"🏋️ {self.tracker.exercises[exercise_key]['name']}")
        detail_window.geometry("900x700")
        detail_window.configure(bg='#0F0F23')
        detail_window.grab_set()  # Make window modal
        
        info = self.tracker.get_current_exercise_info(exercise_key)
        current_goal = info['current_goal']
        
        # Check if routine recommends specific sets for this exercise
        routine_sets = self.tracker.get_routine_sets_for_exercise(exercise_key)
        target_sets = routine_sets if routine_sets else current_goal['sets']
        target_reps = current_goal['reps']
        
        # Main container with scrollbar
        main_canvas = tk.Canvas(detail_window, bg='#0F0F23', highlightthickness=0)
        scrollbar = ttk.Scrollbar(detail_window, orient="vertical", command=main_canvas.yview)
        scrollable_frame = tk.Frame(main_canvas, bg='#0F0F23')
        
        scrollable_frame.bind(
            "<Configure>",
            lambda e: main_canvas.configure(scrollregion=main_canvas.bbox("all"))
        )
        
        main_canvas.create_window((0, 0), window=scrollable_frame, anchor="nw")
        main_canvas.configure(yscrollcommand=scrollbar.set)
        
        # Header
        header_frame = tk.Frame(scrollable_frame, bg='#0F0F23')
        header_frame.pack(fill='x', padx=30, pady=30)
        
        # Exercise icon and name
        title_frame = tk.Frame(header_frame, bg='#0F0F23')
        title_frame.pack()
        
        icon_label = tk.Label(title_frame, 
                             text=info["exercise_icon"], 
                             font=('Segoe UI', 64), 
                             bg='#0F0F23', 
                             fg=info["exercise_color"])
        icon_label.pack(side='left', padx=(0, 20))
        
        name_label = tk.Label(title_frame, 
                             text=info['exercise'], 
                             font=('Segoe UI', 32, 'bold'), 
                             bg='#0F0F23', 
                             fg='#FFFFFF')
        name_label.pack(side='left')
        
        # Current variation card
        variation_frame = tk.Frame(scrollable_frame, bg='#1E1E3A', relief='flat')
        variation_frame.pack(fill='x', padx=30, pady=(0, 30), ipady=20)
        
        step_header = tk.Frame(variation_frame, bg='#1E1E3A')
        step_header.pack(fill='x', padx=20, pady=(0, 15))
        
        step_icon_label = tk.Label(step_header, 
                                  text=info["step_icon"], 
                                  font=('Segoe UI', 48), 
                                  bg='#1E1E3A')
        step_icon_label.pack(side='left', padx=(0, 20))
        
        step_info_frame = tk.Frame(step_header, bg='#1E1E3A')
        step_info_frame.pack(side='left', fill='x', expand=True)
        
        step_label = tk.Label(step_info_frame, 
                             text=f"Step {info['step']}/10", 
                             font=('Segoe UI', 18, 'bold'), 
                             bg='#1E1E3A', 
                             fg='#FFFFFF')
        step_label.pack(anchor='w')
        
        variation_label = tk.Label(step_info_frame, 
                                  text=info['variation'], 
                                  font=('Segoe UI', 24, 'bold'), 
                                  bg='#1E1E3A', 
                                  fg='#FFFFFF')
        variation_label.pack(anchor='w')
        
        level_colors = {"beginner": "#FFD93D", "intermediate": "#6BCF7F", "progression": "#4D96FF"}
        level_color = level_colors.get(info['current_level'], "#FFFFFF")
        
        level_label = tk.Label(step_info_frame, 
                              text=f"● {info['current_level'].title()}", 
                              font=('Segoe UI', 16, 'bold'), 
                              bg='#1E1E3A', 
                              fg=level_color)
        level_label.pack(anchor='w', pady=(5, 0))
        
        # Show routine recommendation if applicable
        if routine_sets:
            routine_label = tk.Label(step_info_frame, 
                                   text=f"📋 Routine recommends: {target_sets} sets × {target_reps} reps", 
                                   font=('Segoe UI', 14, 'bold'), 
                                   bg='#1E1E3A', 
                                   fg='#4ECDC4')
            routine_label.pack(anchor='w', pady=(5, 0))
        else:
            goal_label = tk.Label(step_info_frame, 
                                 text=f"Target: {target_sets} sets × {target_reps} reps", 
                                 font=('Segoe UI', 16), 
                                 bg='#1E1E3A', 
                                 fg='#00FF88')
            goal_label.pack(anchor='w', pady=(5, 0))
        
        # Workout logging section
        log_frame = tk.Frame(scrollable_frame, bg='#1E1E3A', relief='flat')
        log_frame.pack(fill='x', padx=30, pady=(0, 30), ipady=20)
        
        log_title = tk.Label(log_frame, 
                            text="💪 Log Your Workout", 
                            font=('Segoe UI', 20, 'bold'), 
                            bg='#1E1E3A', 
                            fg='#FFFFFF')
        log_title.pack(pady=(0, 20))
        
        # Set inputs with modern styling
        sets_container = tk.Frame(log_frame, bg='#1E1E3A')
        sets_container.pack(fill='x', padx=20)
        
        set_vars = []
        for i in range(target_sets):
            set_frame = tk.Frame(sets_container, bg='#2D2D5A', relief='flat')
            set_frame.pack(fill='x', pady=8, ipady=15)
            
            set_label = tk.Label(set_frame, 
                               text=f"Set {i+1} reps:", 
                               font=('Segoe UI', 16, 'bold'), 
                               bg='#2D2D5A', 
                               fg='#FFFFFF')
            set_label.pack(side='left', padx=(20, 10))
            
            set_var = tk.StringVar()
            entry = tk.Entry(set_frame, 
                           textvariable=set_var, 
                           font=('Segoe UI', 16), 
                           bg='#0F0F23', 
                           fg='#FFFFFF',
                           insertbackground='#FFFFFF',
                           relief='flat',
                           width=8,
                           justify='center')
            entry.pack(side='right', padx=(10, 20))
            
            set_vars.append(set_var)
        
        # Log button
        button_frame = tk.Frame(log_frame, bg='#1E1E3A')
        button_frame.pack(fill='x', padx=20, pady=(30, 0))
        
        def log_workout():
            try:
                set_reps = []
                for i, var in enumerate(set_vars):
                    reps_text = var.get().strip()
                    if not reps_text:
                        messagebox.showerror("Error", f"Please enter reps for Set {i+1}")
                        return
                    
                    reps = int(reps_text)
                    if reps <= 0:
                        messagebox.showerror("Error", f"Reps for Set {i+1} must be positive")
                        return
                    
                    set_reps.append(reps)
                
                progression_made = self.tracker.log_workout(exercise_key, set_reps)
                
                sets_summary = ", ".join([f"Set {i+1}: {reps}" for i, reps in enumerate(set_reps)])
                success_msg = f"Workout logged:\n{sets_summary}"
                
                if progression_made:
                    success_msg += "\n\n🎉 PROGRESSION ACHIEVED! 🎉"
                
                messagebox.showinfo("Success", success_msg)
                detail_window.destroy()
                self.refresh_main_interface()
                
            except ValueError:
                messagebox.showerror("Error", "Please enter valid numbers")
        
        # Large, prominent log button
        log_btn = tk.Button(button_frame, 
                           text="🚀 LOG WORKOUT", 
                           font=('Segoe UI', 18, 'bold'),
                           bg='#00FF88',
                           fg='#000000',
                           relief='flat',
                           padx=50, pady=20,
                           command=log_workout)
        log_btn.pack(fill='x')
        
        # Cancel button
        cancel_btn = tk.Button(button_frame, 
                              text="❌ Cancel", 
                              font=('Segoe UI', 12),
                              bg='#FF4757',
                              fg='#FFFFFF',
                              relief='flat',
                              padx=20, pady=10,
                              command=detail_window.destroy)
        cancel_btn.pack(fill='x', pady=(10, 0))
        
        # Pack canvas and scrollbar
        main_canvas.pack(side="left", fill="both", expand=True)
        scrollbar.pack(side="right", fill="y")
        
        # Focus on first entry
        if set_vars:
            set_vars[0].set("")
            scrollable_frame.focus_set()
    
    def show_history(self, exercise_key):
        """Show workout history window"""
        history_window = tk.Toplevel(self.root)
        history_window.title(f"📊 {self.tracker.exercises[exercise_key]['name']} History")
        history_window.geometry("600x500")
        history_window.configure(bg='#0F0F23')
        
        # Title
        title_label = tk.Label(history_window, 
                              text=f"📊 {self.tracker.exercises[exercise_key]['name']} History", 
                              font=('Segoe UI', 20, 'bold'), 
                              bg='#0F0F23', 
                              fg='#FFFFFF')
        title_label.pack(pady=20)
        
        # History list
        history_frame = tk.Frame(history_window, bg='#0F0F23')
        history_frame.pack(fill='both', expand=True, padx=20, pady=(0, 20))
        
        workouts = self.tracker.progress[exercise_key]["workout_log"][-10:]
        
        if not workouts:
            no_data_label = tk.Label(history_frame, 
                                    text="No workouts logged yet", 
                                    font=('Segoe UI', 16), 
                                    bg='#0F0F23', 
                                    fg='#B8B8B8')
            no_data_label.pack(pady=50)
            return
        
        for workout in reversed(workouts):
            self.create_history_card(history_frame, exercise_key, workout)
    
    def create_history_card(self, parent, exercise_key, workout):
        """Create a history card"""
        card_frame = tk.Frame(parent, bg='#1E1E3A', relief='flat')
        card_frame.pack(fill='x', pady=5, ipady=15)
        
        date = datetime.fromisoformat(workout["date"]).strftime("%Y-%m-%d %H:%M")
        step_info = self.tracker.exercises[exercise_key]["steps"][workout["step"]]
        
        # Date
        date_label = tk.Label(card_frame, 
                             text=date, 
                             font=('Segoe UI', 12), 
                             bg='#1E1E3A', 
                             fg='#B8B8B8')
        date_label.pack(anchor='w', padx=15, pady=(0, 5))
        
        # Exercise variation
        variation_label = tk.Label(card_frame, 
                                  text=f"{step_info['icon']} {step_info['name']}", 
                                  font=('Segoe UI', 14, 'bold'), 
                                  bg='#1E1E3A', 
                                  fg='#FFFFFF')
        variation_label.pack(anchor='w', padx=15, pady=2)
        
        # Sets detail
        if "set_reps" in workout:
            sets_detail = ", ".join([f"Set {i+1}: {reps}" for i, reps in enumerate(workout["set_reps"])])
        else:
            sets_detail = f"{workout.get('sets', 1)} sets × {workout.get('reps', 0)} reps"
        
        sets_label = tk.Label(card_frame, 
                             text=sets_detail, 
                             font=('Segoe UI', 12), 
                             bg='#1E1E3A', 
                             fg='#00FF88')
        sets_label.pack(anchor='w', padx=15, pady=(2, 0))
    
    def reset_exercise(self, exercise_key):
        """Reset exercise with confirmation"""
        exercise_name = self.tracker.exercises[exercise_key]["name"]
        
        result = messagebox.askyesno(
            "Reset Progress",
            f"Reset all progress for {exercise_name}?\n\n"
            f"This will delete all data and cannot be undone.",
            icon='warning'
        )
        
        if result:
            final_confirm = messagebox.askyesno(
                "Final Confirmation",
                f"Really reset {exercise_name}?\n\nThis is PERMANENT!",
                icon='warning'
            )
            
            if final_confirm:
                success = self.tracker.reset_exercise_progress(exercise_key)
                if success:
                    messagebox.showinfo("Reset Complete", f"{exercise_name} has been reset.")
                    self.refresh_main_interface()
                else:
                    messagebox.showerror("Error", "Failed to reset progress.")
    
    def clear_screen(self):
        """Clear current screen"""
        for widget in self.root.winfo_children():
            widget.destroy()
    
    def refresh_main_interface(self):
        """Refresh the main interface"""
        self.create_main_interface()
    
    def run(self):
        self.root.mainloop()

def main():
    app = ModernConvictConditioningGUI()
    app.run()

if __name__ == "__main__":
    main()