/* Global Styles & Blue Theme */

:root {
    --primary-blue: #0056b3;
    --dark-blue: #003a75;
    --light-blue: #e6f0ff;
    --text-color: #333;
    --bg-color: #f4f7f6;
    --white: #ffffff;
    --shadow: 0 4px 12px rgba(0, 58, 117, 0.1);
}

body {
    font-family: Arial, sans-serif;
    margin: 0;
    background-color: var(--bg-color);
    color: var(--text-color);
    line-height: 1.6;
}


/* Header & Navigation */

header {
    background-color: var(--dark-blue);
    color: var(--white);
    padding: 20px 40px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
}

header h1 {
    margin: 0;
    font-size: 2rem;
}

header nav a {
    color: var(--white);
    text-decoration: none;
    margin-left: 20px;
    font-size: 1rem;
    padding: 5px 10px;
    border-radius: 5px;
    transition: background-color 0.3s;
}

header nav a:hover {
    background-color: var(--primary-blue);
}


/* Main Content Area */

main {
    max-width: 1200px;
    margin: 40px auto;
    padding: 0 20px;
    text-align: center;
}

main h2 {
    color: var(--dark-blue);
    font-size: 2.5rem;
    margin-bottom: 10px;
}


/* Exercise Card Layout */

.exercise-container {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 25px;
    margin-top: 30px;
}

.exercise-card {
    background-color: var(--white);
    border-radius: 10px;
    box-shadow: var(--shadow);
    width: 300px;
    overflow: hidden;
    text-align: left;
    transition: transform 0.3s, box-shadow 0.3s;
}


/* Interactive Hover Effect */

.exercise-card:hover {
    transform: translateY(-8px);
    box-shadow: 0 8px 20px rgba(0, 58, 117, 0.2);
}

.exercise-card img {
    width: 100%;
    height: 200px;
    object-fit: cover;
}

.card-content {
    padding: 20px;
}

.card-content h3 {
    margin: 0 0 10px;
    color: var(--dark-blue);
}

.category-tag {
    display: inline-block;
    background-color: var(--light-blue);
    color: var(--primary-blue);
    padding: 5px 12px;
    border-radius: 15px;
    font-size: 0.8rem;
    font-weight: bold;
    margin-bottom: 15px;
}

.description {
    font-size: 0.95rem;
    margin-bottom: 15px;
}


/* Button Styling */

.toggle-desc {
    background-color: var(--primary-blue);
    color: var(--white);
    border: none;
    padding: 10px 15px;
    border-radius: 5px;
    cursor: pointer;
    font-size: 0.9rem;
    width: 100%;
    transition: background-color 0.3s;
}

.toggle-desc:hover {
    background-color: var(--dark-blue);
}


/* Footer */

footer {
    text-align: center;
    padding: 20px;
    background-color: #333;
    color: var(--white);
    margin-top: 50px;
}


/* === Form Styling === */

.form-container {
    max-width: 500px;
    margin: 40px auto;
    padding: 30px;
    background-color: var(--white);
    border-radius: 10px;
    box-shadow: var(--shadow);
    text-align: left;
}

.form-container h2 {
    text-align: center;
    color: var(--dark-blue);
    margin-bottom: 25px;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: bold;
    color: var(--text-color);
}

.form-group input[type="text"],
.form-group input[type="email"],
.form-group input[type="password"] {
    width: 100%;
    padding: 12px;
    border: 1px solid #ccc;
    border-radius: 5px;
    box-sizing: border-box;
    /* Important for padding to work right */
}


/* Button (re-using .toggle-desc style but making it more generic) */

.btn-primary {
    background-color: var(--primary-blue);
    color: var(--white);
    border: none;
    padding: 12px 20px;
    border-radius: 5px;
    cursor: pointer;
    font-size: 1rem;
    font-weight: bold;
    width: 100%;
    transition: background-color 0.3s;
}

.btn-primary:hover {
    background-color: var(--dark-blue);
}

.form-container p {
    text-align: center;
    margin-top: 20px;
}


/* For messages (success/error) */

.message {
    text-align: center;
    padding: 10px;
    border-radius: 5px;
    margin-bottom: 20px;
    background-color: var(--light-blue);
    color: var(--dark-blue);
    border: 1px solid var(--primary-blue);
}

.message.error {
    background-color: #ffe6e6;
    color: #b30000;
    border-color: #b30000;
}


/* Make header H1 a link */

.logo-link {
    color: var(--white);
    text-decoration: none;
}


/* === Password Strength Validation === */

#password-strength {
    margin-top: -10px;
    margin-bottom: 20px;
    padding: 15px;
    background-color: var(--light-blue);
    border-radius: 5px;
    border: 1px solid #bde0ff;
}

#password-strength p {
    margin: 0 0 10px;
    font-weight: bold;
    color: var(--dark-blue);
}

.validation-list {
    list-style-type: none;
    padding-left: 0;
    margin: 0;
}

.validation-list li {
    font-size: 0.9rem;
    color: #555;
    margin-bottom: 5px;
    /* Default state is 'invalid' (a cross) */
    position: relative;
    padding-left: 25px;
}

.validation-list li::before {
    content: '❌';
    /* Invalid cross */
    position: absolute;
    left: 0;
}


/* Valid state (a checkmark) */

.validation-list li.valid {
    color: #006400;
    /* Dark green */
}

.validation-list li.valid::before {
    content: '✅';
    /* Valid checkmark */
}

.form-extra {
    text-align: right;
    margin-top: -10px;
    margin-bottom: 20px;
    font-size: 0.9rem;
}


/* --- Terms & Conditions --- */

.terms-group {
    display: flex;
    align-items: flex-start;
    /* Align to top for multi-line text */
    margin-bottom: 20px;
    font-size: 0.9rem;
    line-height: 1.4;
}

.terms-group input[type="checkbox"] {
    margin-right: 10px;
    margin-top: 3px;
    /* Align checkbox with text */
    width: auto;
    /* Override default */
    flex-shrink: 0;
    /* Prevent checkbox from shrinking */
}

.terms-group label {
    margin-bottom: 0;
    font-weight: normal;
}

.terms-group a {
    color: var(--primary-blue);
    text-decoration: none;
}

.terms-group a:hover {
    text-decoration: underline;
}


/* --- Auth Error Messages --- */

.auth-error {
    color: #b30000;
    font-size: 0.9rem;
    margin-top: -10px;
    margin-bottom: 15px;
}


/* --- Disabled Button State --- */

.btn-primary:disabled {
    background-color: #a0a0a0;
    /* Greyed out */
    cursor: not-allowed;
    opacity: 0.7;
}

.btn-primary:disabled:hover {
    background-color: #a0a0a0;
    /* No hover effect */
    opacity: 0.7;
}


/* === Workout Plan Cards === */

.plan-container {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 25px;
    margin-top: 30px;
}

.plan-card {
    background-color: var(--white);
    border-radius: 10px;
    box-shadow: var(--shadow);
    width: 350px;
    /* A bit wider than exercise cards */
    overflow: hidden;
    text-align: left;
    transition: transform 0.3s, box-shadow 0.3s;
}

.plan-card:hover {
    transform: translateY(-8px);
    box-shadow: 0 8px 20px rgba(0, 58, 117, 0.2);
}

.plan-card img {
    width: 100%;
    height: 220px;
    object-fit: cover;
}

.plan-card .card-content {
    padding: 20px;
}

.plan-card h3 {
    margin: 10px 0;
    color: var(--dark-blue);
}

.plan-card p {
    font-size: 0.95rem;
    margin-bottom: 20px;
    min-height: 40px;
    /* Give some consistent height */
}


/* Make the 'Start Workout' button fill the space */

.plan-card .btn-primary {
    display: block;
    text-align: center;
    text-decoration: none;
}


/* Difficulty Tags */

.difficulty-tag {
    display: inline-block;
    padding: 5px 12px;
    border-radius: 15px;
    font-size: 0.8rem;
    font-weight: bold;
    color: var(--white);
}

.difficulty-tag.beginner {
    background-color: #28a745;
}


/* Green */

.difficulty-tag.intermediate {
    background-color: #ffc107;
}


/* Yellow */

.difficulty-tag.advanced {
    background-color: #dc3545;
}


/* Red */


/* === Workout Player Page === */

.player-body {
    background-color: var(--dark-blue);
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100vh;
    padding: 20px;
    box-sizing: border-box;
}

.player-container {
    width: 100%;
    max-width: 450px;
    height: 95vh;
    max-height: 800px;
    background-color: var(--white);
    border-radius: 20px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 25px;
    box-sizing: border-box;
}

.player-header {
    width: 100%;
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.player-header h3 {
    margin: 0;
    color: var(--dark-blue);
    font-size: 1.2rem;
}

.quit-link {
    font-size: 0.9rem;
    color: var(--text-color);
    text-decoration: none;
}

.quit-link:hover {
    color: var(--primary-blue);
}


/* Exercise Image */

.player-stage {
    width: 100%;
    height: 250px;
    background-color: var(--light-blue);
    border-radius: 15px;
    overflow: hidden;
    margin-bottom: 20px;
}

.player-stage img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

#exercise-name {
    font-size: 2rem;
    color: var(--dark-blue);
    margin: 0 0 15px;
    text-align: center;
}


/* Timer Circle */

.timer-circle {
    width: 180px;
    height: 180px;
    border-radius: 50%;
    background-color: var(--white);
    border: 10px solid var(--primary-blue);
    display: flex;
    justify-content: center;
    align-items: center;
    box-shadow: var(--shadow);
    margin-bottom: 20px;
}

#timer-display {
    font-size: 4.5rem;
    font-weight: bold;
    color: var(--dark-blue);
}


/* Up Next Info */

.up-next-info {
    text-align: center;
    margin-bottom: 25px;
}

.up-next-info h4 {
    margin: 0 0 5px;
    color: #888;
    font-size: 0.9rem;
    letter-spacing: 1px;
}

.up-next-info p {
    margin: 0;
    font-size: 1.2rem;
    color: var(--text-color);
    font-weight: bold;
}


/* Player Controls */

.player-controls {
    display: flex;
    justify-content: center;
    gap: 20px;
    width: 100%;
    margin-top: auto;
    /* Pushes controls to the bottom */
}

.player-controls button {
    padding: 15px 20px;
    font-size: 1rem;
    font-weight: bold;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    flex-grow: 1;
    /* Makes buttons fill space */
    transition: all 0.3s;
}

#pause-btn {
    background-color: var(--light-blue);
    color: var(--primary-blue);
    border: 2px solid var(--light-blue);
}

#pause-btn:hover {
    background-color: #d4e5ff;
}

#pause-btn.paused {
    background-color: #ffc107;
    /* Yellow when paused */
    color: var(--white);
}

#skip-btn {
    background-color: var(--primary-blue);
    color: var(--white);
}

#skip-btn:hover {
    background-color: var(--dark-blue);
}


/* Workout Complete Screen */

#complete-screen {
    justify-content: center;
    text-align: center;
    gap: 15px;
}

#complete-screen h2 {
    color: var(--dark-blue);
    font-size: 2.5rem;
}

#complete-screen .trophy-icon {
    font-size: 4rem;
}

#complete-screen .btn-primary,
#complete-screen .quit-link {
    width: 100%;
    box-sizing: border-box;
    text-align: center;
    text-decoration: none;
}


/* --- Workout Complete Screen --- */

.quote {
    font-style: italic;
    color: #555;
    margin: 10px 15px;
    font-size: 1.1rem;
}

#complete-screen .btn-primary {
    width: 100%;
    box-sizing: border-box;
}


/* === Modal Styling (Welcome & Feedback) === */

.modal-overlay {
    position: fixed;
    /* Sit on top of the page */
    z-index: 1000;
    /* High z-index */
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 58, 117, 0.6);
    /* Blue-tinted overlay */
    display: flex;
    justify-content: center;
    align-items: center;
    /* Hide by default, shown by JS */
    display: none;
}

.modal-content {
    background-color: var(--white);
    padding: 30px 40px;
    border-radius: 15px;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.2);
    width: 90%;
    max-width: 500px;
    text-align: center;
    position: relative;
    /* Pop-in animation */
    animation: modal-pop 0.3s ease-out;
}

@keyframes modal-pop {
    from {
        transform: scale(0.8);
        opacity: 0;
    }
    to {
        transform: scale(1);
        opacity: 1;
    }
}

.modal-icon {
    font-size: 3.5rem;
    margin-bottom: 15px;
}

.modal-content h2 {
    color: var(--dark-blue);
    margin: 0 0 15px;
}

.modal-content p {
    font-size: 1.1rem;
    color: var(--text-color);
    margin-bottom: 25px;
}

.modal-close-btn {
    position: absolute;
    top: 15px;
    right: 20px;
    font-size: 2rem;
    color: #aaa;
    cursor: pointer;
    line-height: 1;
}

.modal-close-btn:hover {
    color: #333;
}


/* Make the button full-width in the modal */

.modal-content .btn-primary {
    width: 100%;
    box-sizing: border-box;
    font-size: 1.1rem;
    padding: 12px;
}


/* === Admin Panel === */

.admin-container {
    display: flex;
    max-width: 1400px;
    margin: 30px auto;
    gap: 20px;
}


/* Admin Side Navigation */

.admin-nav {
    flex: 0 0 220px;
    /* Do not grow, don't shrink, base width 220px */
    background-color: var(--white);
    border-radius: 10px;
    box-shadow: var(--shadow);
    padding: 20px;
    height: fit-content;
    /* Make it only as tall as its content */
}

.admin-nav h3 {
    margin: 0 0 15px;
    color: var(--dark-blue);
    border-bottom: 2px solid var(--light-blue);
    padding-bottom: 10px;
}

.admin-nav ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.admin-nav li a {
    display: block;
    padding: 12px 15px;
    text-decoration: none;
    color: var(--text-color);
    border-radius: 5px;
    margin-bottom: 5px;
    transition: background-color 0.3s;
}

.admin-nav li a:hover {
    background-color: var(--light-blue);
    color: var(--primary-blue);
}

.admin-nav li a.active-admin-nav {
    background-color: var(--primary-blue);
    color: var(--white);
    font-weight: bold;
}


/* Admin Main Content */

.admin-content {
    flex-grow: 1;
    /* Take up the remaining space */
}

.admin-content h2 {
    color: var(--dark-blue);
}

.admin-widget {
    background-color: var(--white);
    border-radius: 10px;
    box-shadow: var(--shadow);
    padding: 25px;
    margin-bottom: 25px;
}

.admin-widget h3 {
    margin: 0 0 20px;
    color: var(--dark-blue);
    border-bottom: 2px solid var(--light-blue);
    padding-bottom: 10px;
}


/* Admin Table Styling */

.table-container {
    max-height: 400px;
    overflow-y: auto;
    border: 1px solid #ddd;
    border-radius: 5px;
}

.admin-table {
    width: 100%;
    border-collapse: collapse;
}

.admin-table th,
.admin-table td {
    padding: 12px 15px;
    text-align: left;
    border-bottom: 1px solid #ddd;
}

.admin-table th {
    background-color: var(--light-blue);
    color: var(--dark-blue);
    position: sticky;
    /* Makes header stick when scrolling */
    top: 0;
}

.admin-table tbody tr:nth-child(even) {
    background-color: #f9f9f9;
}

.admin-table tbody tr:hover {
    background-color: #f1f1f1;
}


/* Style the "Active" nav link in the main header */

header nav a.active-nav {
    background-color: var(--primary-blue);
}


/* === Admin Manage Pages === */


/* Split layout for form and table */

.admin-layout-split {
    display: grid;
    grid-template-columns: 1fr 2fr;
    /* 1 part form, 2 parts table */
    gap: 25px;
}


/* Make sure widgets in this layout are full height */

.admin-layout-split>.admin-widget {
    height: 100%;
}


/* Admin Form Styling */

.admin-form .form-group {
    margin-bottom: 15px;
}

.admin-form label {
    display: block;
    margin-bottom: 5px;
    font-weight: bold;
    color: var(--text-color);
}

.admin-form input[type="text"],
.admin-form textarea {
    width: 100%;
    padding: 10px;
    border: 1px solid #ccc;
    border-radius: 5px;
    box-sizing: border-box;
    /* Important */
}

.admin-form textarea {
    resize: vertical;
    /* Allow user to resize height */
}


/* Small image preview in table */

.table-img {
    width: 70px;
    height: 50px;
    object-fit: cover;
    border-radius: 5px;
}


/* New Button Styles */

.btn-danger {
    background-color: #dc3545;
    /* Red */
    color: white;
    border: none;
    padding: 8px 12px;
    border-radius: 5px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: background-color 0.3s;
}

.btn-danger:hover {
    background-color: #c82333;
    /* Darker red */
}

.btn-secondary {
    background-color: #6c757d;
    /* Grey */
    color: white;
    border: none;
    padding: 8px 12px;
    border-radius: 5px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: background-color 0.3s;
}

.btn-secondary:hover {
    background-color: #5a6268;
    /* Darker grey */
}


/* Responsive fix for smaller screens */

@media (max-width: 900px) {
    .admin-layout-split {
        grid-template-columns: 1fr;
        /* Stack form and table */
    }
}


/* === Admin Manage Users === */

.status-admin,
.status-user {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 15px;
    font-size: 0.8rem;
    font-weight: bold;
    color: var(--white);
}

.status-admin {
    background-color: var(--primary-blue);
}

.status-user {
    background-color: #6c757d;
    /* Grey */
}


/* Style for disabled buttons */

button:disabled {
    background-color: #a0a0a0;
    cursor: not-allowed;
    opacity: 0.7;
}


/* === Admin Edit Plan === */

.back-link {
    display: inline-block;
    margin-bottom: 20px;
    color: var(--primary-blue);
    text-decoration: none;
    font-weight: bold;
}

.back-link:hover {
    text-decoration: underline;
}


/* Form <select> styling */

.admin-form select {
    width: 100%;
    padding: 10px;
    border: 1px solid #ccc;
    border-radius: 5px;
    box-sizing: border-box;
    background-color: white;
    /* Ensure it's not transparent */
}


/* === New Dashboard Layout === */

.dashboard-grid {
    display: grid;
    grid-template-columns: 2fr 1fr;
    /* 2/3 calendar, 1/3 list */
    gap: 25px;
    align-items: flex-start;
    /* Stop columns from stretching */
}


/* === Calendar === */

.calendar-table {
    width: 100%;
    border-collapse: collapse;
}

.calendar-table th {
    text-align: center;
    padding: 10px;
    background-color: var(--light-blue);
    color: var(--dark-blue);
    font-size: 0.9rem;
}

.calendar-table td {
    width: 14.28%;
    /* 1/7th of the width */
    height: 100px;
    border: 1px solid #eee;
    padding: 4px;
    vertical-align: top;
    transition: background-color 0.2s;
}

.calendar-table td.empty {
    background-color: #fcfcfc;
}

.calendar-day {
    cursor: pointer;
}

.calendar-day:hover {
    background-color: var(--light-blue);
}

.day-number {
    font-size: 0.8rem;
    font-weight: bold;
    color: #555;
    text-align: right;
}

.calendar-day.today {
    background-color: #fff9e6;
    border: 2px solid #ffc107;
}

.calendar-day.today .day-number {
    color: #e89c00;
    font-weight: bold;
}


/* Calendar activity dots */

.day-content {
    margin-top: 5px;
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
}

.workout-dot,
.note-dot {
    display: block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
}

.workout-dot {
    background-color: var(--primary-blue);
    /* Blue for workout */
}

.note-dot {
    background-color: #28a745;
    /* Green for note */
}


/* === Workout Checklist === */

.workout-checklist {
    list-style: none;
    padding: 0;
    margin: 0;
    max-height: 500px;
    /* Make it scrollable */
    overflow-y: auto;
}

.workout-checklist li {
    display: flex;
    align-items: center;
    padding: 10px 0;
    border-bottom: 1px solid #eee;
}

.workout-checklist li:last-child {
    border-bottom: none;
}

.check-icon {
    font-size: 1rem;
    margin-right: 10px;
}

.workout-name {
    font-weight: bold;
    color: var(--text-color);
}

.workout-time {
    font-size: 0.8rem;
    color: #777;
    margin-left: auto;
    /* Pushes to the right */
}


/* Responsive fix for dashboard */

@media (max-width: 900px) {
    .dashboard-grid {
        grid-template-columns: 1fr;
        /* Stack columns */
    }
}


/* === Calendar Navigation === */

.calendar-nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 10px 20px 10px;
    border-bottom: 2px solid var(--light-blue);
    margin-bottom: 15px;
}

.calendar-nav h3 {
    margin: 0;
    color: var(--dark-blue);
}

.calendar-nav a.btn-secondary {
    text-decoration: none;
    padding: 8px 15px;
    font-size: 0.9rem;
}


/* === Feedback Modal === */

.feedback-rating {
    display: flex;
    justify-content: center;
    gap: 15px;
    margin: 20px 0 30px;
}

.dumbbell {
    font-size: 2.5rem;
    cursor: pointer;
    opacity: 0.3;
    /* Default: greyed out */
    transition: all 0.2s ease;
}

.dumbbell.active {
    opacity: 1;
    /* Active: full color */
    transform: scale(1.1);
}

.dumbbell:hover {
    opacity: 0.6;
}