/* Import Google Fonts at the top of the file */
@import url('https://fonts.googleapis.com/css2?family=Oswald:wght@500;700&family=Roboto:wght@400;700&display=swap');

/* Basic styles for the fitness app */
body {
    font-family: 'Roboto', sans-serif;
    background-color: #f4f7f6;
    margin: 0;
    padding: 20px;
    color: #333;
    -webkit-tap-highlight-color: transparent;
}

.app-container {
    max-width: 700px;
    margin: 0 auto;
    background-color: transparent;
    padding: 0;
}

/* Logo Styling */
.app-logo {
    display: block;
    max-width: 250px;
    margin: 0 auto 30px auto;
}

/* Section Headings */
h2, h3 {
    font-family: 'Oswald', sans-serif;
    font-weight: 500;
    text-align: left;
    margin-top: 20px;
    margin-bottom: 15px;
    color: #34495e;
}

h2 {
    font-size: 24px;
}

h3 {
    font-size: 20px;
    margin-top: 30px;
}


/* Quote box styling */
.quote-box {
    position: relative;
    text-align: center;
    padding: 25px 40px;
    margin-bottom: 30px;
    background: linear-gradient(135deg, #6dd5ed, #2193b0);
    border-radius: 12px;
    font-size: 18px;
    font-weight: 700;
    color: #ffffff;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    display: none; /* Initially hidden */
}
.quote-box p { margin: 0; }

/* Tabs navigation */
.tabs {
    display: flex;
    margin-bottom: 20px;
    background-color: #ffffff;
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    overflow: hidden;
}

.tab-button {
    font-family: 'Oswald', sans-serif;
    flex: 1;
    padding: 15px 10px;
    background: transparent;
    border: none;
    border-bottom: 3px solid transparent;
    cursor: pointer;
    font-size: 18px;
    color: #86909a;
    outline: none;
    transition: all 0.3s ease;
}

/* Add margin to the right of tab icons */
.tab-button i {
    margin-right: 8px;
    vertical-align: middle;
    position: relative;
    top: -1px;
}

.tab-button.active {
    color: #2193b0;
    background-color: #f8f9fa;
    border-bottom: 3px solid #2193b0;
}

/* Tab content panels */
.tab-content.active { display: block; }
.tab-content { display: none; }

/* List styling */
ul {
    list-style: none;
    padding-left: 0;
}

li {
    background-color: #ffffff;
    border-radius: 12px;
    margin-bottom: 15px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    overflow: hidden;
    transition: box-shadow 0.3s ease;
}

li:hover {
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.1);
}

/* Styles for expandable details */
.exercise-header {
    display: flex;
    align-items: center;
    cursor: pointer;
    padding: 18px 20px;
    gap: 15px;
    min-height: 60px;
}

.exercise-thumbnail {
    width: 40px;
    height: 40px;
    border-radius: 8px;
    object-fit: cover;
    flex-shrink: 0;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
}

.exercise-info {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.exercise-name {
    font-family: 'Oswald', sans-serif;
    font-weight: 500;
    font-size: 18px;
    color: #2c3e50;
    line-height: 1.2;
}

.exercise-reps {
    font-size: 14px;
    color: #7f8c8d;
    font-weight: 500;
}

.expand-icon {
    font-size: 20px;
    font-weight: bold;
    color: #2193b0;
    transition: transform 0.3s ease;
    flex-shrink: 0;
    padding: 8px;
    margin: -8px;
}

/* Rotating the icon when expanded */
.exercise-header.expanded .expand-icon {
    transform: rotate(90deg);
}

.details {
    padding: 0 20px;
    font-size: 15px;
    color: #555;
    border-top: 1px solid #f0f0f0;
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease-out, padding 0.3s ease-out;
}

/* New rule to add padding only when expanded */
.exercise-header.expanded + .details {
    padding-top: 10px;
    padding-bottom: 15px;
}

.details p {
    margin: 0 0 10px;
}

/* Styling for a single exercise photo */
.exercise-photo {
    width: 100%;
    max-width: 300px;
    height: auto;
    display: block;
    margin: 15px auto 0;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

/* Styling for a grid of multiple exercise photos */
.exercise-images {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 10px;
    margin-top: 15px;
}

.exercise-images img {
    width: 100%;
    max-width: 300px; /* This now matches the single photo size */
    height: auto;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

/* --- Styles for Fullscreen Image Viewer --- */
.exercise-photo, .exercise-images img {
    cursor: zoom-in;
    transition: transform 0.2s ease;
}
.exercise-photo:hover, .exercise-images img:hover {
    transform: scale(1.03);
}
.fullscreen-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.85);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    cursor: zoom-out;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}
.fullscreen-overlay.active {
    opacity: 1;
    visibility: visible;
}
.fullscreen-overlay img {
    max-width: 90%;
    max-height: 90%;
    object-fit: contain;
    border-radius: 8px;
    box-shadow: 0 0 30px rgba(0,0,0,0.5);
    transform: scale(0.8);
    transition: transform 0.3s ease;
}
.fullscreen-overlay.active img {
    transform: scale(1);
}

/* --- STYLES FOR NUTRITION TAB --- */
.nutrition-header {
    background: linear-gradient(135deg, #6dd5ed, #2193b0);
    color: white;
    padding: 25px 20px;
    border-radius: 12px;
    margin-bottom: 30px;
}
.nutrition-header h2 {
    color: white;
    margin-top: 0;
    margin-bottom: 10px;
}
.nutrition-header p {
    margin-bottom: 0;
    font-size: 16px;
    line-height: 1.5;
}
.heuristics-container {
    display: grid;
    gap: 15px;
}
.heuristic-card {
    display: flex;
    align-items: center;
    background-color: #ffffff;
    padding: 15px;
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.08);
}
.heuristic-icon {
    font-size: 24px;
    color: #2193b0;
    margin-right: 15px;
    width: 30px;
    text-align: center;
}
.heuristic-text {
    flex: 1;
    font-size: 16px;
    line-height: 1.5;
}
.macro-stats {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin: 0;
    padding: 0;
}
.stat {
    text-align: center;
    padding: 24px 16px;
    background: #fafbfc;
    border-radius: 16px;
    border: 1px solid rgba(0, 0, 0, 0.06);
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}
.stat::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: var(--stat-color);
    opacity: 0;
    transition: opacity 0.3s ease;
}
.stat:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 25px rgba(0, 0, 0, 0.08);
    background: #ffffff;
    border-color: rgba(0, 0, 0, 0.12);
}
.stat:hover::before {
    opacity: 1;
}
.stat:nth-child(1) { --stat-color: #e74c3c; } /* Calories - Red */
.stat:nth-child(2) { --stat-color: #2193b0; } /* Protein - Blue */
.stat:nth-child(3) { --stat-color: #f39c12; } /* Carbs - Orange */
.stat:nth-child(4) { --stat-color: #27ae60; } /* Fat - Green */
.stat-value {
    display: block;
    font-size: 32px;
    font-weight: 800;
    color: #2c3e50;
    font-family: 'Oswald', sans-serif;
    margin-bottom: 6px;
    line-height: 1;
}
.stat-label {
    display: block;
    font-size: 13px;
    color: #7f8c8d;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.8px;
}
#nutrition ul {
    list-style: none;
    padding-left: 0;
}
#nutrition h3 {
    margin-top: 40px;
    padding-bottom: 5px;
    border-bottom: 2px solid #e0e0e0;
}
.disclaimer {
    font-size: 12px;
    font-style: italic;
    color: #777;
    margin: 30px 20px 10px;
    padding: 15px;
    background-color: #f8f9fa;
    border-radius: 8px;
    line-height: 1.6;
}

/* --- NEW CALCULATOR & THUMBNAIL STYLES --- */
.calculator-container {
    margin-bottom: 15px;
    overflow: hidden;
    padding-top: 15px;
}
.form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}
.form-group {
    display: flex;
    flex-direction: column;
}
.form-group label {
    font-size: 14px;
    font-weight: 700;
    color: #34495e;
    margin-bottom: 8px;
}
.form-group input,
.form-group select {
    width: 100%;
    padding: 12px;
    border: 2px solid #e9ecef;
    border-radius: 8px;
    font-size: 16px;
    font-family: 'Roboto', sans-serif;
    background-color: #f8f9fa;
    transition: border-color 0.3s, box-shadow 0.3s;
    box-sizing: border-box;
}
.form-group input:focus,
.form-group select:focus {
    outline: none;
    border-color: #2193b0;
    box-shadow: 0 0 0 3px rgba(33, 147, 176, 0.15);
}
.calculate-btn {
    font-family: 'Oswald', sans-serif;
    width: 100%;
    padding: 15px;
    margin-top: 25px;
    background: linear-gradient(135deg, #6dd5ed, #2193b0);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 18px;
    font-weight: 700;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}
.calculate-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(33, 147, 176, 0.3);
}
.results-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(8px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    cursor: pointer;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}
.results-container.visible {
    opacity: 1;
    visibility: visible;
}
.results-card {
    background: #ffffff;
    border-radius: 20px;
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.15);
    padding: 0;
    width: 90%;
    max-width: 520px;
    cursor: default;
    transform: scale(0.8);
    transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
    border: 1px solid rgba(0, 0, 0, 0.08);
    overflow: hidden;
}
.results-container.visible .results-card {
    transform: scale(1);
}
.results-card-header {
    background: linear-gradient(135deg, #f8fbff, #f1f8ff);
    padding: 25px 30px 20px 30px;
    border-bottom: 1px solid rgba(33, 147, 176, 0.1);
    position: relative;
}
.results-card-header::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(135deg, #6dd5ed, #2193b0);
}
.results-card h3 {
    text-align: center;
    border-bottom: none;
    margin: 0;
    color: #2c3e50;
    font-size: 24px;
    font-weight: 700;
    position: relative;
}
.results-card-body {
    padding: 30px;
}

.food-thumbnail {
    width: 50px;
    height: 50px;
    border-radius: 8px;
    object-fit: cover;
    margin-right: 15px;
    flex-shrink: 0;
}

/* --- TOOLTIP STYLES (JavaScript-controlled) --- */
.tooltip-trigger {
    background: none;
    border: none;
    color: #2193b0;
    cursor: help;
    font-size: 16px;
    padding: 4px;
    margin-left: 8px;
    border-radius: 50%;
    transition: all 0.3s ease;
    vertical-align: middle;
    position: relative;
    top: -1px;
}

.tooltip-trigger:hover {
    background-color: rgba(33, 147, 176, 0.1);
    transform: scale(1.1);
}

.tooltip-trigger:focus {
    outline: 2px solid #2193b0;
    outline-offset: 2px;
}

.tooltip {
    position: absolute;
    background: linear-gradient(135deg, #2c3e50, #34495e);
    color: white;
    padding: 0;
    border-radius: 12px;
    font-size: 14px;
    line-height: 1.5;
    width: 320px;
    max-width: 90vw;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.3);
    z-index: 2000;
    display: none;
    opacity: 0;
    transform: translateY(-10px);
    transition: all 0.2s ease;
}

.tooltip.visible {
    opacity: 1;
    transform: translateY(0);
}

.tooltip::before {
    content: '';
    position: absolute;
    top: -8px;
    left: 50%;
    transform: translateX(-50%);
    border: 8px solid transparent;
    border-bottom-color: #2c3e50;
}

.tooltip.tooltip-below::before {
    top: auto;
    bottom: -8px;
    border-bottom-color: transparent;
    border-top-color: #2c3e50;
}

.tooltip-header {
    padding: 16px 20px 0 20px;
}

.tooltip-header h4 {
    margin: 0;
    font-family: 'Oswald', sans-serif;
    font-size: 16px;
    color: #6dd5ed;
    font-weight: 500;
}

.tooltip-body {
    padding: 8px 20px 16px 20px;
}

.tooltip-body p {
    margin: 0 0 12px 0;
}

.tooltip-body p:last-child {
    margin-bottom: 0;
}

.tooltip-body ul {
    margin: 8px 0 12px 20px;
    padding: 0;
    list-style: disc;
}

.tooltip-body li {
    margin: 4px 0;
    padding: 0;
    background: none;
    box-shadow: none;
    border-radius: 0;
    font-size: 14px;
    line-height: 1.4;
}

.tooltip-body strong {
    color: #6dd5ed;
}

/* --- Mobile Optimization (Consolidated) --- */
@media (max-width: 600px) {
    body {
        padding: 10px;
    }
    .app-logo {
        max-width: 200px;
        margin-bottom: 25px;
    }
    .quote-box {
        padding: 20px 25px;
        font-size: 16px;
    }
    .tabs {
        flex-direction: column;
        border-radius: 12px;
    }
    .tab-button {
        border-bottom: 1px solid #eee;
    }
    .tab-button.active {
        border-bottom: 1px solid #eee;
        border-left: 4px solid #2193b0;
    }
    li {
        font-size: 15px;
    }
    .form-grid {
        grid-template-columns: 1fr;
    }
    .macro-stats {
        grid-template-columns: 1fr 1fr;
        gap: 12px;
    }
    .stat {
        padding: 20px 12px;
    }
    .stat-value {
        font-size: 28px;
    }
    .stat-label {
        font-size: 12px;
        letter-spacing: 0.6px;
    }
    .results-card {
        max-width: 380px;
        border-radius: 16px;
    }
    .results-card-header {
        padding: 20px 25px 15px 25px;
    }
    .results-card h3 {
        font-size: 20px;
    }
    .results-card-body {
        padding: 25px 20px;
    }
    
    /* Mobile exercise layout adjustments */
    .exercise-header {
        padding: 16px 18px;
        gap: 12px;
        min-height: 56px;
    }
    
    .exercise-thumbnail {
        width: 36px;
        height: 36px;
    }
    
    .exercise-name {
        font-size: 17px;
    }
    
    .exercise-reps {
        font-size: 13px;
    }
    
    .expand-icon {
        font-size: 18px;
        padding: 10px;
        margin: -10px;
    }
    
    /* Mobile tooltip adjustments */
    .tooltip {
        width: 280px;
        font-size: 13px;
    }
    
    .tooltip-header {
        padding: 14px 16px 0 16px;
    }
    
    .tooltip-body {
        padding: 6px 16px 14px 16px;
    }
    
    .tooltip-body ul {
        margin-left: 16px;
    }
}
