/* ===============================================
    GymTracker Pro - Main Stylesheet
    Primary Colors: Red, Black, White, Dark Blue, RGB Gradients
    Accent: Gold
    =============================================== */

    /* ===============================================
    1. ROOT VARIABLES & RESET
    =============================================== */
    :root {
        /* Primary Colors */
        --primary-red: #DC2626;
        --dark-red: #991B1B;
        --light-red: #EF4444;
        --primary-black: #0A0A0A;
        --dark-black: #000000;
        --primary-white: #FFFFFF;
        --off-white: #F9FAFB;
        --dark-blue: #1E3A8A;
        --light-blue: #3B82F6;
        
        /* Accent Colors */
        --gold: #FFD700;
        --dark-gold: #B8860B;
        --silver: #C0C0C0;
        
        /* Gradients */
        --gradient-fire: linear-gradient(135deg, #FF6B6B 0%, #DC2626 50%, #991B1B 100%);
        --gradient-ocean: linear-gradient(135deg, #667EEA 0%, #1E3A8A 100%);
        --gradient-rgb: linear-gradient(45deg, #FF006E, #8338EC, #3A86FF, #06FFB4, #FFBE0B, #FB5607);
        --gradient-dark: linear-gradient(180deg, #1A1A1A 0%, #0A0A0A 100%);
        --gradient-gold: linear-gradient(135deg, #FFD700 0%, #B8860B 100%);
        
        /* Shadows */
        --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.1);
        --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.1);
        --shadow-lg: 0 10px 25px rgba(0, 0, 0, 0.2);
        --shadow-xl: 0 20px 40px rgba(0, 0, 0, 0.3);
        --shadow-glow: 0 0 30px rgba(220, 38, 38, 0.5);
        
        /* Transitions */
        --transition-fast: 0.2s ease;
        --transition-normal: 0.3s ease;
        --transition-slow: 0.5s ease;
        
        /* Border Radius */
        --radius-sm: 5px;
        --radius-md: 10px;
        --radius-lg: 15px;
        --radius-xl: 20px;
        --radius-full: 9999px;
    }

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

    body {
        font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', sans-serif;
        background: var(--gradient-dark);
        color: var(--primary-white);
        min-height: 100vh;
        overflow-x: hidden;
        position: relative;
    }

    /* ===============================================
    2. LOADING SCREEN
    =============================================== */
    .loading-screen {
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        background: var(--gradient-dark);
        display: flex;
        justify-content: center;
        align-items: center;
        z-index: 9999;
        animation: fadeOut 0.5s ease 2s forwards;
    }

    .loading-content {
        text-align: center;
    }

    .turtle-loader {
        font-size: 80px;
        animation: bounce 1s infinite;
    }

    .loading-bar {
        width: 200px;
        height: 8px;
        background: rgba(255, 255, 255, 0.1);
        border-radius: var(--radius-full);
        overflow: hidden;
        margin: 20px auto;
    }

    .loading-progress {
        height: 100%;
        background: var(--gradient-fire);
        animation: loadingProgress 2s ease-out;
        border-radius: var(--radius-full);
    }

    @keyframes loadingProgress {
        0% { width: 0%; }
        100% { width: 100%; }
    }

    @keyframes fadeOut {
        to {
            opacity: 0;
            visibility: hidden;
        }
    }

    @keyframes bounce {
        0%, 100% { transform: translateY(0); }
        50% { transform: translateY(-20px); }
    }

    /* ===============================================
    3. AUTHENTICATION STYLES
    =============================================== */
    .auth-container {
        min-height: 100vh;
        display: flex;
        justify-content: center;
        align-items: center;
        padding: 20px;
        background: var(--gradient-rgb);
        background-size: 400% 400%;
        animation: rgbShift 15s ease infinite;
    }

    @keyframes rgbShift {
        0% { background-position: 0% 50%; }
        50% { background-position: 100% 50%; }
        100% { background-position: 0% 50%; }
    }

    .auth-card {
        background: rgba(10, 10, 10, 0.95);
        backdrop-filter: blur(20px);
        border: 2px solid rgba(220, 38, 38, 0.3);
        border-radius: var(--radius-xl);
        padding: 40px;
        width: 100%;
        max-width: 450px;
        box-shadow: var(--shadow-xl), 0 0 50px rgba(220, 38, 38, 0.2);
        position: relative;
        overflow: hidden;
    }

    .animated-bg {
        position: absolute;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        pointer-events: none;
        overflow: hidden;
    }

    .floating-dumbbell,
    .floating-muscle,
    .floating-fire {
        position: absolute;
        font-size: 30px;
        opacity: 0.1;
        animation: float 6s ease-in-out infinite;
    }

    .floating-dumbbell {
        top: 10%;
        left: 10%;
        animation-delay: 0s;
    }

    .floating-muscle {
        top: 70%;
        right: 10%;
        animation-delay: 2s;
    }

    .floating-fire {
        top: 40%;
        right: 20%;
        animation-delay: 4s;
    }

    @keyframes float {
        0%, 100% { transform: translateY(0) rotate(0deg); }
        50% { transform: translateY(-30px) rotate(10deg); }
    }

    .auth-logo {
        text-align: center;
        margin-bottom: 30px;
        position: relative;
        z-index: 1;
    }

    .logo-mascot {
        position: relative;
        display: inline-block;
        margin-bottom: 15px;
    }

    .turtle-emoji {
        font-size: 60px;
        display: block;
        animation: pulse 2s infinite;
    }

    .muscle-arms {
        position: absolute;
        top: 50%;
        left: 50%;
        transform: translate(-50%, -50%);
        font-size: 30px;
        animation: flex 1s ease-in-out infinite alternate;
    }

    /*
     * Override styles when using PNGs instead of emoji for the mascot.
     * The .logo-image sits within .logo-mascot and should scale responsively.
     */
    .logo-mascot img.logo-image {
        width: 80px;
        height: 80px;
        object-fit: contain;
        display: block;
        margin: 0 auto;
        animation: pulse 2s infinite;
    }

    /* Small logo used in the header. */
    .logo-small-img {
        width: 32px;
        height: 32px;
        object-fit: contain;
        display: block;
    }

    /* Logo displayed in the workout header */
    .workout-logo-img {
        width: 40px;
        height: 40px;
        object-fit: contain;
        display: block;
    /* Remove bouncing animation from the workout zone logo so it stays stationary */
    }

    /* Floating icons (e.g. dumbbell) replaced with PNGs. Ensure images animate like the text versions. */
    .floating-dumbbell {
        width: 40px;
        height: 40px;
        opacity: 0.1;
        pointer-events: none;
        animation: float 6s ease-in-out infinite;
        /* reset font-size on the image element to avoid inheriting text sizing */
        font-size: 0;
    }

    .floating-dumbbell img {
        width: 100%;
        height: 100%;
        object-fit: contain;
    }

    /* Workout title input styling */
    .workout-title-input {
        margin: 10px 0;
    }
    .workout-title-input input {
        width: 100%;
        padding: 10px 12px;
        background: rgba(255, 255, 255, 0.05);
        border: 2px solid rgba(255, 255, 255, 0.1);
        border-radius: var(--radius-md);
        color: var(--primary-white);
        font-size: 16px;
        transition: var(--transition-normal);
    }
    .workout-title-input input:focus {
        outline: none;
        border-color: var(--primary-red);
        background: rgba(255, 255, 255, 0.08);
        box-shadow: 0 0 20px rgba(220, 38, 38, 0.3);
    }
    .workout-title-input input::placeholder {
        color: rgba(255, 255, 255, 0.4);
    }

    @keyframes pulse {
        0%, 100% { transform: scale(1); }
        50% { transform: scale(1.05); }
    }

    @keyframes flex {
        0% { transform: translate(-50%, -50%) scale(1); }
        100% { transform: translate(-50%, -50%) scale(1.2); }
    }

    .app-title {
        font-size: 32px;
        font-weight: 900;
        letter-spacing: 2px;
        margin: 10px 0;
    }

    .title-gym {
        color: var(--primary-red);
        text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
    }

    .title-tracker {
        color: var(--primary-white);
        text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
    }

    .title-pro {
        background: var(--gradient-gold);
        -webkit-background-clip: text;
        -webkit-text-fill-color: transparent;
        background-clip: text;
        text-shadow: none;
    }

    .tagline {
        color: rgba(255, 255, 255, 0.7);
        font-size: 14px;
        font-style: italic;
    }

    .auth-tabs {
        display: flex;
        gap: 10px;
        margin-bottom: 25px;
        background: rgba(255, 255, 255, 0.05);
        padding: 5px;
        border-radius: var(--radius-md);
    }

    .tab-btn {
        flex: 1;
        padding: 12px;
        background: transparent;
        border: none;
        color: rgba(255, 255, 255, 0.6);
        font-size: 14px;
        font-weight: 600;
        cursor: pointer;
        border-radius: var(--radius-sm);
        transition: var(--transition-normal);
        display: flex;
        align-items: center;
        justify-content: center;
        gap: 8px;
    }

    .tab-btn:hover {
        color: var(--primary-white);
        background: rgba(255, 255, 255, 0.1);
    }

    .tab-btn.active {
        background: var(--gradient-fire);
        color: var(--primary-white);
        box-shadow: var(--shadow-md);
    }

    .form-content {
        animation: slideIn 0.3s ease;
    }

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

    .input-group {
        position: relative;
        margin-bottom: 20px;
    }

    .input-group i {
        position: absolute;
        left: 15px;
        top: 50%;
        transform: translateY(-50%);
        color: rgba(255, 255, 255, 0.4);
        font-size: 16px;
    }

    .input-group input {
        width: 100%;
        padding: 15px 15px 15px 45px;
        background: rgba(255, 255, 255, 0.05);
        border: 2px solid rgba(255, 255, 255, 0.1);
        border-radius: var(--radius-md);
        color: var(--primary-white);
        font-size: 16px;
        transition: var(--transition-normal);
    }

    .input-group input:focus {
        outline: none;
        border-color: var(--primary-red);
        background: rgba(255, 255, 255, 0.08);
        box-shadow: 0 0 20px rgba(220, 38, 38, 0.3);
    }

    .input-group input::placeholder {
        color: rgba(255, 255, 255, 0.4);
    }

    .auth-btn {
        width: 100%;
        padding: 15px;
        background: var(--gradient-fire);
        border: none;
        border-radius: var(--radius-md);
        color: var(--primary-white);
        font-size: 16px;
        font-weight: 700;
        cursor: pointer;
        transition: var(--transition-normal);
        display: flex;
        align-items: center;
        justify-content: center;
        gap: 10px;
        text-transform: uppercase;
        letter-spacing: 1px;
        box-shadow: var(--shadow-md);
    }

    .auth-btn:hover {
        transform: translateY(-2px);
        box-shadow: var(--shadow-lg), var(--shadow-glow);
    }

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

    .auth-helper {
        text-align: center;
        color: rgba(255, 255, 255, 0.6);
        font-size: 14px;
        margin-top: 15px;
    }

    .auth-helper a {
        color: var(--primary-red);
        text-decoration: none;
        font-weight: 600;
        transition: var(--transition-normal);
    }

    .auth-helper a:hover {
        color: var(--light-red);
        text-decoration: underline;
    }

    .social-auth {
        margin-top: 30px;
    }

    .divider {
        text-align: center;
        position: relative;
        margin: 20px 0;
    }

    .divider::before,
    .divider::after {
        content: '';
        position: absolute;
        top: 50%;
        width: 45%;
        height: 1px;
        background: rgba(255, 255, 255, 0.2);
    }

    .divider::before {
        left: 0;
    }

    .divider::after {
        right: 0;
    }

    .divider span {
        background: var(--primary-black);
        padding: 0 15px;
        color: rgba(255, 255, 255, 0.5);
        font-size: 12px;
        text-transform: uppercase;
        letter-spacing: 1px;
    }

    .social-btn {
        width: 100%;
        padding: 12px;
        background: rgba(255, 255, 255, 0.05);
        border: 2px solid rgba(255, 255, 255, 0.1);
        border-radius: var(--radius-md);
        color: var(--primary-white);
        font-size: 14px;
        font-weight: 600;
        cursor: pointer;
        transition: var(--transition-normal);
        display: flex;
        align-items: center;
        justify-content: center;
        gap: 10px;
    }

    .social-btn:hover {
        background: rgba(255, 255, 255, 0.1);
        border-color: rgba(255, 255, 255, 0.2);
    }

    /* ===============================================
    4. MAIN DASHBOARD
    =============================================== */
    .main-dashboard {
        /* Make sure the main dashboard spans the full viewport width on all devices */
        width: 100%;
        min-height: 100vh;
        background: var(--gradient-dark);
    }

    .dashboard-header {
        /* Ensure the header stretches across the viewport. */
        width: 100%;
        background: linear-gradient(135deg, var(--primary-black) 0%, var(--dark-blue) 100%);
        padding: 15px 20px;
        display: flex;
        justify-content: space-between;
        align-items: center;
        box-shadow: var(--shadow-lg);
        border-bottom: 3px solid var(--primary-red);
    }

    .header-left {
        display: flex;
        align-items: center;
        gap: 10px;
    }

    .logo-small {
        display: flex;
        align-items: center;
        gap: 10px;
    }

    .turtle-small {
        font-size: 30px;
    }

    .brand-name {
        font-weight: 800;
        font-size: 18px;
        background: var(--gradient-gold);
        -webkit-background-clip: text;
        -webkit-text-fill-color: transparent;
        background-clip: text;
        display: none;
    }

    @media (min-width: 768px) {
        .brand-name {
            display: block;
        }
    }

    .header-center {
        flex: 1;
        text-align: center;
    }

    #welcome-message {
        font-size: 18px;
        font-weight: 600;
        color: var(--primary-white);
    }

    #user-name {
        color: var(--gold);
        text-transform: capitalize;
    }

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

    .notification-btn,
    .profile-btn,
    .logout-btn {
        background: rgba(255, 255, 255, 0.1);
        border: none;
        color: var(--primary-white);
        padding: 10px;
        border-radius: var(--radius-md);
        cursor: pointer;
        transition: var(--transition-normal);
        position: relative;
        font-size: 18px;
    }

    .notification-btn:hover,
    .profile-btn:hover,
    .logout-btn:hover {
        background: rgba(255, 255, 255, 0.2);
        transform: translateY(-2px);
    }

    .notification-badge {
        position: absolute;
        top: -5px;
        right: -5px;
        background: var(--primary-red);
        color: var(--primary-white);
        font-size: 10px;
        font-weight: 700;
        padding: 2px 5px;
        border-radius: var(--radius-full);
        min-width: 18px;
        text-align: center;
    }

    /* ===============================================
    5. MAIN SELECTION SCREEN
    =============================================== */
    .main-selection {
        padding: 40px 20px;
        max-width: 1200px;
        margin: 0 auto;
    }

    .selection-title {
        text-align: center;
        font-size: 36px;
        font-weight: 900;
        margin-bottom: 40px;
        background: var(--gradient-fire);
        -webkit-background-clip: text;
        -webkit-text-fill-color: transparent;
        background-clip: text;
        text-transform: uppercase;
        letter-spacing: 2px;
    }

    .selection-cards {
        display: grid;
        grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
        gap: 30px;
        margin-bottom: 50px;
    }

    .selection-card {
        position: relative;
        background: linear-gradient(135deg, rgba(10, 10, 10, 0.9) 0%, rgba(30, 58, 138, 0.3) 100%);
        border: 2px solid rgba(255, 255, 255, 0.1);
        border-radius: var(--radius-xl);
        padding: 40px 30px;
        cursor: pointer;
        transition: var(--transition-normal);
        overflow: hidden;
        min-height: 350px;
    }

    .workout-card .card-background {
        position: absolute;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        background: linear-gradient(135deg, rgba(220, 38, 38, 0.1) 0%, rgba(255, 215, 0, 0.05) 100%);
        opacity: 0;
        transition: var(--transition-normal);
    }

    .calorie-card .card-background {
        position: absolute;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        background: linear-gradient(135deg, rgba(59, 130, 246, 0.1) 0%, rgba(16, 185, 129, 0.05) 100%);
        opacity: 0;
        transition: var(--transition-normal);
    }

    .selection-card:hover {
        transform: translateY(-5px);
        box-shadow: var(--shadow-xl), 0 0 40px rgba(220, 38, 38, 0.3);
        border-color: var(--primary-red);
    }

    .selection-card:hover .card-background {
        opacity: 1;
    }

    .card-content {
        position: relative;
        z-index: 1;
        display: flex;
        flex-direction: column;
        align-items: center;
        text-align: center;
        height: 100%;
    }

    .card-icon {
        font-size: 60px;
        margin-bottom: 20px;
        background: var(--gradient-fire);
        -webkit-background-clip: text;
        -webkit-text-fill-color: transparent;
        background-clip: text;
    }

    .calorie-card .card-icon {
        background: var(--gradient-ocean);
        -webkit-background-clip: text;
        -webkit-text-fill-color: transparent;
        background-clip: text;
    }

    .card-content h2 {
        font-size: 28px;
        font-weight: 900;
        margin-bottom: 10px;
        letter-spacing: 2px;
    }

    .card-content p {
        color: rgba(255, 255, 255, 0.7);
        margin-bottom: 20px;
        font-size: 14px;
    }

    .card-stats {
        display: flex;
        gap: 20px;
        margin: 20px 0;
        flex-wrap: wrap;
        justify-content: center;
    }

    .card-stats span {
        display: flex;
        align-items: center;
        gap: 5px;
        font-size: 12px;
        color: rgba(255, 255, 255, 0.6);
    }

    .card-stats i {
        color: var(--gold);
    }

    .card-btn {
        margin-top: auto;
        padding: 12px 24px;
        background: var(--gradient-fire);
        border: none;
        border-radius: var(--radius-full);
        color: var(--primary-white);
        font-weight: 700;
        cursor: pointer;
        transition: var(--transition-normal);
        display: flex;
        align-items: center;
        gap: 10px;
        text-transform: uppercase;
        letter-spacing: 1px;
        box-shadow: var(--shadow-md);
    }

    .calorie-card .card-btn {
        background: var(--gradient-ocean);
    }

    .card-btn:hover {
        transform: scale(1.05);
        box-shadow: var(--shadow-lg);
    }

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

    .stat-card {
        background: rgba(255, 255, 255, 0.05);
        border: 1px solid rgba(255, 255, 255, 0.1);
        border-radius: var(--radius-md);
        padding: 20px;
        display: flex;
        align-items: center;
        gap: 15px;
        transition: var(--transition-normal);
    }

    .stat-card:hover {
        background: rgba(255, 255, 255, 0.08);
        transform: translateY(-2px);
    }

    .stat-card i {
        font-size: 30px;
        color: var(--gold);
    }

    .stat-info {
        display: flex;
        flex-direction: column;
    }

    .stat-value {
        font-size: 24px;
        font-weight: 700;
        color: var(--primary-white);
    }

    .stat-label {
        font-size: 12px;
        color: rgba(255, 255, 255, 0.6);
        text-transform: uppercase;
        letter-spacing: 1px;
    }

    /* ===============================================
    6. WORKOUT SECTION
    =============================================== */
    .workout-section {
    /* Ensure the workout section spans the full width of the viewport on all devices. */
    width: 100%;
    min-height: 100vh;
    background: var(--gradient-dark);
    }

    .workout-header {
    /* Make sure the workout header fills the entire width of the page. */
    width: 100%;
    background: linear-gradient(135deg, var(--dark-red) 0%, var(--primary-black) 100%);
    padding: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: var(--shadow-lg);
    border-bottom: 3px solid var(--gold);
    }

    .back-btn {
        display: flex;
        align-items: center;
        gap: 8px;
        padding: 10px 20px;
        background: rgba(255, 255, 255, 0.1);
        border: none;
        border-radius: var(--radius-md);
        color: var(--primary-white);
        font-weight: 600;
        cursor: pointer;
        transition: var(--transition-normal);
    }

    .back-btn:hover {
        background: rgba(255, 255, 255, 0.2);
        transform: translateX(-5px);
    }

    .workout-title {
        display: flex;
        align-items: center;
        gap: 20px;
    }

    .workout-title h1 {
        font-size: 32px;
        font-weight: 900;
        background: var(--gradient-gold);
        -webkit-background-clip: text;
        -webkit-text-fill-color: transparent;
        background-clip: text;
        letter-spacing: 3px;
    }

    /* Remove the bounce animation from the workout mascot so it stays
       stationary in the header.  Without this animation the turtle
       icon no longer "pops" in and out. */
    .turtle-mascot {
        animation: none;
    }

    .buff-turtle {
        font-size: 40px;
    }

    .workout-date {
        color: rgba(255, 255, 255, 0.7);
        font-size: 14px;
    }

    /* Workout Tabs */
    .workout-tabs {
        background: rgba(10, 10, 10, 0.5);
        padding: 10px;
        display: flex;
        gap: 10px;
        overflow-x: auto;
        box-shadow: var(--shadow-md);
    }

    .workout-tab {
        padding: 12px 20px;
        background: rgba(255, 255, 255, 0.05);
        border: 2px solid transparent;
        border-radius: var(--radius-md);
        color: rgba(255, 255, 255, 0.6);
        font-weight: 600;
        cursor: pointer;
        transition: var(--transition-normal);
        display: flex;
        align-items: center;
        gap: 8px;
        white-space: nowrap;
        flex-shrink: 0;
    }

    .workout-tab:hover {
        background: rgba(255, 255, 255, 0.1);
        color: var(--primary-white);
    }

    .workout-tab.active {
        background: var(--gradient-fire);
        color: var(--primary-white);
        border-color: var(--gold);
        box-shadow: var(--shadow-md);
    }

    .workout-content {
        padding: 20px;
        max-width: 1400px;
        margin: 0 auto;
    }

    .tab-content {
        display: none;
    }

    .tab-content.active {
        display: block;
        animation: fadeIn 0.3s ease;
    }

    @keyframes fadeIn {
        from { opacity: 0; }
        to { opacity: 1; }
    }

    /* ===============================================
    7. MUSCLE MAP TAB
    =============================================== */
    .muscle-map-container {
        background: rgba(255, 255, 255, 0.05);
        border-radius: var(--radius-xl);
        padding: 30px;
        border: 2px solid rgba(255, 215, 0, 0.2);
    }

    .muscle-map-container h2 {
        text-align: center;
        font-size: 28px;
        margin-bottom: 10px;
        color: var(--gold);
    }

    .muscle-map-subtitle {
        text-align: center;
        color: rgba(255, 255, 255, 0.6);
        font-size: 14px;
        margin-bottom: 30px;
    }

    .body-graph {
        display: flex;
        justify-content: center;
        gap: 50px;
        margin-bottom: 40px;
        flex-wrap: wrap;
    }

    .body-view {
        text-align: center;
    }

    .body-svg {
        width: 200px;
        height: 400px;
        background: rgba(0, 0, 0, 0.3);
        border-radius: var(--radius-md);
        padding: 20px;
    }

    .muscle-group {
        fill: rgba(255, 255, 255, 0.1);
        stroke: rgba(255, 255, 255, 0.3);
        stroke-width: 1;
        transition: var(--transition-normal);
        cursor: pointer;
    }

    .muscle-group:hover {
        fill: rgba(255, 215, 0, 0.3);
        stroke: var(--gold);
    }

    .muscle-group.worked {
        fill: rgba(220, 38, 38, 0.7);
        stroke: var(--primary-red);
        animation: glow 1.5s ease-in-out infinite;
    }

    @keyframes glow {
        0%, 100% { filter: brightness(1); }
        50% { filter: brightness(1.3) drop-shadow(0 0 10px rgba(220, 38, 38, 0.8)); }
    }

    .view-label {
        margin-top: 10px;
        font-weight: 600;
        color: var(--gold);
        text-transform: uppercase;
        letter-spacing: 2px;
    }

    .muscle-groups {
        background: rgba(0, 0, 0, 0.3);
        border-radius: var(--radius-md);
        padding: 20px;
    }

    .muscle-groups h3 {
        text-align: center;
        margin-bottom: 20px;
        color: var(--primary-white);
    }

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

    .muscle-category {
        background: rgba(255, 255, 255, 0.05);
        border-radius: var(--radius-md);
        padding: 15px;
        border: 1px solid rgba(255, 255, 255, 0.1);
    }

    .muscle-category h4 {
        display: flex;
        align-items: center;
        gap: 10px;
        margin-bottom: 15px;
        color: var(--gold);
        font-size: 16px;
        text-transform: uppercase;
        letter-spacing: 1px;
    }

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

    .muscle-item {
        display: flex;
        align-items: center;
        gap: 10px;
        padding: 8px;
        background: rgba(0, 0, 0, 0.2);
        border-radius: var(--radius-sm);
        transition: var(--transition-normal);
    }

    .muscle-item:hover {
        background: rgba(255, 255, 255, 0.1);
    }

    .muscle-indicator {
        width: 12px;
        height: 12px;
        border-radius: 50%;
        background: rgba(255, 255, 255, 0.2);
        transition: var(--transition-normal);
    }

    .muscle-item.worked .muscle-indicator {
        background: var(--primary-red);
        box-shadow: 0 0 10px rgba(220, 38, 38, 0.5);
    }

    /* ===============================================
    8. WORKOUT TAB
    =============================================== */
    .workout-container {
        max-width: 800px;
        margin: 0 auto;
    }

    .workout-controls {
        display: flex;
        gap: 15px;
        margin-bottom: 30px;
        flex-wrap: wrap;
    }

    .start-workout-btn,
    .routine-btn {
        flex: 1;
        min-width: 200px;
        padding: 15px;
        background: var(--gradient-fire);
        border: none;
        border-radius: var(--radius-md);
        color: var(--primary-white);
        font-weight: 700;
        cursor: pointer;
        transition: var(--transition-normal);
        display: flex;
        align-items: center;
        justify-content: center;
        gap: 10px;
        text-transform: uppercase;
        letter-spacing: 1px;
        box-shadow: var(--shadow-md);
    }

    .routine-btn {
        background: var(--gradient-ocean);
    }

    .start-workout-btn:hover,
    .routine-btn:hover {
        transform: translateY(-2px);
        box-shadow: var(--shadow-lg);
    }

    .active-workout {
        background: rgba(255, 255, 255, 0.05);
        border: 2px solid var(--primary-red);
        border-radius: var(--radius-xl);
        padding: 30px;
        margin-bottom: 30px;
    }

    .workout-timer {
        display: flex;
        align-items: center;
        justify-content: center;
        gap: 10px;
        font-size: 32px;
        font-weight: 700;
        color: var(--gold);
        margin-bottom: 30px;
    }

    .exercises-list {
        margin-bottom: 30px;
    }

    .exercise-item {
        background: rgba(0, 0, 0, 0.3);
        border-radius: var(--radius-md);
        padding: 20px;
        margin-bottom: 15px;
        border: 1px solid rgba(255, 255, 255, 0.1);
    }

    .exercise-header {
        display: flex;
        justify-content: space-between;
        align-items: center;
        margin-bottom: 15px;
    }

    .exercise-name {
        font-size: 18px;
        font-weight: 700;
        color: var(--primary-white);
    }

    .exercise-sets {
        display: flex;
        flex-direction: column;
        gap: 10px;
    }

    .set-row {
        display: grid;
        /* A set row uses four columns: the set label, a flex
           container for the weight and reps inputs, a completion
           indicator, and a remove button.  Having a dedicated
           column for the remove button ensures that all rows
           remain aligned even when only one set is present. */
        grid-template-columns: 60px 1fr 30px 30px;
        gap: 10px;
        align-items: center;
    }

    /* Container for weight and reps inputs inside a set row.  Use flex
       to split the space evenly between the two inputs, and ensure
       they shrink gracefully on very small screens. */
    .set-inputs {
        display: flex;
        gap: 10px;
    }

    .set-inputs .set-input {
        flex: 1;
        /* Force the workout section to span the full viewport width.  Using
           100vw bypasses any max-width or parent constraints that may
           center content on mobile devices. */
        width: 100%;
    }

    .set-number {
        background: var(--gradient-fire);
        color: var(--primary-white);
        padding: 5px;
        border-radius: var(--radius-sm);
        text-align: center;
        font-weight: 700;
    }

    .set-input {
        padding: 8px;
        background: rgba(255, 255, 255, 0.05);
        border: 1px solid rgba(255, 255, 255, 0.2);
        border-radius: var(--radius-sm);
        color: var(--primary-white);
        text-align: center;
    }

    .set-input:focus {
        outline: none;
        border-color: var(--gold);
    }

    .set-complete {
        padding: 8px;
        background: rgba(255, 255, 255, 0.1);
        border: none;
        border-radius: var(--radius-sm);
        color: var(--primary-white);
        cursor: pointer;
        transition: var(--transition-normal);
    }

    .set-complete:hover {
        background: rgba(16, 185, 129, 0.3);
    }

    .set-complete.completed {
        background: rgba(16, 185, 129, 0.5);
        color: #10B981;
    }

    /*
    Interactive status indicator for sets displayed in the active workout list.
    Each set row in the workout summary uses a span with class `.set-status` to
    show whether the set has been completed.  Make these indicators clickable
    with a pointer cursor and visually distinct when completed.
    */
    .set-status {
        cursor: pointer;
        user-select: none;
        font-size: 18px;
        padding: 4px 6px;
        border-radius: var(--radius-sm);
        background: rgba(255, 255, 255, 0.05);
        display: inline-flex;
        align-items: center;
        justify-content: center;
        transition: background var(--transition-fast), color var(--transition-fast);
    }

    .set-status.completed {
        background: var(--gradient-fire);
        color: var(--primary-white);
    }

    /* Remove button for a set row.  This allows the user to delete
       a set when more than one exists.  Styled to match the
       aesthetic of other controls with subtle backgrounds and
       transitions. */
    .set-remove {
        width: 30px;
        height: 30px;
        display: flex;
        align-items: center;
        justify-content: center;
        background: rgba(255, 255, 255, 0.05);
        border: 2px solid rgba(255, 255, 255, 0.1);
        border-radius: var(--radius-sm);
        color: var(--primary-red);
        font-size: 18px;
        cursor: pointer;
        transition: background var(--transition-fast), color var(--transition-fast), border var(--transition-fast);
    }
    .set-remove:hover {
        background: var(--gradient-fire);
        border-color: var(--gradient-fire);
        color: var(--primary-white);
    }

    /* Placeholder element to preserve grid alignment when there is
       only one set (and thus no remove button).  It occupies the
       same space as the real remove button but is invisible. */
    .set-remove-placeholder {
        width: 30px;
        height: 30px;
        display: block;
    }

/* Input boxes for editing weight and reps inline in the active workout.
   These inputs replace the old text-only display so that users can
   directly adjust values without popups.  They are styled similarly
   to other UI elements with a subtle border and dark background to
   indicate interactivity. */
    .set-display-weight,
    .set-display-reps {
        /* Force the header to fill the full viewport width. */
        width: 100%;
        padding: 6px 8px;
        background: rgba(255, 255, 255, 0.05);
        border: 2px solid rgba(255, 255, 255, 0.1);
        border-radius: var(--radius-sm);
        color: var(--primary-white);
        text-align: center;
        font-size: 14px;
        transition: var(--transition-normal);
    }


.set-display-weight:focus,
.set-display-reps:focus {
    outline: none;
    border-color: var(--primary-red);
    background: rgba(255, 255, 255, 0.1);
    box-shadow: 0 0 10px rgba(220, 38, 38, 0.3);
}

    /* Button to add an extra set within an exercise item */
    .inline-add-set {
        margin-top: 10px;
        padding: 6px 10px;
        background: rgba(255, 255, 255, 0.08);
        border: none;
        border-radius: var(--radius-md);
        color: var(--primary-white);
        cursor: pointer;
        font-size: 16px;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        transition: background var(--transition-fast), color var(--transition-fast);
    }
    .inline-add-set i {
        pointer-events: none;
    }
    .inline-add-set:hover {
        background: var(--gradient-fire);
    }

    /* Editable weight and reps inputs inside the active workout sets */
    input.set-display-weight, input.set-display-reps {
        width: 100%;
        padding: 6px 8px;
        background: rgba(255, 255, 255, 0.05);
        border: 1px solid rgba(255, 255, 255, 0.2);
        border-radius: var(--radius-sm);
        color: var(--primary-white);
        text-align: center;
        font-size: 14px;
    }
    input.set-display-weight:focus, input.set-display-reps:focus {
        outline: none;
        border-color: var(--gold);
    }

    .workout-actions {
        display: flex;
        gap: 15px;
        flex-wrap: wrap;
    }

    .add-exercise-btn,
    .finish-workout-btn,
    .cancel-workout-btn {
        flex: 1;
        min-width: 150px;
        padding: 12px;
        border: none;
        border-radius: var(--radius-md);
        font-weight: 600;
        cursor: pointer;
        transition: var(--transition-normal);
        display: flex;
        align-items: center;
        justify-content: center;
        gap: 8px;
    }

    .add-exercise-btn {
        background: var(--gradient-ocean);
        color: var(--primary-white);
    }

    .finish-workout-btn {
        background: linear-gradient(135deg, #10B981 0%, #059669 100%);
        color: var(--primary-white);
    }

    .cancel-workout-btn {
        background: rgba(239, 68, 68, 0.2);
        color: #EF4444;
        border: 1px solid #EF4444;
    }

    .add-exercise-btn:hover,
    .finish-workout-btn:hover,
    .cancel-workout-btn:hover {
        transform: scale(1.05);
    }

    .workout-history {
        background: rgba(255, 255, 255, 0.05);
        border-radius: var(--radius-xl);
        padding: 25px;
    }

    .workout-history h3 {
        margin-bottom: 20px;
        color: var(--gold);
    }

    .history-list {
        display: flex;
        flex-direction: column;
        gap: 15px;
    }

    .history-item {
    background: rgba(0, 0, 0, 0.3);
        border-radius: var(--radius-md);
        padding: 15px;
        border-left: 4px solid var(--primary-red);
        transition: var(--transition-normal);
        cursor: pointer;
    position: relative;
    }

    .history-item:hover {
        background: rgba(0, 0, 0, 0.5);
        transform: translateX(5px);
    }

    .history-date {
        font-size: 12px;
        color: rgba(255, 255, 255, 0.6);
        margin-bottom: 5px;
    }

    .history-exercises {
        color: var(--primary-white);
        font-weight: 600;
    }

    .history-stats {
        display: flex;
        gap: 20px;
        margin-top: 10px;
        font-size: 12px;
        color: rgba(255, 255, 255, 0.5);
    }

    /* ===============================================
    9. PROGRESS TAB - MOBILE OPTIMIZED
    =============================================== */
    .progress-container {
        display: flex;
        flex-direction: column;
        gap: 20px;
        padding: 10px;
    }

    /* Personal Records Section - Mobile Optimized */
    .prs-section {
        background: rgba(255, 255, 255, 0.05);
        border-radius: var(--radius-lg);
        padding: 15px;
        border: 1px solid rgba(255, 255, 255, 0.1);
    }

    .prs-section h3 {
        display: flex;
        align-items: center;
        gap: 8px;
        margin-bottom: 15px;
        color: var(--gold);
        font-size: 18px;
    }

    .prs-list {
        display: flex;
        flex-direction: column;
        gap: 10px;
        margin-bottom: 15px;
    }

    .pr-item {
        background: linear-gradient(135deg, rgba(255, 215, 0, 0.1) 0%, rgba(220, 38, 38, 0.1) 100%);
        border: 1px solid var(--gold);
        border-radius: var(--radius-md);
        padding: 12px;
        position: relative;
        display: flex;
        flex-direction: column;
        gap: 5px;
    }

    .pr-exercise {
        font-weight: 600;
        color: var(--primary-white);
        font-size: 14px;
    }

    .pr-value {
        font-size: 20px;
        font-weight: 700;
        color: var(--gold);
    }

    .pr-date {
        font-size: 11px;
        color: rgba(255, 255, 255, 0.5);
    }

    /* Photo Progress Section - Mobile Optimized */
    .photo-progress {
        background: rgba(255, 255, 255, 0.05);
        border-radius: var(--radius-lg);
        padding: 15px;
        border: 1px solid rgba(255, 255, 255, 0.1);
    }

    .photo-progress h3 {
        display: flex;
        align-items: center;
        gap: 8px;
        margin-bottom: 15px;
        color: var(--gold);
        font-size: 18px;
    }

    .photo-grid {
        display: grid;
        grid-template-columns: repeat(3, 1fr);
        gap: 8px;
        margin-bottom: 15px;
    }

    .photo-item {
        position: relative;
        aspect-ratio: 1;
        border-radius: var(--radius-sm);
        overflow: hidden;
        cursor: pointer;
        transition: var(--transition-normal);
    }

    .photo-item img {
        width: 100%;
        height: 100%;
        object-fit: cover;
    }

    .photo-item:hover {
        transform: scale(1.05);
        box-shadow: var(--shadow-md);
    }

    .photo-date {
        position: absolute;
        bottom: 0;
        left: 0;
        right: 0;
        background: rgba(0, 0, 0, 0.7);
        color: var(--primary-white);
        padding: 3px;
        font-size: 9px;
        text-align: center;
    }


    .measurements-table thead {
        background: rgba(255, 255, 255, 0.05);
    }

    .measurements-table th,
    .measurements-table td {
        padding: 6px;
        text-align: center;
        border-bottom: 1px solid rgba(255, 255, 255, 0.1);
        white-space: nowrap;
    }

    .measurements-table tr:nth-child(even) {
        background: rgba(255, 255, 255, 0.03);
    }

    #measurements-chart {
        background: rgba(0, 0, 0, 0.3);
        border-radius: var(--radius-md);
        padding: 15px;
        min-height: 150px;
        display: flex;
        align-items: center;
        justify-content: center;
        color: rgba(255, 255, 255, 0.5);
        font-size: 12px;
        overflow-x: auto;
    }

    /* Weight Progress Section - Mobile Optimized */
    .weight-section {
        background: rgba(255, 255, 255, 0.05);
        border-radius: var(--radius-lg);
        padding: 15px;
        border: 1px solid rgba(255, 255, 255, 0.1);
    }

    .weight-section h3 {
        display: flex;
        align-items: center;
        gap: 8px;
        margin-bottom: 15px;
        color: var(--gold);
        font-size: 18px;
    }

    .weight-input-row {
        display: flex;
        gap: 8px;
        align-items: center;
        margin-bottom: 12px;
    }

    .weight-input-row input {
        flex: 1;
        padding: 10px;
        background: rgba(255, 255, 255, 0.05);
        border: 1px solid rgba(255, 255, 255, 0.2);
        border-radius: var(--radius-md);
        color: var(--primary-white);
        font-size: 14px;
    }

    .weight-range-buttons {
        display: grid;
        grid-template-columns: repeat(2, 1fr);
        gap: 8px;
        margin-bottom: 12px;
    }

    .weight-range-btn {
        padding: 8px;
        background: rgba(255, 255, 255, 0.05);
        border: 1px solid rgba(255, 255, 255, 0.2);
        border-radius: var(--radius-md);
        color: var(--primary-white);
        font-size: 12px;
        cursor: pointer;
        transition: var(--transition-fast);
        text-align: center;
    }

    .weight-range-btn.active,
    .weight-range-btn:hover {
        background: var(--gradient-fire);
        border-color: var(--gold);
        color: var(--primary-white);
    }

    #weight-chart {
        width: 100%;
        height: 180px !important;
    }

    /* Button Styles for Progress Tab */
    .add-pr-btn,
    .add-photo-btn,
    .save-measurements-btn,
    .save-weight-btn {
        padding: 10px 16px;
        background: var(--gradient-fire);
        border: none;
        border-radius: var(--radius-md);
        color: var(--primary-white);
        font-weight: 600;
        cursor: pointer;
        transition: var(--transition-normal);
        display: inline-flex;
        align-items: center;
        justify-content: center;
        gap: 8px;
        font-size: 14px;
    }

    .add-pr-btn:hover,
    .add-photo-btn:hover,
    .save-measurements-btn:hover,
    .save-weight-btn:hover {
        transform: translateY(-2px);
        box-shadow: var(--shadow-md);
    }

    .save-weight-btn {
        flex-shrink: 0;
    }

    /* ===============================================
    10. EXERCISE LIBRARY TAB
    =============================================== */
    .library-container {
        max-width: 1200px;
        margin: 0 auto;
    }

    .library-container h3 {
        text-align: center;
        font-size: 28px;
        margin-bottom: 30px;
        color: var(--gold);
    }

    .library-search {
        position: relative;
        max-width: 500px;
        margin: 0 auto 30px;
    }

    .library-search input {
        width: 100%;
        padding: 15px 50px 15px 20px;
        background: rgba(255, 255, 255, 0.05);
        border: 2px solid rgba(255, 255, 255, 0.1);
        border-radius: var(--radius-full);
        color: var(--primary-white);
        font-size: 16px;
    }

    .library-search input:focus {
        outline: none;
        border-color: var(--gold);
    }

    .library-search i {
        position: absolute;
        right: 20px;
        top: 50%;
        transform: translateY(-50%);
        color: rgba(255, 255, 255, 0.5);
    }

    .library-filters {
        display: flex;
        justify-content: center;
        gap: 10px;
        margin-bottom: 30px;
        flex-wrap: wrap;
    }

    .filter-btn {
        padding: 10px 20px;
        background: rgba(255, 255, 255, 0.05);
        border: 1px solid rgba(255, 255, 255, 0.2);
        border-radius: var(--radius-full);
        color: rgba(255, 255, 255, 0.7);
        font-weight: 600;
        cursor: pointer;
        transition: var(--transition-normal);
    }

    .filter-btn:hover {
        background: rgba(255, 255, 255, 0.1);
        color: var(--primary-white);
    }

    .filter-btn.active {
        background: var(--gradient-fire);
        border-color: transparent;
        color: var(--primary-white);
    }

    .exercises-grid {
        display: grid;
        grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
        gap: 20px;
    }

    .exercise-card {
        background: rgba(255, 255, 255, 0.05);
        border: 1px solid rgba(255, 255, 255, 0.1);
        border-radius: var(--radius-md);
        padding: 20px;
        transition: var(--transition-normal);
        cursor: pointer;
    }

    .exercise-card:hover {
        background: rgba(255, 255, 255, 0.08);
        transform: translateY(-5px);
        box-shadow: var(--shadow-lg);
        border-color: var(--gold);
    }

    .exercise-card-header {
        display: flex;
        justify-content: space-between;
        align-items: start;
        margin-bottom: 15px;
    }

    .exercise-card-title {
        font-weight: 700;
        color: var(--primary-white);
        font-size: 16px;
    }

    .exercise-card-category {
        background: var(--gradient-fire);
        color: var(--primary-white);
        padding: 4px 8px;
        border-radius: var(--radius-sm);
        font-size: 10px;
        text-transform: uppercase;
        letter-spacing: 1px;
    }

    .exercise-card-muscles {
        color: rgba(255, 255, 255, 0.7);
        font-size: 14px;
        margin-bottom: 10px;
    }

    .exercise-card-difficulty {
        display: flex;
        gap: 3px;
    }

    .difficulty-star {
        color: rgba(255, 215, 0, 0.3);
    }

    .difficulty-star.filled {
        color: var(--gold);
    }

    /* ===============================================
    11. MODALS
    =============================================== */
    .modal {
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        background: rgba(0, 0, 0, 0.8);
        display: flex;
        justify-content: center;
        align-items: center;
        z-index: 1000;
        padding: 20px;
    }

    .modal-content {
        background: var(--gradient-dark);
        border: 2px solid rgba(255, 255, 255, 0.1);
        border-radius: var(--radius-xl);
        max-width: 600px;
        width: 100%;
        max-height: 80vh;
        overflow-y: auto;
        animation: modalSlideIn 0.3s ease;
    }

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

    .modal-header {
        display: flex;
        justify-content: space-between;
        align-items: center;
        padding: 20px;
        border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    }

    .modal-header h2 {
        color: var(--gold);
        font-size: 24px;
    }

    .close-modal {
        background: none;
        border: none;
        color: rgba(255, 255, 255, 0.7);
        font-size: 24px;
        cursor: pointer;
        transition: var(--transition-normal);
    }

    .close-modal:hover {
        color: var(--primary-red);
    }

    .modal-body {
        padding: 20px;
    }

    .exercise-form {
        display: flex;
        flex-direction: column;
        gap: 20px;
    }

    .exercise-form input {
        padding: 12px;
        background: rgba(255, 255, 255, 0.05);
        border: 1px solid rgba(255, 255, 255, 0.2);
        border-radius: var(--radius-md);
        color: var(--primary-white);
        font-size: 16px;
    }

    .exercise-form input:focus {
        outline: none;
        border-color: var(--gold);
    }

    /* Muscle group selector styling inside the exercise and PR modals */
    .muscle-select {
        display: flex;
        flex-direction: row;
        flex-wrap: wrap;
        gap: 10px;
    }
    .muscle-select select {
        /* Each select takes roughly half of the available space on larger screens.
           The flex-basis uses calc to account for the gap between the two
           items.  A minimum width prevents collapsing on very narrow screens. */
        flex: 1 1 calc(50% - 10px);
        min-width: 130px;
        /* Increase padding and font-size for easier touch targets,
           improving mobile usability and visual heft. */
        padding: 12px 14px;
        background: rgba(255, 255, 255, 0.05);
        border: 1px solid rgba(255, 255, 255, 0.2);
        border-radius: var(--radius-md);
        color: var(--primary-white);
        font-size: 16px;
        min-height: 44px;
    }
    .muscle-select select:focus {
        outline: none;
        border-color: var(--gold);
    }

    .sets-container {
        display: flex;
        flex-direction: column;
        gap: 10px;
    }

    .add-set-btn,
    .save-exercise-btn {
        padding: 12px;
        border: none;
        border-radius: var(--radius-md);
        font-weight: 600;
        cursor: pointer;
        transition: var(--transition-normal);
        display: flex;
        align-items: center;
        justify-content: center;
        gap: 10px;
    }

    .add-set-btn {
        background: rgba(255, 255, 255, 0.1);
        color: var(--primary-white);
        border: 1px dashed rgba(255, 255, 255, 0.3);
    }

    .save-exercise-btn {
        background: var(--gradient-fire);
        color: var(--primary-white);
    }

    /* Save button for the personal record modal */
    .save-pr-btn {
        padding: 12px;
        border: none;
        border-radius: var(--radius-md);
        font-weight: 600;
        cursor: pointer;
        transition: var(--transition-normal);
        display: flex;
        align-items: center;
        justify-content: center;
        gap: 10px;
        background: var(--gradient-fire);
        color: var(--primary-white);
    }
    .save-pr-btn:hover {
        transform: scale(1.05);
    }
    /* Fix routine modal layout */
    #routine-exercise-modal .exercise-form {
        display: flex;
        flex-direction: column;
        gap: 15px;
    }

    #routine-exercise-modal .exercise-form input,
    #routine-exercise-modal .exercise-form select {
        width: 100%;
        padding: 12px;
        background: rgba(255, 255, 255, 0.05);
        border: 1px solid rgba(255, 255, 255, 0.2);
        border-radius: var(--radius-md);
        color: var(--primary-white);
        font-size: 16px;
    }

    /* List of exercises in routine */
    .routine-exercises-list {
        max-height: 200px;
        overflow-y: auto;
        margin: 15px 0;
        padding: 10px;
        background: rgba(0, 0, 0, 0.3);
        border-radius: var(--radius-md);
    }

    .routine-exercise-item {
        display: flex;
        justify-content: space-between;
        align-items: center;
        padding: 8px;
        margin-bottom: 8px;
        background: rgba(255, 255, 255, 0.05);
        border-radius: var(--radius-sm);
    }

    .routine-exercise-delete {
        background: rgba(220, 38, 38, 0.2);
        border: none;
        color: var(--primary-red);
        padding: 4px 8px;
        border-radius: var(--radius-sm);
        cursor: pointer;
    }

    .routine-exercise-delete:hover {
        background: rgba(220, 38, 38, 0.4);
        color: var(--primary-white);
    }

    /* Save button for routine exercise modal */
    .save-routine-ex-btn {
        padding: 12px;
        border: none;
        border-radius: var(--radius-md);
        font-weight: 600;
        cursor: pointer;
        transition: var(--transition-normal);
        display: flex;
        align-items: center;
        justify-content: center;
        gap: 10px;
        background: var(--gradient-fire);
        color: var(--primary-white);
    }
    .save-routine-ex-btn:hover {
        transform: scale(1.05);
    }

    .add-set-btn:hover,
    .save-exercise-btn:hover {
        transform: scale(1.05);
    }

    .create-routine-btn {
        width: 100%;
        padding: 15px;
        background: var(--gradient-ocean);
        border: none;
        border-radius: var(--radius-md);
        color: var(--primary-white);
        font-weight: 600;
        cursor: pointer;
        transition: var(--transition-normal);
        display: flex;
        align-items: center;
        justify-content: center;
        gap: 10px;
        margin-bottom: 20px;
    }

    .create-routine-btn:hover {
        transform: translateY(-2px);
        box-shadow: var(--shadow-lg);
    }

    .routines-list {
        display: flex;
        flex-direction: column;
        gap: 15px;
    }

    .routine-item {
        background: rgba(255, 255, 255, 0.05);
        border: 1px solid rgba(255, 255, 255, 0.1);
        border-radius: var(--radius-md);
        padding: 15px;
        cursor: pointer;
        transition: var(--transition-normal);
    }

    .routine-item:hover {
        background: rgba(255, 255, 255, 0.08);
        border-color: var(--gold);
        transform: translateX(5px);
    }

    .routine-name {
        font-weight: 700;
        color: var(--primary-white);
        margin-bottom: 5px;
    }

    .routine-exercises {
        color: rgba(255, 255, 255, 0.6);
        font-size: 14px;
    }

    /* Edit button inside a routine item */
    .edit-routine-btn {
        background: none;
        border: none;
        color: rgba(255, 255, 255, 0.6);
        cursor: pointer;
        font-size: 16px;
        padding: 0 6px;
        display: flex;
        align-items: center;
    }
    .edit-routine-btn i {
        pointer-events: none;
    }
    .edit-routine-btn:hover {
        color: var(--gold);
    }

    /* ===============================================
    12. CALORIE SECTION
    =============================================== */
    .calorie-section {
        min-height: 100vh;
        padding: 20px;
    }

    .section-header {
        display: flex;
        align-items: center;
        gap: 20px;
        margin-bottom: 40px;
        padding: 20px;
        background: linear-gradient(135deg, var(--dark-blue) 0%, var(--primary-black) 100%);
        border-bottom: 3px solid var(--light-blue);
    }

    .section-header h1 {
        font-size: 32px;
        color: var(--primary-white);
    }

    .coming-soon {
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        min-height: 400px;
        text-align: center;
        color: rgba(255, 255, 255, 0.6);
    }

    .coming-soon i {
        font-size: 80px;
        margin-bottom: 20px;
        color: var(--light-blue);
    }

    .coming-soon h2 {
        font-size: 36px;
        margin-bottom: 10px;
        color: var(--primary-white);
    }

    /* ===============================================
    13. RESPONSIVE DESIGN - ENHANCED FOR MOBILE
    =============================================== */
    @media (max-width: 768px) {
        .dashboard-header {
            flex-direction: column;
            gap: 15px;
            text-align: center;
        }
        
        .header-center {
            order: -1;
        }
        
        #welcome-message {
            font-size: 16px;
        }
        
        .selection-title {
            font-size: 28px;
        }
        
        .selection-cards {
            grid-template-columns: 1fr;
        }
        
        .workout-header {
            flex-direction: column;
            gap: 15px;
            text-align: center;
        }
        
        .workout-title h1 {
            font-size: 24px;
        }
        
        .body-graph {
            flex-direction: column;
            align-items: center;
        }
        
        .muscle-categories {
            grid-template-columns: 1fr;
        }
        
        /* On narrower screens, the set row also uses four columns: the
           set label, a flex container for weight/reps inputs, a
           completion indicator and a remove button.  Provide
           slightly smaller dimensions for the first and last
           columns so the inputs have sufficient room without
           overflowing on mobile devices. */
        .set-row {
            grid-template-columns: 40px 1fr 30px 30px;
        }
        

        .exercises-grid {
            grid-template-columns: 1fr;
        }

        /* Enhanced mobile progress tab */
        .prs-list {
            grid-template-columns: 1fr;
        }
    }

    @media (max-width: 480px) {
        .auth-card {
            padding: 30px 20px;
        }
        
        .app-title {
            font-size: 24px;
        }
        
        .selection-cards {
            gap: 20px;
        }
        
        .selection-card {
            min-height: 300px;
            padding: 30px 20px;
        }
        
        .quick-stats {
            grid-template-columns: 1fr;
        }
        
        .workout-tabs {
            flex-wrap: wrap;
        }
        
        .workout-tab {
            flex: 1 1 calc(50% - 5px);
            min-width: calc(50% - 5px);
        }
        
        .body-svg {
            width: 150px;
            height: 300px;
        }

        /* Stack the workout header elements vertically on small screens.  This
           prevents unused horizontal space and improves readability. */
        .workout-header {
            flex-direction: column;
            align-items: flex-start;
            gap: 12px;
            text-align: left;
        }
        .workout-header .workout-title {
            flex-direction: row;
            justify-content: space-between;
            align-items: center;
            width: 100%;
        }
        .workout-header .workout-date {
            width: 100%;
        }
    
        /* Adjust weight input layout to wrap on small screens */
        .weight-input-row {
            flex-direction: row;
            align-items: center;
        }
        .weight-input-row input {
            flex: 1;
        }

        /* Stack workout tab buttons vertically and make them full width on small screens */
        .workout-tabs {
            flex-direction: row;
            flex-wrap: wrap;
            align-items: stretch;
            gap: 8px;
        }
        .workout-tab {
            flex: 1 1 calc(50% - 4px);
            min-width: calc(50% - 4px);
        }

        /* Tighten padding on progress cards to conserve vertical space on phones */
        .prs-section,
        .photo-progress,
        .measurements-section,
        .weight-section {
            padding: 12px;
        }

        /* Allow horizontal scrolling of the measurement history table and reduce font size */
        #measurements-chart {
            overflow-x: auto;
        }
        .measurements-table {
            font-size: 10px;
            min-width: 500px;
        }

        /* Photo grid - 3 columns on mobile for better visibility */
        .photo-grid {
            grid-template-columns: repeat(3, 1fr);
            gap: 6px;
        }

        /* PR items stack vertically on mobile */
        .prs-list {
            display: flex;
            flex-direction: column;
            gap: 8px;
        }

        .pr-item {
            padding: 10px;
        }

        /* Weight range buttons - 2x2 grid on mobile */
        .weight-range-buttons {
            grid-template-columns: repeat(2, 1fr);
        }

        /* Allow core dashboard containers to span the full width on small
           screens instead of capping them.  This helps prevent large
           blank margins or unused space on phone layouts. */
        .main-selection,
        .workout-container,
        .library-container,
        .progress-container {
            max-width: none;
            width: 100%;
            margin-left: 0;
            margin-right: 0;
            padding-left: 10px;
            padding-right: 10px;
        }

        /* Ensure workout tab content spans the full width on small screens */
        .workout-content {
            max-width: none;
            margin-left: 0;
            margin-right: 0;
            padding: 10px;
        }

        /* Progress photo improvements */
        #progress-photos {
            display: grid;
            grid-template-columns: repeat(3, 1fr);
            gap: 6px;
        }
        
        #progress-photos img {
            max-width: 100%;
            height: auto;
            aspect-ratio: 1;
            object-fit: cover;
            border-radius: 6px;
        }
    }

    /* ===============================================
    14. UTILITY CLASSES
    =============================================== */
    .hidden {
        display: none !important;
    }

    .show {
        display: block !important;
    }

    .text-center {
        text-align: center;
    }

    .mt-10 {
        margin-top: 10px;
    }

    .mt-20 {
        margin-top: 20px;
    }

    .mb-10 {
        margin-bottom: 10px;
    }

    .mb-20 {
        margin-bottom: 20px;
    }

    /* ===============================================
    15. ANIMATIONS
    =============================================== */
    @keyframes slideInLeft {
        from {
            opacity: 0;
            transform: translateX(-50px);
        }
        to {
            opacity: 1;
            transform: translateX(0);
        }
    }

    @keyframes slideInRight {
        from {
            opacity: 0;
            transform: translateX(50px);
        }
        to {
            opacity: 1;
            transform: translateX(0);
        }
    }

    @keyframes slideInUp {
        from {
            opacity: 0;
            transform: translateY(50px);
        }
        to {
            opacity: 1;
            transform: translateY(0);
        }
    }

    @keyframes shake {
        0%, 100% { transform: translateX(0); }
        25% { transform: translateX(-5px); }
        75% { transform: translateX(5px); }
    }

    /* Loading animations */
    .animate-pulse {
        animation: pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
    }

    .animate-bounce {
        animation: bounce 1s infinite;
    }

    .animate-spin {
        animation: spin 1s linear infinite;
    }

    @keyframes spin {
        from { transform: rotate(0deg); }
        to { transform: rotate(360deg); }
    }

    /* ===============================================
    16. SCROLLBAR STYLING
    =============================================== */
    ::-webkit-scrollbar {
        width: 10px;
        height: 10px;
    }

    ::-webkit-scrollbar-track {
        background: rgba(255, 255, 255, 0.05);
        border-radius: var(--radius-full);
    }

    ::-webkit-scrollbar-thumb {
        background: var(--gradient-fire);
        border-radius: var(--radius-full);
    }

    ::-webkit-scrollbar-thumb:hover {
        background: var(--primary-red);
    }

    /* Firefox */
    * {
        scrollbar-width: thin;
        scrollbar-color: var(--primary-red) rgba(255, 255, 255, 0.05);
    }

    /* Container for progress photos */
#progress-photos {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  margin-top: 10px;
}

/* On small screens, stack the two muscle group selects vertically. */
@media (max-width: 600px) {
  .muscle-select select {
    flex: 1 1 100%;
  }
}

/* Each photo */
#progress-photos img {
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  border-radius: 6px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  cursor: pointer;
}

/* Inline note next to Photo Progress title */
.photo-cap {
  font-size: 0.75rem;
  color: rgba(255, 255, 255, 0.5);
  margin-left: 8px;
  font-weight: 400;
}

/* ============================
   Progress Tab (Charts + Photos)
   ============================ */
.progress-inner {
  padding: 1rem;
}

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

.progress-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.progress-actions .auth-btn {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.4rem 0.8rem;
}

.photo-note {
  font-size: 0.8rem;
  color: #aaa;
}

/* Charts wrapper */
.charts-wrap {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  margin-bottom: 2rem;
}

.charts-wrap canvas {
  width: 100% !important;
  background: #1a1a1a;
  border-radius: 8px;
  padding: 0.5rem;
  box-shadow: 0 2px 5px rgba(0,0,0,0.25);
}

/* ============================
   Photo Grid
   ============================ */
.photo-card {
  position: relative;
  border-radius: 8px;
  overflow: hidden;
  background: #222;
  box-shadow: 0 2px 4px rgba(0,0,0,0.3);
  display: flex;
  flex-direction: column;
}

.photo-card.uploading .photo-thumb {
  filter: grayscale(1) brightness(0.6);
}

.photo-thumb {
  width: 100%;
  padding-top: 100%; /* square */
  background-size: cover;
  background-position: center;
}

.photo-meta {
  padding: 0.4rem 0.6rem;
  font-size: 0.8rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  color: #ccc;
}

.photo-meta .date {
  font-size: 0.75rem;
  color: #888;
}

.photo-actions {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.photo-actions a {
  font-size: 0.75rem;
  color: #4da6ff;
  text-decoration: none;
}

.photo-actions a:hover {
  text-decoration: underline;
}

.photo-actions .auth-btn {
  background: none;
  border: none;
  padding: 0.25rem;
  color: #f55;
  cursor: pointer;
  font-size: 0.9rem;
}

.photo-actions .auth-btn:hover {
  color: #ff7777;
}

/* Personal Record delete button */
.pr-delete {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 20px;
  height: 20px;
  border: none;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.1);
  color: var(--primary-white);
  font-size: 14px;
  line-height: 20px;
  padding: 0;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.pr-delete:hover {
  background: rgba(220, 38, 38, 0.8);
}

/* Delete button for measurement history rows. Placed inside a table cell to
   allow users to remove incorrect entries from their body measurement
   history. Styled similarly to other delete actions in the app. */
.measurements-table .measurement-delete {
    border: none;
    border-radius: 50%;
    width: 24px;
    height: 24px;
    background: rgba(255, 255, 255, 0.1);
    color: var(--primary-red);
    font-size: 16px;
    line-height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background var(--transition-fast), color var(--transition-fast);
}

.measurements-table .measurement-delete:hover {
    background: var(--gradient-fire);
    color: var(--primary-white);
}

/* Delete button for workout history items */
.history-delete {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 20px;
  height: 20px;
  border: none;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.1);
  color: var(--primary-white);
  font-size: 14px;
  line-height: 20px;
  padding: 0;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.history-delete:hover {
  background: rgba(220, 38, 38, 0.8);
}

/* Delete routine button inside routine modal */
.delete-routine-btn {
  background: rgba(220, 38, 38, 0.15);
  color: var(--primary-white);
  border: 1px solid rgba(220, 38, 38, 0.4);
  border-radius: var(--radius-md);
  padding: 10px 16px;
  font-size: 14px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  transition: background var(--transition-fast), border-color var(--transition-fast);
}

.delete-routine-btn i {
  pointer-events: none;
}

.delete-routine-btn:hover {
  background: rgba(220, 38, 38, 0.35);
  border-color: rgba(220, 38, 38, 1);
}
/* mobile overflow guard */
html, body { max-width: 100%; overflow-x: hidden; }
.main-dashboard, .tab-content, .progress-tab, .container, #content { overflow-x: hidden; }

/* Loader image sizing */
.turtle-loader-img { width: 84px; height: 84px; display: inline-block; animation: bounce 1s infinite; }


/* ==== Add Exercise modal polish ==== */
#exercise-modal .exercise-form input[type="text"],
#exercise-modal .exercise-form input[type="number"],
#exercise-modal .exercise-form select {
  background: rgba(255,255,255,.06);
  color: var(--primary-white);
  border: 1px solid rgba(255,255,255,.18);
  border-radius: var(--radius-md);
}
#exercise-modal .exercise-form input:focus,
#exercise-modal .exercise-form select:focus {
  outline: none;
  border-color: var(--gold);
  box-shadow: 0 0 0 2px rgba(255,215,0,.15);
}

/* Full-width buttons (like before) */
#exercise-modal .add-set-btn,
#exercise-modal .save-exercise-btn {
  width: 100%;
}

/* Stretch weight + reps together to fill the row */
#exercise-modal .set-row { display: grid; grid-template-columns: 64px 1fr; column-gap: 8px; align-items: center; }
#exercise-modal .set-inputs { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; width: 100%; }
#exercise-modal .set-complete { display: none; } /* hide check in modal */
#exercise-modal .set-display-weight, #exercise-modal .set-display-reps { width: 100%; max-width: none; }

/* === Progress Photos Grid === */
#progress-photos {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

#progress-photos img.progress-photo {
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  border-radius: 8px;
  cursor: pointer;
  transition: transform 0.2s;
}

#progress-photos img.progress-photo:hover {
  transform: scale(1.05);
  box-shadow: 0 4px 12px rgba(220, 38, 38, 0.3);
}

/* Desktop: 4-6 columns */
@media (min-width: 768px) {
  #progress-photos {
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
  }
}

@media (min-width: 1200px) {
  #progress-photos {
    grid-template-columns: repeat(6, 1fr);
    gap: 15px;
  }
}

/* PR Grid - properly spaced on desktop */
.prs-list { 
  display: grid; 
  grid-template-columns: 1fr; 
  gap: 12px; 
}

@media (min-width: 768px) {
  .prs-list {
    grid-template-columns: repeat(2, 1fr);
    gap: 15px;
  }
}

@media (min-width: 1200px) {
  .prs-list {
    grid-template-columns: repeat(3, 1fr);
  }
}

.pr-item { 
  display: flex; 
  align-items: center; 
  justify-content: space-between; 
  padding: 12px 14px; 
}

.pr-item .pr-delete { 
  background: transparent; 
  border: 0; 
  width: 28px; 
  height: 28px; 
  line-height: 26px; 
  cursor: pointer; 
}

/* Body Measurements Section */
.measurements-section {
    background: rgba(255, 255, 255, 0.05);
    border-radius: var(--radius-lg);
    padding: 15px;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.measurements-section h3 {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 15px;
    color: var(--gold);
    font-size: 18px;
}

.measurements-history h4 {
    color: var(--gold);
    font-size: 16px;
    margin-bottom: 12px;
    font-weight: 600;
}

/* Fix for mobile measurement inputs overflow */
.measurements-section {
    width: 100%;
    box-sizing: border-box;
    overflow: hidden; /* Prevent any overflow */
}

.measurements-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
    width: 100%;
    box-sizing: border-box;
}

.measurement-item {
    display: flex;
    flex-direction: column;
    gap: 3px;
    width: 100%;
    min-width: 0; /* Critical: allows grid items to shrink below their content size */
}

.measurement-item input {
    width: 100%;
    box-sizing: border-box; /* Include padding and border in width calculation */
    padding: 8px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: var(--radius-sm);
    color: var(--primary-white);
    font-size: 14px;
    min-width: 0; /* Allow inputs to shrink */
}

/* Mobile-specific adjustments */
@media (max-width: 768px) {
    .progress-container {
        padding: 10px;
        width: 100%;
        box-sizing: border-box;
        overflow-x: hidden;
    }
    
    .measurements-section {
        padding: 12px;
        width: 100%;
        box-sizing: border-box;
    }
    
    .measurements-grid {
        gap: 8px; /* Slightly smaller gap on mobile */
    }
    
    .measurement-item input {
        padding: 8px 6px; /* Slightly less horizontal padding on mobile */
        font-size: 14px;
    }
}

/* Extra small screens */
@media (max-width: 480px) {
    .measurements-grid {
        gap: 6px; /* Even smaller gap for very small screens */
    }
    
    .measurement-item label {
        font-size: 10px; /* Slightly smaller labels */
    }
    
    .measurement-item input {
        padding: 6px 4px; /* Minimal padding for tiny screens */
        font-size: 13px;
    }
}

/* Ensure the entire progress tab doesn't cause horizontal scroll */
#progress-tab {
    width: 100%;
    overflow-x: hidden;
    box-sizing: border-box;
}

/* Fix potential table overflow as well */
.measurements-table {
    width: 100%;
    table-layout: auto; /* Let table adjust naturally */
    box-sizing: border-box;
}

@media (max-width: 480px) {
    .measurements-table {
        font-size: 10px;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch; /* Smooth scrolling on iOS */
    }

    .measurements-table th,
    .measurements-table td {
        padding: 4px 3px; /* Tighter padding on mobile */
        white-space: nowrap;
    }
}


/* ===============================================
   CALORIE TRACKER STYLES
   =============================================== */

.calorie-tabs {
    background: rgba(10, 10, 10, 0.5);
    padding: 10px;
    display: flex;
    gap: 10px;
    overflow-x: auto;
    box-shadow: var(--shadow-md);
}

.calorie-tab {
    padding: 12px 20px;
    background: rgba(255, 255, 255, 0.05);
    border: 2px solid transparent;
    border-radius: var(--radius-md);
    color: rgba(255, 255, 255, 0.6);
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition-normal);
    display: flex;
    align-items: center;
    gap: 8px;
    white-space: nowrap;
    flex-shrink: 0;
}

.calorie-tab:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--primary-white);
}

.calorie-tab.active {
    background: var(--gradient-ocean);
    color: var(--primary-white);
    border-color: var(--light-blue);
    box-shadow: var(--shadow-md);
}

.calorie-content {
    padding: 20px;
    max-width: 1400px;
    margin: 0 auto;
}

.calorie-tab-content {
    display: none;
}

.calorie-tab-content.active {
    display: block;
    animation: fadeIn 0.3s ease;
}

/* Calorie Dashboard Styles */
.calorie-dashboard {
    display: flex;
    flex-direction: column;
    gap: 30px;
}

.today-summary h2 {
    color: var(--gold);
    margin-bottom: 20px;
    font-size: 24px;
}

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

.summary-card {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: var(--radius-lg);
    padding: 20px;
    transition: var(--transition-normal);
}

.summary-card:hover {
    background: rgba(255, 255, 255, 0.08);
    transform: translateY(-2px);
}

.summary-icon {
    font-size: 30px;
    margin-bottom: 10px;
    color: var(--gold);
}

.summary-icon.protein { color: #EF4444; }
.summary-icon.carbs { color: #3B82F6; }
.summary-icon.fats { color: #F59E0B; }
.summary-icon.sugar { color: #EC4899; }

.summary-info {
    margin-bottom: 15px;
}

.summary-value {
    font-size: 28px;
    font-weight: 700;
    color: var(--primary-white);
}

.summary-label {
    color: rgba(255, 255, 255, 0.7);
    text-transform: uppercase;
    font-size: 12px;
    letter-spacing: 1px;
}

.summary-goal {
    font-size: 14px;
    color: rgba(255, 255, 255, 0.5);
    margin-top: 5px;
}

/* Display the remaining amount (goal minus consumed) below each goal */
.summary-remaining {
  font-size: 13px;
  color: var(--light-blue); /* you can pick any accent color */
  margin-top: 2px;
}

.summary-progress {
    margin-top: 10px;
}

.progress-bar {
    height: 8px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: var(--radius-full);
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: var(--gradient-gold);
    transition: width 0.5s ease;
    border-radius: var(--radius-full);
}

.progress-fill.protein-fill { background: linear-gradient(90deg, #EF4444, #DC2626); }
.progress-fill.carbs-fill { background: linear-gradient(90deg, #3B82F6, #2563EB); }
.progress-fill.fats-fill { background: linear-gradient(90deg, #F59E0B, #D97706); }
.progress-fill.sugar-fill { background: linear-gradient(90deg, #EC4899, #DB2777); }

/* Today's Meals */
.todays-meals {
    background: rgba(255, 255, 255, 0.05);
    border-radius: var(--radius-lg);
    padding: 20px;
}

.todays-meals h3 {
    color: var(--gold);
    margin-bottom: 15px;
}

.meal-section {
    margin-bottom: 20px;
}

.meal-type-header {
    color: var(--light-blue);
    font-size: 16px;
    margin-bottom: 10px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.meal-item {
    background: rgba(0, 0, 0, 0.3);
    border-radius: var(--radius-md);
    padding: 15px;
    margin-bottom: 10px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: var(--transition-normal);
}

.meal-item:hover {
    background: rgba(0, 0, 0, 0.5);
}

.meal-name {
    font-weight: 600;
    color: var(--primary-white);
    margin-bottom: 5px;
}

.meal-nutrition {
    font-size: 12px;
    color: rgba(255, 255, 255, 0.6);
}

.meal-delete {
    background: rgba(220, 38, 38, 0.2);
    border: none;
    color: var(--primary-red);
    padding: 8px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: var(--transition-normal);
}

.meal-delete:hover {
    background: var(--primary-red);
    color: var(--primary-white);
}

.no-meals {
    color: rgba(255, 255, 255, 0.5);
    text-align: center;
    padding: 20px;
}

/* Dashboard Weight Section */
.dashboard-weight-section {
    background: rgba(255, 255, 255, 0.05);
    border-radius: var(--radius-lg);
    padding: 20px;
}

.dashboard-weight-section h3 {
    color: var(--gold);
    margin-bottom: 15px;
}

.weight-quick-add {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
}

.weight-quick-add input {
    flex: 1;
    padding: 10px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: var(--radius-md);
    color: var(--primary-white);
}
/* Provide a minimum width so the edit/delete column doesn't wrap on mobile */
.dashboard-weight-table .measurements-table {
    min-width: 320px;
}

/* Add Food Form Styles */
.add-food-container {
    max-width: 800px;
    margin: 0 auto;
}

.add-food-container h2 {
    color: var(--gold);
    margin-bottom: 25px;
    text-align: center;
}

.food-entry-form {
    background: rgba(255, 255, 255, 0.05);
    border-radius: var(--radius-lg);
    padding: 25px;
}

.food-photo-section {
    margin-bottom: 25px;
}

.food-photo-section label {
    display: block;
    margin-bottom: 10px;
    color: var(--gold);
}

.food-photo-preview {
    width: 200px;
    height: 200px;
    background: rgba(0, 0, 0, 0.3);
    border: 2px dashed rgba(255, 255, 255, 0.3);
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: var(--transition-normal);
    margin: 0 auto;
}

.food-photo-preview:hover {
    border-color: var(--gold);
    background: rgba(255, 255, 255, 0.05);
}

.food-details-section,
.nutrition-section {
    margin-bottom: 25px;
}

.food-input-group {
    margin-bottom: 15px;
}

.food-input-group label {
    display: block;
    margin-bottom: 5px;
    color: rgba(255, 255, 255, 0.7);
    font-size: 14px;
}

.food-input-group input,
.food-input-group select,
.food-input-group textarea {
    width: 100%;
    padding: 10px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: var(--radius-md);
    color: var(--primary-white);
}

.nutrition-section h3 {
    color: var(--light-blue);
    margin-bottom: 15px;
}

.nutrition-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 15px;
}

.nutrition-input label {
    display: block;
    margin-bottom: 5px;
    color: rgba(255, 255, 255, 0.7);
    font-size: 12px;
}

.nutrition-input input {
    width: 100%;
    padding: 8px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: var(--radius-sm);
    color: var(--primary-white);
}

.food-actions {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.save-to-catalog {
    display: flex;
    align-items: center;
    gap: 10px;
    color: rgba(255, 255, 255, 0.7);
    cursor: pointer;
}

.add-food-btn,
.clear-form-btn {
    padding: 12px 20px;
    border: none;
    border-radius: var(--radius-md);
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition-normal);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.add-food-btn {
    background: var(--gradient-ocean);
    color: var(--primary-white);
}

.clear-form-btn {
    background: rgba(255, 255, 255, 0.1);
    color: rgba(255, 255, 255, 0.7);
}

/* Food Catalog Styles */
.catalog-container {
    max-width: 1200px;
    margin: 0 auto;
}

.catalog-container h2 {
    color: var(--gold);
    margin-bottom: 20px;
    text-align: center;
}

.catalog-search {
    position: relative;
    max-width: 500px;
    margin: 0 auto 30px;
}

.catalog-search input {
    width: 100%;
    padding: 12px 45px 12px 15px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: var(--radius-full);
    color: var(--primary-white);
}

.catalog-search i {
    position: absolute;
    right: 15px;
    top: 50%;
    transform: translateY(-50%);
    color: rgba(255, 255, 255, 0.5);
}

.food-catalog-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 20px;
}

.catalog-food-card {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: var(--radius-lg);
    padding: 20px;
    transition: var(--transition-normal);
}

.catalog-food-card:hover {
    background: rgba(255, 255, 255, 0.08);
    transform: translateY(-2px);
}

.catalog-food-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.catalog-food-header h4 {
    color: var(--primary-white);
    font-size: 18px;
}

.favorite-btn {
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.3);
    font-size: 20px;
    cursor: pointer;
    transition: var(--transition-normal);
}

.favorite-btn.favorited {
    color: var(--gold);
}

.catalog-food-nutrition {
    display: flex;
    gap: 15px;
    margin-bottom: 15px;
    font-size: 12px;
    color: rgba(255, 255, 255, 0.6);
}

.catalog-food-actions {
    display: flex;
    gap: 10px;
}

.quick-add-btn,
.delete-catalog-btn {
    flex: 1;
    padding: 8px;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 12px;
    cursor: pointer;
    transition: var(--transition-normal);
}

.quick-add-btn {
    background: var(--gradient-ocean);
    color: var(--primary-white);
}

.delete-catalog-btn {
    background: rgba(220, 38, 38, 0.2);
    color: var(--primary-red);
}

/* History Styles */
.history-container {
    max-width: 900px;
    margin: 0 auto;
}

.history-container h2 {
    color: var(--gold);
    margin-bottom: 20px;
    text-align: center;
}

.history-navigation {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 20px;
    margin-bottom: 30px;
}

.history-nav-btn {
    background: rgba(255, 255, 255, 0.1);
    border: none;
    color: var(--primary-white);
    padding: 10px 15px;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: var(--transition-normal);
}

.history-nav-btn:hover {
    background: rgba(255, 255, 255, 0.2);
}

.history-current-date {
    font-size: 18px;
    font-weight: 600;
    color: var(--primary-white);
}

.history-meals-list {
    background: rgba(255, 255, 255, 0.05);
    border-radius: var(--radius-lg);
    padding: 20px;
    margin-bottom: 20px;
}

.history-meal-section {
    margin-bottom: 25px;
}

.history-meal-section h4 {
    color: var(--light-blue);
    margin-bottom: 15px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.history-meal-item {
    background: rgba(0, 0, 0, 0.3);
    border-radius: var(--radius-md);
    padding: 12px;
    margin-bottom: 10px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.meal-details {
    font-size: 12px;
    color: rgba(255, 255, 255, 0.6);
}

.edit-meal-btn,
.delete-meal-btn {
    padding: 6px 10px;
    border: none;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: var(--transition-normal);
}

.edit-meal-btn {
    background: rgba(59, 130, 246, 0.2);
    color: var(--light-blue);
    margin-right: 5px;
}

.delete-meal-btn {
    background: rgba(220, 38, 38, 0.2);
    color: var(--primary-red);
}

.history-summary {
    background: rgba(255, 255, 255, 0.05);
    border-radius: var(--radius-lg);
    padding: 20px;
}

.history-summary h4 {
    color: var(--gold);
    margin-bottom: 15px;
}

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

.summary-stat {
    display: flex;
    justify-content: space-between;
}

.stat-label {
    color: rgba(255, 255, 255, 0.6);
}

.stat-value {
    font-weight: 600;
    color: var(--primary-white);
}

/* Goals Form Styles */
.goals-container {
    max-width: 600px;
    margin: 0 auto;
}

.goals-container h2 {
    color: var(--gold);
    margin-bottom: 25px;
    text-align: center;
}

.goals-form {
    background: rgba(255, 255, 255, 0.05);
    border-radius: var(--radius-lg);
    padding: 25px;
}

.goal-input-group {
    margin-bottom: 20px;
}

.goal-input-group label {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 8px;
    color: rgba(255, 255, 255, 0.8);
}

.goal-input-group input {
    width: 100%;
    padding: 12px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: var(--radius-md);
    color: var(--primary-white);
    font-size: 16px;
}

.save-goals-btn {
    width: 100%;
    padding: 15px;
    background: var(--gradient-ocean);
    border: none;
    border-radius: var(--radius-md);
    color: var(--primary-white);
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition-normal);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.save-goals-btn:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

/* Mobile Responsive for Calorie Tracker */
@media (max-width: 768px) {
    .calorie-tabs {
        flex-wrap: nowrap;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    
    .calorie-tab {
        min-width: 100px;
    }
    
    .calorie-summary-cards {
        grid-template-columns: 1fr;
    }
    
    .nutrition-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .food-catalog-list {
        grid-template-columns: 1fr;
    }
    
    .meal-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }
    
    .catalog-food-actions {
        flex-direction: column;
    }
    
    .weight-quick-add {
        flex-direction: column;
    }
    
    .summary-stats {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 480px) {
    .calorie-content {
        padding: 10px;
    }
    
    .food-photo-preview {
        width: 150px;
        height: 150px;
    }
    
    .nutrition-grid {
        grid-template-columns: 1fr;
    }
    
    .history-navigation {
        gap: 10px;
    }
    
    .history-current-date {
        font-size: 14px;
    }
}

.no-foods {
    text-align: center;
    color: rgba(255, 255, 255, 0.5);
    padding: 40px;
}

.save-edit-btn {
    width: 100%;
    padding: 12px;
    background: var(--gradient-ocean);
    border: none;
    border-radius: var(--radius-md);
    color: var(--primary-white);
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition-normal);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    margin-top: 20px;
}

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

.meal-type-selection h3 {
    color: var(--gold);
    margin-bottom: 15px;
    text-align: center;
}

.meal-type-buttons {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
}

.meal-type-btn {
    padding: 20px;
    background: rgba(255, 255, 255, 0.05);
    border: 2px solid rgba(255, 255, 255, 0.1);
    border-radius: var(--radius-md);
    color: var(--primary-white);
    cursor: pointer;
    transition: var(--transition-normal);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

.meal-type-btn i {
    font-size: 24px;
    color: var(--gold);
}

.meal-type-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: var(--gold);
    transform: translateY(-2px);
}

.meal-type-btn:active {
    transform: translateY(0);
}

@media (max-width: 480px) {
    .meal-type-buttons {
        grid-template-columns: 1fr;
    }
}

/* Weight History Section styles. */
.weight-history-section {
    margin-top: 20px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: var(--radius-lg);
    padding: 20px;
    overflow-x: auto; /* allow horizontal scroll if needed */
}

/* Responsive tweaks for weight-history table */
@media (max-width: 480px) {
    .weight-history-section .weight-history-table th,
    .weight-history-section .weight-history-table td {
        font-size: 12px;
        padding: 6px 4px;
        white-space: nowrap; /* keep content on one line */
    }
    .weight-history-section .weight-actions {
        gap: 4px;
    }
    .weight-history-section .weight-actions button {
        padding: 3px 4px;
        font-size: 12px;
    }
}

/* Style the heading within the weight history section */
.weight-history-section h3 {
    color: var(--gold);
    margin-bottom: 15px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.weight-history-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 10px;
}

.weight-history-table thead {
    background: rgba(255, 255, 255, 0.05);
}

.weight-history-table th {
    padding: 10px;
    text-align: left;
    color: var(--gold);
    font-size: 14px;
    text-transform: uppercase;
    letter-spacing: 1px;
    border-bottom: 2px solid rgba(255, 255, 255, 0.1);
}

.weight-history-table td {
    padding: 8px 10px;
    color: var(--primary-white);
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.weight-history-table tbody tr:hover {
    background: rgba(255, 255, 255, 0.03);
}

.weight-value {
    font-weight: 600;
    font-size: 16px;
}

.weight-actions {
    display: flex;
    gap: 5px;
}

.weight-edit-btn,
.weight-delete-btn {
    background: rgba(255, 255, 255, 0.1);
    border: none;
    color: var(--primary-white);
    padding: 5px 8px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: var(--transition-normal);
    font-size: 12px;
}
/* Reduce button size on small screens */
@media (max-width: 480px) {
    .weight-edit-btn,
    .weight-delete-btn {
        padding: 3px 4px;
        font-size: 10px;
    }
}

.weight-edit-btn:hover {
    background: var(--light-blue);
    color: var(--primary-white);
}

.weight-delete-btn:hover {
    background: var(--primary-red);
    color: var(--primary-white);
}

/* Responsive table */
@media (max-width: 480px) {
    .weight-history-table {
        font-size: 12px;
    }
    
    .weight-history-table th,
    .weight-history-table td {
        padding: 6px 5px;
    }
    
    .weight-value {
        font-size: 14px;
    }
}

/* Fix dashboard weight chart height */
#dashboard-weight-chart {
    max-height: 300px;
    margin-top: 15px;
    margin-bottom: 15px;
}

/* Workout weight card styling (matches calorie cards) */
.weight-section {
    background: rgba(255, 255, 255, 0.05);
    border-radius: var(--radius-lg);
    padding: 20px;
    /* remove the border */
}

/* Reduce padding on very small screens */
@media (max-width: 480px) {
    .weight-section {
        padding: 15px;
    }
}

/* ===============================================
   LOCAL PROGRESS PHOTOS STYLES
   Defines the grid and card layout for progress photos saved
   locally on the device. Cards display a square preview with a
   dark overlay showing the date and action icons for download
   and deletion. A status message appears beneath the add button
   to indicate when a photo has been saved. Adjust the grid on
   small screens to ensure photos remain visible and easy to tap.
*/
.local-pp-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    gap: 8px;
    margin-top: 12px;
}

.local-pp-grid .pp-card {
    position: relative;
    aspect-ratio: 1;
    border-radius: var(--radius-sm);
    overflow: hidden;
    cursor: default;
}

.local-pp-grid .pp-card img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.local-pp-grid .pp-card .pp-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: rgba(0, 0, 0, 0.7);
    color: var(--primary-white);
    font-size: 10px;
    padding: 4px 6px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.local-pp-grid .pp-card .pp-overlay .actions {
    display: flex;
    gap: 6px;
}

.local-pp-grid .pp-card .pp-overlay .actions button {
    background: none;
    border: none;
    color: var(--primary-white);
    cursor: pointer;
    padding: 0;
}

.local-pp-grid .pp-card .pp-overlay .actions button:hover {
    color: var(--light-red);
}

/* Status message displayed after saving a photo locally */
.photo-status {
    display: block;
    margin-top: 8px;
    font-size: 12px;
    color: var(--primary-white);
}

/* Meal and catalog thumbnails: small square image previews */
.meal-thumb,
.catalog-photo {
    width: 40px;
    height: 40px;
    object-fit: cover;
    border-radius: var(--radius-sm);
    margin-right: 8px;
}
