/*
 * TrainShift Application Stylesheet
 *
 * This file contains all CSS rules for the TrainShift web application.
 * Styles are organized into sections for better maintainability.
 */

/* ==========================================================================
   1. Base & Utility Styles
   ========================================================================== */

/* Universal Box-Sizing */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

/* Body Typography and Background */
body {
    font-family: 'Poppins', sans-serif;
    line-height: 1.6;
    background-color: #ffffff; /* Clean white background */
    color: #333; /* Default text color */
    margin-bottom: 20px; /* Space at the bottom of the page */
}

/* Headings (H2, H3) - Global Style */
h2, h3 {
    font-family: 'Poppins', sans-serif;
    color: #007bff; /* Bright blue for main headings */
    margin-bottom: 15px;
}

/* Horizontal Rule (Divider) */
hr {
    margin-bottom: 20px;
    margin-top: 20px;
}

/* Paragraphs */
p {
    margin-bottom: 0px; /* Remove default bottom margin to control spacing with specific elements */
}

/* Font Awesome Icon Alignment within text/tables */
.activity-icon {
    margin-right: 8px; /* Space between icon and text */
    color: #007bff; /* Consistent blue for icons */
    width: 20px; /* Fixed width for alignment */
    text-align: center;
}

/* ==========================================================================
   2. Layout Containers
   ========================================================================== */

/* Common Section Styling (for Home Page sections or general content blocks) */
.common {
    text-align: center; /* Center content within these blocks */
    max-width: 1200px;
    margin: auto;
    padding: 40px 20px;
    background-color: white;
    margin-bottom: 20px;
}

.common h1 {
    margin-bottom: 20px;
    margin-top: 20px;
    color: #007bff;
}

.common p {
    margin-top: 0;
}

/* Main Content Container (used on most pages) */
.container {
    max-width: 1200px;
    margin: auto; /* Center the container horizontally */
    text-align: left; /* Default text alignment within container */
    padding: 40px 50px; /* Internal padding for content */
    background-color: white;
    margin-bottom: 20px; /* Space below the container */
    border-radius: 8px; /* Slightly rounded corners */
    box-shadow: 0 4px 8px rgba(0,0,0,0.1); /* Subtle shadow for depth */
}

.container h1 {
    font-size: 2.5rem;
    color: #003366; /* Dark blue for container H1 */
    margin: 0;
}

.container h2 {
    margin-bottom: 10px;
    color: #007bff; /* Bright blue for container H2 */
}

/* ==========================================================================
   3. Header & Navigation
   ========================================================================== */

/* Header Section */
header {
    background-color: #e0f7fa; /* Light blue background */
    min-height: 160px; /* Ensures space for logo and text */
    padding: 20px 20px;
    text-align: center;
    position: relative; /* Needed for absolute positioning of child elements */
}

header .logo {
    position: absolute;
    top: 20px;
    left: 20px;
    width: 120px;
    height: 120px;
    border-radius: 0%; /* Square logo */
    object-fit: contain; /* Ensures entire logo is visible */
}

header .top-right-greeting {
    position: absolute;
    top: 10px;
    right: 20px;
    z-index: 10; /* Ensure it's above other elements */
    text-align: right;
    color: #003366; /* Dark blue for greeting text */
    font-weight: bold;
}

header h1 {
    font-size: 2.5rem;
    color: #003366;
    margin: 0;
}

header h3 {
    margin: 0;
    color: #007bff;
}

header p {
    font-size: 1.2rem;
    margin-top: 5px;
}

/* Navigation Bar */
nav {
    background-color: #003366; /* Dark blue for nav background */
    color: white;
    display: flex;
    justify-content: center; /* Center navigation links */
    padding: 10px 0;
}

nav a {
    margin: 0 15px;
    color: white;
    text-align: center;
    text-decoration: none;
    font-weight: bold;
    display: inline-block;
    padding: 5px 10px; /* Add padding for better hover area */
}

nav a:hover {
    background-color: #0056b3; /* Medium blue on hover */
    border-radius: 4px; /* Subtle rounded corners on hover */
}

nav .active { /* Class for the current active page link */
    background-color: #555;
    font-weight: bold;
    border-radius: 4px;
}

/* ==========================================================================
   4. Buttons & Forms (General)
   ========================================================================== */

/* Base style for all buttons and select inputs */
input, textarea, button, select {
    padding: 10px;
    font-size: 1rem;
    border: 1px solid #ccc; /* Default border for inputs/selects */
    border-radius: 4px; /* Default border radius */
}

/* General Button Style */
button {
    background-color: #003366; /* Dark blue default */
    color: white;
    border: none;
    cursor: pointer;
    transition: background-color 0.3s;
}

button:hover {
    background-color: #0056b3; /* Medium blue on hover */
}

/* Specific button classes */
.btn {
    text-decoration: none;
    padding: 8px 15px;
    border-radius: 5px;
    cursor: pointer;
    font-size: 1em;
    transition: background-color 0.3s ease;
    display: inline-block; /* Allows padding/margin and sits inline */
    text-align: center; /* Centers text within the button */
}

.btn-primary {
    background-color: #007bff;
    color: white;
    border: none;
}

.btn-primary:hover {
    background-color: #0056b3;
    color: white;
}

.btn-secondary {
    background-color: #6c757d;
    color: white;
    border: none;
}

.btn-secondary:hover {
    background-color: #5a6268;
    color: white;
}

.btn-danger {
    background-color: #dc3545;
    color: white;
    border: none;
}

.btn-danger:hover {
    background-color: #c82333;
    color: white;
}

/* Forms - General Layout */
form {
    max-width: 600px; /* Default max width for forms */
    margin-left: 0; /* Left-justify by default */
    margin-right: auto;
    display: flex;
    flex-direction: column;
    gap: 15px; /* Space between form elements */
}

/* Form Groups (label + input alignment) */
.form-group {
    display: flex;
    align-items: center; /* Vertically center label and input */
    margin-bottom: 15px;
}

.form-group label {
    flex-basis: 180px; /* Fixed width for labels for alignment */
    margin-right: 15px;
    text-align: left;
    font-weight: bold;
    color: #333;
}

.form-group input[type="text"],
.form-group input[type="number"],
.form-group input[type="email"],
.form-group input[type="password"],
.form-group input[type="date"],
.form-group select {
    flex-grow: 1; /* Allow input fields to take available space */
    max-width: 400px; /* Optional: limit overall width of inputs */
}

/* Custom styling for select dropdown arrow */
.form-group select {
    appearance: none; /* Remove default browser styling */
    background-image: url('data:image/svg+xml;charset=US-ASCII,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%22292.4%22%20height%3D%22292.4%22%3E%3Cpath%20fill%3D%22%23000000%22%20d%3D%22M287%2C197.8L151.7%2C62.5c-4.2-4.2-11-4.2-15.2%2C0L5.4%2C197.8c-4.2%2C4.2-4.2%2C11%2C0%2C15.2l7.6%2C7.6c4.2%2C4.2%2C11%2C4.2%2C15.2%2C0l115-115l115%2C115c4.2%2C4.2%2C11%2C4.2%2C15.2%2C0l7.6-7.6C291.2%2C208.8%2C291.2%2C202%2C287%2C197.8z%22%2F%3E%3C%2Fsvg%3E');
    background-repeat: no-repeat;
    background-position: right 10px top 50%;
    background-size: 12px;
}

/* Form Actions (for groups of buttons) */
.form-actions {
    display: flex;
    justify-content: space-between;
    gap: 15px;
    margin-top: 20px;
}

.form-actions button {
    flex-grow: 1; /* Make buttons expand to fill space */
    padding: 12px 20px;
    font-size: 1.1rem;
}

.form-actions .reset-button {
    background-color: #6c757d;
}

.form-actions .reset-button:hover {
    background-color: #5a6268;
}

/* Specific style for forms containing a single, centered button */
.center-form-button {
    margin-left: auto;
    margin-right: auto;
    max-width: 300px;
    display: block;
}

.center-form-button button {
    display: block;
    margin-left: auto;
    margin-right: auto;
}

/* Specific style for inline forms containing a single button, to prevent stacking */
.form-inline-button {
    display: inline-block; /* Makes the form behave like an inline element */
    margin: 0 auto; /* Centers the inline-block form within its parent text-align center */
    max-width: fit-content; /* Allows the form to shrink to its content's size */
}

.form-inline-button button {
    margin: 0; /* Remove any default margins that might interfere */
}

/* ==========================================================================
   5. Page Specific Styles
   ========================================================================== */

/* Dashboard Page Specific Styles */
.dashboard-section {
    margin-top: 25px;
    padding: 20px;
    background-color: #f8f8f8;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}
.dashboard-section h3 {
    color: #0056b3;
    margin-bottom: 15px;
}
.dashboard-section p {
    margin-bottom: 10px;
}

/* Strava Connection Buttons Group on Dashboard */
.strava-buttons-group {
    display: flex;
    justify-content: flex-start; /* Aligns items to the start (left) */
    gap: 15px; /* Space between forms/buttons */
    margin-top: 20px;
    margin-bottom: 20px;
    flex-wrap: wrap; /* Allows buttons to wrap on smaller screens */
}

.strava-buttons-group form {
    max-width: none; /* Override global form max-width */
    margin: 0; /* Override global form margin */
    display: block; /* Ensures flex item behavior */
    flex-direction: row; /* Ensure inner form content doesn't stack */
    gap: 0;
}

.strava-buttons-group form button {
    width: auto; /* Allow button to size to its content */
    margin: 0; /* Remove any internal button margins */
}

/* Home Page Call To Action Buttons */
.home-call-to-action {
    margin-top: 30px;
    display: flex;
    justify-content: center; /* Center the buttons horizontally */
    gap: 15px;
    flex-wrap: wrap;
}

.home-call-to-action .btn {
    padding: 10px 20px; /* Slightly larger padding for these main action buttons */
    font-weight: bold;
    border-radius: 5px;
}

.home-call-to-action .btn-primary {
    background-color: #00796b; /* Specific teal color for home page primary button */
    border-color: #00796b;
}

.home-call-to-action .btn-primary:hover {
    background-color: #005f56;
    border-color: #005f56;
}

/* Auth Pages (Login, Register, Password Reset) */
.login-container {
    max-width: 500px;
    margin: 20px auto; /* Center the container */
}

/* Activity Detail Page Styles - Specific to activity_detail.html using body class */
body.activity-detail-page .activity-details-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 15px;
    margin-top: 20px;
    padding: 20px;
    background-color: #f8f8f8;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}
body.activity-detail-page .activity-details-grid div {
    padding: 8px 0;
    border-bottom: 1px dashed #eee;
}
body.activity-detail-page .activity-details-grid div:last-child {
    border-bottom: none;
}
body.activity-detail-page .activity-details-grid strong {
    color: #212529;
}
body.activity-detail-page .activity-icon {
    margin-right: 8px;
    color: #007bff;
    width: 20px;
    text-align: center;
}

/* Zone distribution charts (Power and HR) for activity_detail.html */
body.activity-detail-page .zone-list-container,
body.activity-detail-page .power-curve-section-container {
    display: grid;
    grid-template-columns: 1fr;
    gap: 20px;
    margin-top: 20px;
}
@media (min-width: 768px) {
    body.activity-detail-page .zone-list-container,
    body.activity-detail-page .power-curve-section-container {
        grid-template-columns: 1fr 1fr;
    }
}
body.activity-detail-page .zone-column {
    background-color: #f8f8f8;
    padding: 15px;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}
body.activity-detail-page .chart-column-flex {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}
body.activity-detail-page .fixed-height-chart {
    position: relative;
    height: 200px; /* Specific height for these zone charts */
    width: 100%;
}
body.activity-detail-page .fixed-height-chart canvas {
    width: 100% !important;
    height: 100% !important;
}

/* Power curve list (side-by-side) for activity_detail.html */
body.activity-detail-page .power-curve-list-side-by-side {
    list-style: none;
    padding: 0;
    margin-top: 10px;
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
}
body.activity-detail-page .power-curve-list-side-by-side li {
    padding: 5px 0;
    border-bottom: 1px dashed #eee;
    display: flex;
    justify-content: space-between;
    align-items: center;
}
body.activity-detail-page .power-curve-list-side-by-side li:last-child {
    border-bottom: none;
}

/* Activity line graphs (Power/HR, Speed/Cadence, Elevation) - FULL WIDTH */
body.activity-detail-page .activity-graphs-container {
    margin-left: -50px; /* Counteract left padding of .container */
    margin-right: -50px; /* Counteract right padding of .container */
    width: calc(100% + 100px); /* 100% of parent content width + 50px left + 50px right */
    box-sizing: border-box; /* Include padding in the width calculation */
    padding: 0 15px; /* Re-add some internal padding */
}
body.activity-detail-page .activity-graphs-container .chart-container {
    position: relative;
    height: 350px; /* Increased height for readability */
    width: 100%;
    margin: 20px auto;
    background-color: #fff;
    padding: 15px;
    border-radius: 8px;
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
}
body.activity-detail-page .activity-graphs-container .chart-container canvas {
    width: 100% !important;
    height: 100% !important;
}
@media (max-width: 600px) {
    body.activity-detail-page .activity-graphs-container {
        margin-left: -20px;
        margin-right: -20px;
        width: calc(100% + 40px);
        padding: 0 10px;
    }
}

/* AI Analysis Box for activity_detail.html */
body.activity-detail-page .ai-analysis-box {
    margin-top: 30px;
    padding: 20px;
    background-color: #e0f7fa;
    border-left: 5px solid #007bff;
    border-radius: 8px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}
body.activity-detail-page .ai-buttons {
    margin-top: 15px;
    display: flex;
    gap: 10px;
}
body.activity-detail-page .ai-buttons .btn {
    flex-grow: 1;
}

/* Calendar Page Styles */
.calendar-container {
    max-width: 1400px;
    margin: 20px auto;
    padding: 20px;
    background-color: #fff;
    border-radius: 8px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}
.calendar-navigation-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}
.calendar-header {
    font-size: 1.5em;
    font-weight: bold;
    color: #333;
    flex-grow: 1;
    text-align: center;
}
.calendar-nav-buttons {
    display: flex;
    align-items: center;
}
.calendar-nav-buttons a {
    text-decoration: none;
    color: #007bff;
    padding: 8px 12px;
    border: 1px solid #007bff;
    border-radius: 5px;
    margin: 0 5px;
    transition: background-color 0.3s, color 0.3s;
    white-space: nowrap;
}
.calendar-nav-buttons a:hover {
    background-color: #007bff;
    color: white;
}
.calendar-grid-container {
    display: grid;
    grid-template-columns: repeat(7, minmax(100px, 1fr)) 180px;
    border: 1px solid #ccc;
    border-bottom: none;
    border-right: none;
}
.calendar-day-header, .calendar-summary-header {
    background-color: #f2f2f2;
    padding: 10px;
    text-align: center;
    font-weight: bold;
    border-bottom: 1px solid #ccc;
    border-right: 1px solid #ccc;
}
.calendar-summary-header {
    background-color: #e0f2f7;
}
.calendar-day {
    min-height: 120px;
    padding: 8px;
    border-bottom: 1px solid #eee;
    border-right: 1px solid #eee;
    position: relative;
    overflow: hidden;
    background-color: #fff;
}
.calendar-day.other-month {
    background-color: #f8f8f8;
    color: #aaa;
}
.calendar-day.today {
    border: 2px solid #007bff;
    background-color: #e6f7ff;
    z-index: 1;
}
.day-number {
    font-weight: bold;
    font-size: 1.1em;
    margin-bottom: 5px;
    color: #333;
}
.activity-entry {
    font-size: 0.85em;
    margin-bottom: 3px;
    padding: 3px 5px;
    background-color: #d1ecf1;
    border-left: 3px solid #007bff;
    border-radius: 3px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.activity-entry a {
    color: #004085;
    text-decoration: none;
}
.activity-entry a:hover {
    text-decoration: underline;
}
.planned-workout-entry {
    font-size: 0.85em;
    margin-bottom: 3px;
    padding: 3px 5px;
    background-color: #d4edda;
    border-left: 3px solid #28a745;
    border-radius: 3px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.planned-workout-entry a {
    color: #155724;
    text-decoration: none;
}
.planned-workout-entry a:hover {
    text-decoration: underline;
}
.week-summary-cell {
    padding: 8px;
    border-bottom: 1px solid #eee;
    border-right: 1px solid #eee;
    background-color: #f0f8ff;
    font-size: 0.9em;
    line-height: 1.4;
    display: flex;
    flex-direction: column;
    justify-content: center;
}
.week-summary-cell strong {
    display: block;
    margin-bottom: 3px;
    color: #0056b3;
}
.week-summary-cell p {
    margin: 0;
}
.calendar-filters-container {
    margin: 15px auto 20px;
    width: 100%;
    max-width: 1400px;
}
.calendar-filters-container form {
    display: grid;
    grid-template-columns: auto 1fr auto auto;
    align-items: center;
    gap: 10px;
    width: 100%;
}
.calendar-filters-container label {
    white-space: nowrap;
    font-weight: bold;
    flex-shrink: 0;
}
.calendar-filters-container select {
    padding: 8px;
    font-size: 1em;
    border: 1px solid #ccc;
    border-radius: 5px;
}
.calendar-filters-container button {
    padding: 8px 15px;
    background-color: #28a745;
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 1em;
    transition: background-color 0.3s ease;
    flex-shrink: 0;
}
.calendar-filters-container button:hover {
    background-color: #218838;
}

/* Profile Page Styles */
.profile-section {
    margin-top: 30px;
    padding: 20px;
    background-color: #f8f8f8;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}
.profile-section h3 {
    margin-bottom: 15px;
    color: #0056b3;
}
.profile-section p {
    margin-bottom: 10px;
}
.training-availability-grid {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 10px;
    margin-top: 20px;
    text-align: center;
}
.training-availability-grid .day-header,
.training-availability-grid .session-header {
    font-weight: bold;
    background-color: #f2f2f2;
    padding: 8px;
    border-radius: 4px;
    color: #003366;
}
.training-availability-grid .day-label {
    font-weight: bold;
    padding: 8px;
    text-align: left;
    color: #333;
}
.training-availability-grid input[type="number"] {
    width: 100%;
    padding: 8px;
    border: 1px solid #ccc;
    border-radius: 4px;
    text-align: center;
}

/* Fitness Status Page Styles */
.progress-filters {
    text-align: center;
    margin-bottom: 25px;
    display: flex;
    justify-content: center;
    align-items: center;
    flex-wrap: wrap;
    gap: 15px;
}
.progress-filters .filter-label {
    font-weight: bold;
    font-size: 1.1em;
    color: #333;
}
.btn-group {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}
.progress-filters .btn {
    text-decoration: none;
    padding: 8px 16px;
    border-radius: 20px;
    color: white;
    font-weight: 500;
    border: 1px solid transparent;
    transition: all 0.3s ease;
}
.progress-filters .btn-primary {
    background-color: #007bff;
    border-color: #007bff;
    box-shadow: 0 2px 4px rgba(0, 123, 255, 0.3);
}
.progress-filters .btn-secondary {
    background-color: #f8f9fa;
    color: #6c757d;
    border-color: #ddd;
}
.progress-filters .btn-secondary:hover {
    background-color: #e2e6ea;
    border-color: #ccc;
}
.fitness-metrics-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-top: 20px;
    text-align: center;
}
.metric-card {
    background-color: #e0f7fa;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}
.metric-card h4 {
    margin-bottom: 10px;
    color: #003366;
    font-size: 1.2em;
}
.metric-card p {
    font-size: 2.5em;
    font-weight: bold;
    color: #007bff;
    margin: 0;
}

/* Add spacing for the back to dashboard button at the bottom of pages */
.container .text-center.mt-5 {
    margin-top: 50px !important; /* Increase the top margin for more whitespace */
    padding-top: 20px; /* Add some padding inside if needed, or adjust margin-top */
}


/* Fitness Status Page Styles - Chart container for Fitness/Freshness, Power Curve, and Weekly CP */
.chart-container-full-width { /* This class is used in fitness_status.html */
    position: relative;
    height: 400px; /* Keep desired height */
    width: 100%; /* Take full width of its parent's content area (respecting parent padding) */
    margin: 20px 0; /* Remove auto margin, align to left within parent content */
    background-color: #fff;
    padding: 15px;
    border-radius: 8px;
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
    /* No negative margins or width:calc() here. This element should respect parent padding. */
}

.chart-container-full-width canvas { /* Canvas inside this container */
    height: 100% !important;
    width: 100% !important;
}


/* Power Curve Tables Grid */
.power-curve-tables-grid {
    display: grid;
    grid-template-columns: 1fr; /* Default to single column */
    gap: 25px;
    margin-top: 30px;
    /* Ensure this grid respects the parent .container's padding.
       NO negative margins or width:calc() here. */
}

@media (min-width: 768px) {
    .power-curve-tables-grid {
        grid-template-columns: repeat(2, 1fr); /* Two columns on medium screens */
    }
}






.power-curve-table-wrapper {
    background-color: #f8f8f8;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}
.power-curve-table-wrapper h4 {
    text-align: center;
    color: #0056b3;
    margin-bottom: 15px;
}
.power-curve-table-wrapper table {
    width: 100%;
    border-collapse: collapse;
}
.power-curve-table-wrapper th,
.power-curve-table-wrapper td {
    padding: 8px 10px;
    border: 1px solid #eee;
    text-align: left;
    vertical-align: middle;
}
.power-curve-table-wrapper th {
    background-color: #f2f2f2;
    font-weight: bold;
    color: #003366;
}
.relative-effort-col {
    width: 120px;
}
.power-curve-table-wrapper tbody tr:nth-of-type(odd) {
    background-color: rgba(0,0,0,.05);
}
.power-curve-table-wrapper tbody tr:hover {
    background-color: #e0f7fa;
}
.power-curve-table-wrapper a {
    color: #007bff;
    text-decoration: none;
    font-weight: bold;
}
.power-curve-table-wrapper a:hover {
    text-decoration: underline;
}
.progress-bar-container {
    width: 100%;
    background-color: #e9ecef;
    border-radius: 4px;
    height: 20px;
    overflow: hidden;
}
.progress-bar {
    height: 100%;
    background-image: linear-gradient(45deg, #007bff, #0056b3);
    border-radius: 4px;
    transition: width 0.4s ease-in-out;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    padding-right: 5px;
}
.progress-bar span {
    color: white;
    font-size: 0.8em;
    font-weight: bold;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.5);
}

/* Activities Page Styles */
.activity-filters {
    margin-bottom: 20px;
    text-align: center;
}
.activity-filters label {
    font-weight: bold;
    margin-right: 10px;
}
.activity-filters select {
    padding: 8px;
    border: 1px solid #ccc;
    border-radius: 5px;
}
.table-responsive {
    overflow-x: auto;
    margin-top: 20px;
}
.table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 20px;
}
.table th, .table td {
    border: 1px solid #ddd;
    padding: 8px;
    text-align: left;

}
.table th {
    background-color: #f2f2f2;
    font-weight: bold;
}
.table-striped tbody tr:nth-of-type(odd) {
    background-color: rgba(0,0,0,.05);
}
.table tbody tr:hover {
    background-color: #e0f7fa;
}
.pagination-controls {
    margin-top: 20px;
}
.pagination-controls .btn {
    margin: 0 5px;
}

/* Progress (Weekly Summary) Page Styles */
.charts-grid-2x2 {
    display: grid;
    grid-template-columns: 1fr;
    gap: 20px;
    margin-top: 20px;
}
@media (min-width: 768px) {
    .charts-grid-2x2 {
        grid-template-columns: 1fr 1fr;
    }
}
.chart-wrapper-2x2 {
    background-color: #f8f8f8;
    padding: 15px;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
    height: 300px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
}
.chart-wrapper-2x2 canvas {
    max-height: 250px;
    width: 100% !important;
    height: 100% !important;
}
.weekly-summary-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 20px;
    color: #333;
}
.weekly-summary-table th, .weekly-summary-table td {
    padding: 12px 15px;
    border: 1px solid #ddd;
    text-align: left;
}
.weekly-summary-table th {
    background-color: #f2f2f2;
    font-weight: bold;
    color: #003366;
}
.weekly-summary-table tbody tr:nth-of-type(odd) {
    background-color: rgba(0,0,0,.05);
}
.weekly-summary-table tbody tr:hover {
    background-color: #e0f7fa;
}

/* Adjust column widths for better display on smaller screens in the weekly summary table */
.weekly-summary-table th:nth-child(3), /* Distance */
.weekly-summary-table td:nth-child(3) {
    min-width: 100px;
}
.weekly-summary-table th:nth-child(4), /* Moving Time */
.weekly-summary-table td:nth-child(4) {
    min-width: 90px;
}
.weekly-summary-table th:nth-child(5), /* TSS */
.weekly-summary-table td:nth-child(5) {
    min-width: 70px;
}
.weekly-summary-table th:nth-child(6), /* Avg Power */
.weekly-summary-table td:nth-child(6),
.weekly-summary-table th:nth-child(7), /* Avg HR */
.weekly-summary-table td:nth-child(7) {
    min-width: 80px;
}
.weekly-summary-table th:nth-child(8), /* Activities */
.weekly-summary-table td:nth-child(8) {
    min-width: 70px;
}
.weekly-summary-table th .activity-icon {
    margin-right: 5px;
    color: #007bff;
}

/* Workouts Page Styles */
.filter-form {
    margin-bottom: 20px;
    padding: 20px;
    background-color: #f9f9f9;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
}
.filter-form label {
    display: block;
    margin-bottom: 5px;
    font-weight: bold;
}
.filter-form input[type="text"],
.filter-form input[type="number"],
.filter-form select {
    width: calc(100% - 10px);
    padding: 8px;
    border: 1px solid #ccc;
    border-radius: 4px;
}
.filter-form button {
    grid-column: 1 / -1;
    padding: 10px 15px;
    background-color: #007bff;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 16px;
    transition: background-color 0.3s ease;
}
.filter-form button:hover {
    background-color: #0056b3;
}
.workout-list table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 20px;
}
.workout-list th, .workout-list td {
    border: 1px solid #ddd;
    padding: 8px;
    text-align: left;
}
.workout-list th {
    background-color: #f2f2f2;
    font-weight: bold;
}
.workout-list tr:nth-child(even) {
    background-color: #f9f9f9;
}
.no-workouts {
    text-align: center;
    margin-top: 30px;
    color: #666;
}

/* Upcoming Training Page Styles */
.training-plan-container {
    max-width: 1400px;
    margin: auto;
    padding: 40px 20px;
}
.call-to-action-card {
    background-color: #f8f9fa;
    border-radius: 8px;
    padding: 30px;
    text-align: center;
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
    margin-bottom: 30px;
}
.call-to-action-card h3 {
    color: #003366;
}
.call-to-action-card p {
    color: #6c757d;
}
.training-date-filter {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 15px;
    margin-top: 20px;
}
.training-plan-form {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 15px;
    max-width: fit-content;
    margin: auto;
}
.training-date-filter label {
    white-space: nowrap;
    font-weight: bold;
    flex-shrink: 0;
}
.training-date-filter input[type="date"] {
    padding: 8px;
    font-size: 1em;
    border: 1px solid #ccc;
    border-radius: 5px;
    flex-grow: 1;
}
.generate-button {
    background-color: #28a745;
    color: white;
    border: none;
    padding: 12px 30px;
    font-size: 1.1em;
    font-weight: bold;
    border-radius: 25px;
    cursor: pointer;
    transition: background-color 0.3s ease, transform 0.2s;
}
.generate-button:hover {
    background-color: #218838;
    transform: translateY(-2px);
}
.training-plan-summary {
    margin-top: 40px;
}
.training-plan-summary h3 {
    text-align: center;
    margin-bottom: 25px;
    color: #007bff;
}
.plan-explanation-box {
    background-color: #e9ecef;
    padding: 25px;
    border-left: 5px solid #007bff;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    margin-bottom: 30px;
    text-align: left;
}
.plan-explanation-box h4 {
    color: #0056b3;
    font-size: 1.2em;
    margin-top: 0.5em;
    margin-bottom: 0.5em;
    text-align: left;
}
.plan-explanation-box p {
    margin-bottom: 1em;
}
.plan-explanation-box ul,
.plan-explanation-box ol {
    list-style: disc;
    padding-left: 25px;
    margin-bottom: 1em;
}
.plan-explanation-box li {
    margin-bottom: 0.5em;
}
.plan-day {
    display: flex;
    align-items: flex-start;
    gap: 20px;
    margin-bottom: 20px;
    padding: 15px;
    border: 1px solid #ddd;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}
.plan-day.rest-day {
    background-color: #f0f8ff;
}
.plan-day.workout-day {
    background-color: #f8f9fa;
}
.day-label {
    flex-shrink: 0;
    width: 120px;
    text-align: center;
}
.day-label h4 {
    margin: 0;
    color: #003366;
}
.day-label p {
    font-size: 0.9em;
    color: #6c757d;
}
.plan-content {
    flex-grow: 1;
    border-left: 2px solid #ccc;
    padding-left: 20px;
}
.plan-content h5 {
    margin-top: 0;
    margin-bottom: 5px;
    font-size: 1.1em;
    color: #0056b3;
}
.plan-content p {
    margin: 0;
    color: #333;
}

/* Dashboard Specific Styles */
.dashboard-section {
    margin-top: 25px;
    padding: 20px;
    background-color: #f8f8f8;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}
.dashboard-section h3 {
    color: #0056b3;
    margin-bottom: 15px;
}
.dashboard-section p {
    margin-bottom: 10px;
}

/* New style for grouping Strava buttons */
.strava-buttons-group {
    display: flex; /* Enables flexbox layout */
    justify-content: flex-start; /* Aligns items to the start (left) of the container */
    gap: 15px; /* Space between the items (forms) */
    margin-top: 20px; /* Adjust as needed for spacing above */
    margin-bottom: 20px; /* Adjust as needed for spacing below */
    flex-wrap: wrap; /* Allows buttons to wrap to the next line on smaller screens */
}

.strava-buttons-group form {
    /* Override global form styles to allow them to sit inline within the flex container */
    max-width: none; /* Remove max-width constraint */
    margin: 0; /* Remove any auto margins that would center them individually */
    display: block; /* Treat the form as a block, but it will be managed by flex parent */
    flex-direction: row; /* Ensure inner form content doesn't stack if form itself is a flex container */
    gap: 0; /* Remove internal gap if any */
}

.strava-buttons-group form button {
    /* Buttons inside these forms should simply inherit .btn styles */
    /* No specific overrides needed here unless you want them to be a fixed width */
    width: auto; /* Allow buttons to size to their content */
    margin: 0; /* Remove any internal button margins */
}

/* Home Page Call To Action Buttons */
.home-call-to-action {
    margin-top: 30px; /* Space above the buttons */
    display: flex; /* Arrange buttons in a row */
    justify-content: center; /* Center the buttons horizontally */
    gap: 15px; /* Space between the buttons */
    flex-wrap: wrap; /* Allow buttons to wrap on smaller screens */
}

.home-call-to-action .btn {
    /* Override specific button styles if necessary, but defaults should be fine */
    padding: 10px 20px; /* Slightly larger padding for these main action buttons */
    font-weight: bold; /* Make them bold */
    border-radius: 5px; /* Ensure rounded corners */
}

/* Specific color override for the primary button on home page if desired,
   otherwise, it will use the global .btn-primary */
.home-call-to-action .btn-primary {
    background-color: #00796b; /* Re-apply the original teal color */
    border-color: #00796b;
}

.home-call-to-action .btn-primary:hover {
    background-color: #005f56; /* Darker teal on hover */
    border-color: #005f56;
}



/* Print Specific Styles */
@media print {
    body {
        background-color: #fff;
        margin: 0;
        padding: 0;
    }
    /* Hide non-essential elements for printing */
    header, nav, footer, .alert,
    .form-actions,
    .form-group label,
    .form-group input,
    .pagination-controls,
    .activity-filters,
    .progress-filters,
    .ai-buttons,
    .call-to-action-card,
    .training-date-filter button,
    .training-plan-form button,
    .strava-buttons-group { /* Hide this new group as well */
        display: none !important;
    }
    .container, .common,
    .calendar-container,
    .activity-details-grid,
    .zone-list-container,
    .power-curve-section-container,
    .power-curve-tables-grid,
    .fitness-metrics-grid,
    .charts-grid-2x2,
    .workout-list {
        box-shadow: none;
        margin: 0;
        padding: 0;
        width: 100%;
        max-width: none;
        display: block; /* Ensure they are not hidden by flex/grid rules */
    }
    .calendar-grid-container, .weekly-summary-table, .table {
        border: 1px solid #000; /* Print tables with borders */
    }
    .calendar-day, .calendar-day-header, .calendar-summary-header,
    .weekly-summary-table th, .weekly-summary-table td,
    .table th, .table td {
        border: 1px solid #ccc;
        background-color: #fff !important; /* Force white background */
        color: #000 !important; /* Force black text */
    }
    h1, h2, h3, h4, h5, h6 {
        color: #000 !important;
        text-align: left;
    }
    a {
        text-decoration: none !important;
        color: #000 !important; /* Ensure links are black and not underlined */
    }
    .activity-icon {
        display: none !important; /* Hide icons in print */
    }
    .table-responsive {
        overflow-x: visible; /* Ensure tables are not scrollable in print */
    }
    .plan-explanation-box, .plan-day {
        box-shadow: none;
        border: 1px solid #ddd;
        page-break-inside: avoid;
        background-color: #fff !important;
    }
    .plan-content {
        border-left: none; /* Remove border in print */
        padding-left: 0;
    }
} /* Closing brace for @media print */


/* Responsive adjustments for smaller screens */
@media (max-width: 900px) {
    .container {
        padding: 20px;
    }
    .form-group label {
        flex-basis: 120px; /* Reduce label width for smaller screens */
    }
    .calendar-container {
        padding: 15px;
    }
    .calendar-grid-container {
        grid-template-columns: repeat(7, minmax(80px, 1fr)) 150px; /* Adjust column width */
    }
    .calendar-filters-container form {
        grid-template-columns: 1fr; /* Stack filter elements */
    }
    .calendar-filters-container label,
    .calendar-filters-container select,
    .calendar-filters-container button {
        width: 100%; /* Full width for stacked elements */
        text-align: center;
    }
    .calendar-nav-buttons a {
        padding: 6px 10px;
    }
    .profile-section form .form-group {
        flex-direction: column;
        align-items: flex-start;
    }
    .profile-section form .form-group label {
        margin-bottom: 5px;
        flex-basis: auto;
    }
    .profile-section form .form-group input,
    .profile-section form .form-group select {
        width: 100%;
        max-width: none;
    }
    .training-availability-grid {
        grid-template-columns: 1fr; /* Stack training availability vertically */
    }
    .training-availability-grid .session-header {
        grid-column: span 1; /* Reset span */
    }
    .training-availability-grid .day-header {
        display: none; /* Hide header for days if stacking fully */
    }
    .charts-grid-2x2,
    .power-curve-tables-grid {
        grid-template-columns: 1fr; /* Stack charts/tables vertically */
    }
    .filter-form {
        grid-template-columns: 1fr; /* Stack workout filters vertically */
    }
    .training-plan-form {
        flex-direction: column; /* Stack training plan controls */
        gap: 10px;
    }
    .training-date-filter {
        flex-direction: column;
        gap: 5px;
    }
    .training-date-filter input {
        width: 100%;
    }
    .generate-button {
        width: 100%;
        padding: 10px 15px;
    }
    .plan-day {
        flex-direction: column; /* Stack plan day content vertically */
        align-items: center;
    }
    .day-label {
        width: 100%;
        margin-bottom: 10px;
    }
    .plan-content {
        border-left: none;
        padding-left: 0;
        text-align: center;
    }
    .strava-buttons-group {
        flex-direction: column; /* Stack buttons on small screens */
        align-items: center;
    }
    .strava-buttons-group form {
        width: 100%; /* Make each form take full width */
    }
} /* Closing brace for @media (max-width: 900px) */

@media (max-width: 600px) {
    .container {
        padding: 20px;
    }
    header h1 {
        font-size: 2rem;
    }
    header h3 {
        font-size: 1em;
    }
    nav a {
        margin: 0 8px;
        font-size: 0.9em;
    }
    .form-group {
        flex-direction: column;
        align-items: flex-start;
    }
    .form-group label {
        margin-right: 0;
        margin-bottom: 5px;
    }
    .form-group input[type="text"],
    .form-group input[type="number"],
    .form-group input[type="email"],
    .form-group input[type="password"],
    .form-group input[type="date"],
    .form-group select {
        max-width: 100%;
        width: 100%;
    }
    .form-actions {
        flex-direction: column;
    }
} /* Closing brace for @media (max-width: 600px) */


/* Ensure proper spacing for chart sections and headings */
.power-curve-section-container {
    margin-bottom: 25px; /* Add margin below the power curve section to create space */
}

.power-curve-section-container + h3, /* Added for consistency if another h3 follows */
.ai-analysis-box + h4 { /* For the AI analysis heading if needed */
    margin-top: 40px; /* Increase margin for a clearer separation */
}


/* Alert Messages (Success, Danger, Warning) */
.alert {
  padding: 10px;
  margin: 10px auto; /* Center alerts */
  border: 1px solid transparent;
  border-radius: 4px;
  max-width: 1200px; /* Match container width */
  text-align: center;
}

.alert-success {
  background-color: #d4edda; /* Kept green for success, as it's a universal indicator */
  border-color: #c3e6cb;
  color: #155724;
}

.alert-info {
  background-color: #d1ecf1;
  border-color: #bee5eb;
  color: #0c5460;
}

.alert-danger {
  background-color: #f8d7da;
  border-color: #f5c6cb;
  color: #721c24;
}

.alert-warning {
  background-color: #fff3cd;
  border-color: #ffeeba;
  color: #85640b;
}

.alert-danger {
    color: #721c24;
    background-color: #f8d7da;
    border-color: #f5c6cb;
}

/* Footer Section */
footer {
  margin-top: 20px;
  background-color: #003366; /* Dark blue for footer */
  color: white;
  display: flex;
  justify-content: center; /* Centers horizontally */
  align-items: center; /* Centers vertically */
  height: 50px;
  width: 100%; /* Ensures full width */
  font-size: 0.9em;
}