/* Powerlifting Redesign Styles - Final Layout Adjustments */

/* === General Spacing & Typography Fixes === */
body {
    background-color: #f4f6f8; /* Slightly darker/warmer background for better contrast */
}

/* Ensure container has proper padding/margin on desktop */
.powerlifting-container {
    max-width: 1200px;
    margin: 0 auto;
    background: transparent; /* Allow sections to have their own cards */
    box-shadow: none; /* Remove container shadow, apply to sections */
}

.powerlifting-header {
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
    margin-bottom: 20px;
    padding: 15px 25px;
}

.program-content.rearranged-layout {
    display: flex;
    flex-direction: column;
    gap: 20px; /* Consistent spacing between major sections */
}

/* === Section Card Styling === */
/* Apply card styling to all main sections */
.day-cycle-info-section,
.workout-title-section,
.workout-focus-section,
.today-workout-exercises-section,
.navigation-buttons-section,
.workout-user-notes-section,
.strength-cycle-section,
.progress-section,
.calendar-section,
.save-controls-section {
    background: #ffffff;
    border-radius: 12px;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    padding: 20px;
    border: 1px solid #e2e8f0;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

/* Hover effect for cards */
.day-cycle-info-section:hover,
.workout-focus-section:hover,
.strength-cycle-section:hover,
.progress-section:hover {
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
}

/* === Specific Section Styling === */

/* 1. Day & Cycle Info */
.day-cycle-info-section {
    background: linear-gradient(to right, #ffffff, #f8fafc);
    border-left: 5px solid #3182ce;
}

.enhanced-navigation.day-info-only {
    border-top: none;
    margin-bottom: 15px;
    padding-top: 0;
    justify-content: center;
}

.current-day-display {
    text-align: left;
    display: flex;
    align-items: baseline;
    gap: 15px;
}

.current-day-number {
    font-size: 2rem;
    color: #2c5282;
    font-weight: 800;
}

.current-day-info {
    font-size: 1.1rem;
    color: #4a5568;
    font-weight: 500;
    background: #ebf8ff;
    padding: 4px 12px;
    border-radius: 20px;
}

/* Timeline tweaks inside this section */
.program-timeline-container {
    box-shadow: none; /* Remove nested shadow */
    padding: 0; /* Remove padding */
    margin-top: 10px;
    border: none;
}

/* 2. Workout Title */
.workout-title-section {
    background: #2d3748; /* Dark background for title */
    color: white;
    padding: 15px 25px;
    text-align: center;
    border: none;
}

.workout-title-section h3 {
    margin: 0;
    color: white;
    font-size: 1.5rem;
    font-weight: 600;
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

/* 3. Workout Focus */
.workout-focus-section {
    background: #fffaf0; /* Light orange tint */
    border-left: 5px solid #ed8936;
}

.workout-notes.system-notes-only {
    background: transparent;
    border: none;
    box-shadow: none;
    padding: 0;
    margin: 0;
}

.workout-notes.system-notes-only h3 {
    color: #9c4221;
    border-bottom-color: #fbd38d;
}

/* 4. Today's Workout Exercises */
.today-workout-exercises-section {
    background: #f7fafc;
    padding: 10px; /* Less padding to allow cards to fill width */
}

/* Adjust exercise cards to look good inside this section */
#workout-exercises .exercise-card {
    border: none;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
    margin-bottom: 20px;
}

#workout-exercises .exercise-card:last-child {
    margin-bottom: 0;
}

/* 5. Navigation Buttons */
.navigation-buttons-section {
    padding: 15px;
    background: transparent; /* Blend with background */
    box-shadow: none;
    border: none;
}

.enhanced-navigation.buttons-only {
    border: none;
    padding: 0;
    margin: 0;
    gap: 20px;
    justify-content: space-between;
}

.nav-button {
    font-size: 1.1rem;
    padding: 15px 25px;
    border-radius: 8px;
    flex-basis: 48%; /* Almost half width */
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
}

.prev-button {
    background-color: #718096;
}
.prev-button:hover {
    background-color: #4a5568;
}

.next-button {
    background-color: #3182ce;
}
.next-button:hover {
    background-color: #2b6cb0;
}

/* 6. User Notes */
.workout-user-notes-section {
    border-top: 4px solid #4a5568;
}

.workout-notes.user-notes-only {
    background: transparent;
    border: none;
    padding: 0;
    margin: 0;
    box-shadow: none;
}

/* 7. Strength Cycle / Maxes */
.strength-cycle-section {
    background: #fff;
}

/* 8. Progress */
.progress-section {
    min-height: 300px;
}

/* 9. Calendar */
.calendar-section {
    padding: 0; /* Calendar view has its own padding usually */
    overflow: hidden; /* Contain border radius */
}
.weekly-overview {
    border: none;
    box-shadow: none;
    margin: 0;
}

/* 10. Save Controls */
.save-controls-section {
    background: #fff;
    border: 1px solid #3182ce;
    /* Removed sticky positioning to follow requested flow */
}

.save-workout-section {
    background: transparent;
    border: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.save-workout-button {
    font-size: 1.2rem;
    font-weight: 700;
    padding: 15px;
    text-transform: uppercase;
    letter-spacing: 1px;
    box-shadow: 0 4px 15px rgba(49, 130, 206, 0.4);
}

/* === Mobile Adjustments === */
@media (max-width: 768px) {
    .current-day-display {
        flex-direction: column;
        align-items: flex-start;
        gap: 5px;
    }

    .current-day-number {
        font-size: 1.5rem;
    }

    .navigation-buttons-section {
        position: sticky;
        bottom: 80px; /* Above save bar? Or maybe keep it inline */
        z-index: 90;
        pointer-events: none; /* Let clicks pass through padding */
    }

    .enhanced-navigation.buttons-only {
        pointer-events: auto;
    }

    .save-controls-section {
        bottom: auto;
        border-radius: 12px;
        border-bottom: 1px solid #e2e8f0;
        margin-bottom: 20px;
    }

    /* Make sections slightly more compact on mobile */
    .day-cycle-info-section,
    .workout-title-section,
    .workout-focus-section,
    .today-workout-exercises-section {
        padding: 15px;
        margin-bottom: 0;
    }
}

/* === Missing Component Styles (Restored & Enhanced) === */

/* Calendar Styles */
.calendar-view {
    width: 100%;
}

.month-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    font-weight: bold;
    font-size: 1.2rem;
    color: #2d3748;
}

.calendar-nav-btn {
    background: transparent;
    border: 1px solid #e2e8f0;
    border-radius: 4px;
    cursor: pointer;
    font-size: 1rem;
    color: #4a5568;
    padding: 5px 10px;
    transition: all 0.2s;
}

.calendar-nav-btn:hover {
    background-color: #edf2f7;
    color: #2d3748;
}

.calendar-grid-container {
    width: 100%;
    overflow-x: auto;
}

.calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 5px;
    min-width: 300px;
}

.day-header {
    text-align: center;
    font-weight: 600;
    font-size: 0.85rem;
    color: #718096;
    padding-bottom: 8px;
    text-transform: uppercase;
}

.calendar-day {
    aspect-ratio: 1;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    padding: 6px;
    font-size: 0.9rem;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    background: #fff;
    cursor: pointer;
    transition: all 0.2s;
    min-height: 60px;
}

.calendar-day:hover {
    background-color: #f7fafc;
    border-color: #cbd5e0;
    transform: translateY(-2px);
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

.calendar-day.today {
    border: 2px solid #3182ce;
    background-color: #ebf8ff;
}

.calendar-day.selected {
    background-color: #3182ce;
    color: white;
    border-color: #3182ce;
}

.calendar-day.empty {
    background: transparent;
    border: none;
    cursor: default;
}
.calendar-day.empty:hover {
    background: transparent;
    transform: none;
    box-shadow: none;
}

/* Ensure sets table looks good in the new card layout */
.sets-table-container {
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    overflow: hidden;
}

.sets-table .table-header {
    background-color: #edf2f7;
    border-bottom: 1px solid #cbd5e0;
}

.sets-table .table-row:nth-child(even) {
    background-color: #f7fafc;
}

/* === Table Layout Fixes === */

/* Default Desktop Grid (Main Lifts - 5 columns) */
.sets-table .table-header,
.sets-table .table-row {
    display: grid;
    grid-template-columns: 40px minmax(70px, 1fr) minmax(70px, 1fr) minmax(60px, 0.8fr) 60px;
    align-items: center;
}

/* Accessory Grid (4 columns) - Class added via JS */
.sets-table.accessory-table .table-header,
.sets-table.accessory-table .table-row {
    grid-template-columns: 40px minmax(70px, 1fr) minmax(70px, 1fr) 60px;
}

/* Mobile Adjustments for Tables */
@media (max-width: 600px) {
    /* Ensure box-sizing matches */
    .sets-table * {
        box-sizing: border-box;
    }

    /* Override legacy min-width that forces scroll */
    .sets-table {
        min-width: 0 !important;
        width: 100%;
    }

    /* Main Lifts (5 cols) - Tighter, prioritized layout */
    .sets-table .table-header,
    .sets-table .table-row {
        /* Reduced 'Set' and 'Done' columns, allocated more relative space to content */
        /* Weight box set to fixed 55px to prevent overflow */
        grid-template-columns: 25px 55px minmax(35px, 1fr) minmax(30px, 0.6fr) 30px;
        font-size: 0.85rem;
        gap: 2px; /* Slight gap control */
    }

    /* Accessory (4 cols) */
    .sets-table.accessory-table .table-header,
    .sets-table.accessory-table .table-row {
        /* Weight box set to fixed 55px to prevent overflow */
        grid-template-columns: 25px 55px minmax(40px, 1fr) 30px;
    }

    /* Reduce gap inside cells */
    .sets-table span,
    .sets-table input {
        padding: 0 1px; /* Minimal padding */
        overflow: hidden; /* Prevent overflow text */
        text-overflow: ellipsis; /* Ellipsis for text if needed */
        white-space: nowrap; /* Keep single line */
        text-align: center;
    }

    /* Adjust input widths */
    .set-weight-input {
        width: 100% !important; /* Override inline styles */
        min-width: 35px; /* Allow slightly smaller */
        font-size: 16px !important; /* Prevent zoom on iOS */
        padding: 2px 0 !important; /* Minimal padding inside input */
    }

    .sets-table .table-header {
        font-size: 0.75rem; /* Smaller header text */
        font-weight: 700;
        letter-spacing: -0.5px; /* Tighten header text */
    }

    /* Compress headers on mobile */
    .sets-table .table-header span:first-child {
        font-size: 0; /* Hide 'Set' text */
    }
    .sets-table .table-header span:first-child::after {
        content: "#";
        font-size: 0.75rem;
    }

    .sets-table .table-header span:last-child {
        font-size: 0; /* Hide 'Done' text */
    }
    .sets-table .table-header span:last-child::after {
        content: "✓";
        font-size: 0.9rem;
    }
}
