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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: rgb(241, 238, 238);
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

/* Navbar */
.main-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 2rem;
    background-color: #ffffff;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.menu-toggle {
    display: none;
}

#nav-logo {
    font-size: 1.5rem;
    font-weight: bold;
    color: dodgerblue;
    letter-spacing: 0.5px;
    white-space: nowrap;
}

.navbar {
    display: flex;
}

.nav-links {
    /* hide bullets */
    list-style: none;
    display: flex;
    align-items: center;
}

.nav-item {
    margin-left: 1.5rem;
    text-decoration: none;
    color: dimgray;
    font-weight: 500;
    padding: 0.5rem 0;
}

.nav-item:hover {
    color: dodgerblue;
}

.nav-item.active {
    color: dodgerblue;
    border-bottom: 2px solid dodgerblue;
}

.btn-logout:hover {
    background-color: darkred;
    color: white;
}

/* Footer */
.main-footer {
    background-color: #ffffff;
    padding: 1.5rem 2rem;
    text-align: center;
    color: dimgray;
    font-size: 0.9rem;
    border-top: 1px solid rgba(0, 0, 0, 0.05);
    box-shadow: 0 -2px 4px rgba(0, 0, 0, 0.03);
}

/* Dashboard */
.dashboard {
    padding: 2rem;
    flex: 1;
}

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

/* Motivational Marquee */
.motivation-marquee-container {
    position: relative;
    width: 100%;
    overflow: hidden;
    padding: 0.75rem 0;
    margin-bottom: 2rem;
}

.motivation-marquee-track {
    display: flex;
    width: max-content;
    animation: scroll-right 35s linear infinite;
}

.marquee-group {
    display: flex;
    align-items: center;
    justify-content: space-around;
    flex-shrink: 0;
    gap: 1.5rem;
    padding-right: 1.5rem;
}

.motivation-badge {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    background: #ffffff;
    border: 1px solid rgba(30, 144, 255, 0.12);
    border-radius: 50px;
    padding: 0.6rem 1.25rem;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.03);
    transition: all 0.25s ease;
    user-select: none;
}

.motivation-badge .text {
    font-size: 0.9rem;
    font-weight: 600;
    color: #333;
    white-space: nowrap;
    letter-spacing: 0.2px;
}

/* Micro-animations */
@keyframes scroll-right {
    0% {
        transform: translateX(-50%);
    }

    100% {
        transform: translateX(0);
    }
}

.dashboard-grid {
    display: flex;
    gap: 2rem;
    flex-wrap: wrap;
}

/* Cards */
.card {
    display: flex;
    flex-direction: column;
    background-color: white;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    padding: 1.5rem;
    flex: 1;
    min-width: 300px;
}

.card-footer {
    margin-top: auto;
    /* Push footer to the bottom of the card */
    padding-top: 1.5rem;
}

.card-title {
    font-size: 1.25rem;
    color: #333;
    font-weight: 600;
    margin-bottom: 1rem;
    border-bottom: 1px solid #eee;
    padding-bottom: 0.5rem;
}

/* Booking Card specific styles */
.booking-details {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.booking-info-row {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    color: #555;
    font-size: 0.95rem;
}

.booking-info-row .icon {
    font-size: 1.2rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
}

.status-badge {
    padding: 0.25rem 0.75rem;
    border-radius: 50px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    display: inline-block;
}

.status-badge.confirmed {
    background-color: #e2f9ec;
    color: #1e7e34;
}

.status-badge.pending {
    background-color: #fff3cd;
    color: #856404;
}

.btn-secondary {
    background-color: transparent;
    color: #dc3545;
    border: 1px solid #dc3545;
    padding: 0.5rem 1rem;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 500;
    transition: all 0.2s ease;
    width: 100%;
}

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

/* Login */
.login-container {
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100vh;
    background: linear-gradient(to bottom, #4f8eeb, #142a49);
}

.login-card {
    display: flex;
    flex-direction: column;
    background-color: white;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    padding: 1.5rem;
    width: 75vh;
}

.login-title {
    font-size: 1.2rem;
    margin-bottom: 1rem;
}

.login-info {
    font-size: 0.8rem;
    color: gray;
    margin-bottom: 1rem;
}

.form-group {
    margin-bottom: 1rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: #333;
}

.form-group input {
    width: 100%;
    padding: 0.5rem;
    border-radius: 6px;
    border: 1px solid #ccc;
}

.login-footer {
    margin-top: 1rem;
    text-align: center;
}

/* Buttons */
.btn-primary {
    background-color: dodgerblue;
    color: white;
    padding: 0.5rem 1rem;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 500;
    border: none;
}

.btn-primary:hover {
    background-color: white;
    color: dodgerblue;
    border: 1px solid dodgerblue;
}

.btn-logout {
    background: none;
    border: 1px solid darkred;
    color: darkred;
    padding: 0.5rem 1rem;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 500;
    margin-left: 1.5rem;
}

/* Profile Editor Styles */
.profile-avatar-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-bottom: 1.5rem;
}

.profile-avatar {
    width: 100px;
    height: 100px;
    background-color: #e2f0fe;
    border: 3px solid dodgerblue;
    color: white;
    font-size: 3rem;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 0.5rem;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    transition: transform 0.2s ease;
}

.profile-avatar:hover {
    transform: scale(1.05);
}

.avatar-picker {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1rem;
    flex-wrap: wrap;
    justify-content: center;
}

.avatar-option {
    font-size: 1.5rem;
    width: 45px;
    height: 45px;
    border-radius: 50%;
    border: 2px solid #ccc;
    background-color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.avatar-option:hover {
    transform: scale(1.1);
    border-color: dodgerblue;
}

.avatar-option.active {
    border-color: dodgerblue;
    background-color: #e2f0fe;
    box-shadow: 0 0 8px rgba(30, 144, 255, 0.4);
}

.form-group textarea,
.form-group select {
    width: 100%;
    padding: 0.5rem;
    border-radius: 6px;
    border: 1px solid #ccc;
    font-family: inherit;
    font-size: 1rem;
}

.form-group textarea {
    resize: vertical;
}

.form-group select {
    background-color: white;
}

.btn-secondary-outline {
    background-color: transparent;
    color: #555;
    border: 1px solid #ccc;
    padding: 0.5rem 1rem;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 500;
    transition: all 0.2s ease;
}

.btn-secondary-outline:hover {
    background-color: #eee;
    color: #333;
}

/* Workout & Utility styles */
.grid-full-width {
    grid-column: 1 / -1;
    text-align: center;
    color: #555;
}

.grid-center {
    justify-content: center;
}

.card-form {
    max-width: 600px;
    width: 100%;
    min-width: unset;
    flex: none;
}

.form-row {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
    margin-bottom: 1rem;
}

.form-row .form-group {
    flex: 1;
    margin-bottom: 0;
}

.form-row .form-group.col-half {
    min-width: 140px;
}

.form-row .form-group.col-third {
    min-width: 80px;
}

.card-footer-actions {
    display: flex;
    gap: 1rem;
    padding-top: 1.5rem;
    margin-top: 1rem;
    border-top: 1px solid #eee;
}

.card-footer-actions button {
    flex: 1;
}

/* ==========================================================================
   Media Queries & Responsive Design
   ========================================================================== */

/* --- Tablet Devices (max-width: 768px) --- */
@media screen and (max-width: 768px) {

    /* Main Header and Navigation Toggle */
    .main-header {
        position: relative;
        flex-direction: row;
        justify-content: space-between;
        align-items: center;
        padding: 1rem 1.5rem;
    }

    .menu-toggle {
        display: block;
        background: none;
        border: none;
        font-size: 1.75rem;
        cursor: pointer;
        color: dimgray;
        padding: 0.25rem 0.5rem;
        transition: color 0.2s ease;
    }

    .menu-toggle:hover {
        color: dodgerblue;
    }

    .navbar {
        display: none;
        /* Hidden by default on mobile/tablet */
        position: absolute;
        top: 100%;
        left: 0;
        width: 100%;
        background-color: #ffffff;
        box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
        padding: 1rem 1.5rem;
        z-index: 1000;
        flex-direction: column;
        border-top: 1px solid rgba(0, 0, 0, 0.05);
    }

    .navbar.active {
        display: flex;
        /* Toggle visibility via JS class */
    }

    .nav-links {
        width: 100%;
        flex-direction: column;
        align-items: center;
        gap: 0.75rem;
    }

    .nav-item {
        margin-left: 0;
        margin-right: 0;
        width: 100%;
        text-align: center;
        display: block;
        padding: 0.5rem 0;
        border-bottom: 1px solid rgba(0, 0, 0, 0.05);
    }

    .nav-item.active {
        border-bottom: 2px solid dodgerblue;
    }

    .btn-logout {
        margin-left: 0;
        margin-top: 0.5rem;
        width: 100%;
        text-align: center;
        box-sizing: border-box;
    }

    /* Dashboard Layout & Spacing adjustment */
    .dashboard {
        padding: 1.5rem 1rem;
    }

    .dashboard-header {
        flex-direction: column;
        gap: 1rem;
        text-align: center;
        margin-bottom: 1.5rem;
    }

    .dashboard-grid {
        gap: 1.25rem;
    }

    /* Responsive Cards */
    .card {
        min-width: 100%;
        /* Make cards span full width of container */
        margin-bottom: 1rem;
    }

    /* Override inline flex basis on Profile page cards to stack them vertically */
    .dashboard-grid>.card[style*="flex: 1"],
    .dashboard-grid>.card[style*="flex: 2"] {
        flex: 1 1 100% !important;
        min-width: 100% !important;
    }

    /* Login Screen Responsiveness */
    .login-container {
        padding: 1rem;
        min-height: 100dvh;
        /* Accounts for mobile browser dynamic UI address bar */
        height: auto;
        /* Prevents card truncation on short viewports */
    }

    .login-card {
        width: 100%;
        max-width: 480px;
        /* Constrains width cleanly on tablets instead of 75vh */
        padding: 1.5rem;
    }
}

/* --- Mobile Portrait Devices (max-width: 480px) --- */
@media screen and (max-width: 480px) {

    /* Tighter page spacing on small screens */
    .dashboard {
        padding: 1rem;
    }

    .card {
        padding: 1.25rem;
    }

    /* Form field layout stacking for readability on narrow mobile screens */
    .form-row {
        flex-direction: column;
        gap: 1rem;
    }

    .form-row .form-group.col-half,
    .form-row .form-group.col-third {
        min-width: 100%;
    }

    /* Vertically stacked full-width button actions in cards (Save / Cancel) */
    .card-footer-actions {
        flex-direction: column;
        gap: 0.75rem;
    }

    .card-footer-actions button {
        width: 100%;
    }

    /* Adjust profile avatar picker layout */
    .avatar-picker {
        gap: 0.35rem;
    }

    .avatar-option {
        width: 40px;
        height: 40px;
        font-size: 1.25rem;
    }
}