/* ===================================
   CSS Reset and Global Styles
   =================================== */

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

:root {
    /* Color Palette */
    --primary-color: #4CAF50;
    --primary-dark: #45a049;
    --secondary-color: #2196F3;
    --danger-color: #f44336;
    --danger-dark: #da190b;
    --text-color: #333;
    --text-light: #666;
    --bg-color: #f5f5f5;
    --white: #ffffff;
    --border-color: #ddd;
    --shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    --shadow-hover: 0 4px 12px rgba(0, 0, 0, 0.15);
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    line-height: 1.6;
    color: var(--text-color);
    background-color: var(--bg-color);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* ===================================
   Container
   =================================== */

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

/* ===================================
   Navigation Bar
   =================================== */

.navbar {
    background-color: var(--white);
    box-shadow: var(--shadow);
    position: sticky;
    top: 0;
    z-index: 100;
}

.navbar .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 20px;
}

.logo {
    font-size: 1.8rem;
    font-weight: bold;
    color: var(--primary-color);
}

.nav-links {
    list-style: none;
    display: flex;
    gap: 2rem;
}

.nav-links a {
    text-decoration: none;
    color: var(--text-color);
    font-weight: 500;
    transition: color 0.3s ease;
    padding: 0.5rem 1rem;
    border-radius: 4px;
}

.nav-links a:hover {
    color: var(--primary-color);
    background-color: rgba(76, 175, 80, 0.1);
}

.nav-links a.active {
    color: var(--primary-color);
    background-color: rgba(76, 175, 80, 0.15);
}

/* ===================================
   Main Content
   =================================== */

main {
    flex: 1;
    padding: 2rem 20px;
}

h2 {
    color: var(--text-color);
    font-size: 2rem;
    margin-bottom: 0.5rem;
}

h3 {
    color: var(--text-color);
    font-size: 1.5rem;
    margin-bottom: 1rem;
}

.subtitle {
    color: var(--text-light);
    margin-bottom: 2rem;
}

/* ===================================
   Dashboard Styles
   =================================== */

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

.dashboard-header h2 {
    margin-bottom: 0;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.stat-card {
    background-color: var(--white);
    padding: 2rem;
    border-radius: 8px;
    box-shadow: var(--shadow);
    text-align: center;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.stat-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-hover);
}

.stat-card-wide {
    grid-column: span 2;
    text-align: left;
}

.stat-number {
    font-size: 3rem;
    font-weight: bold;
    color: var(--primary-color);
    margin-bottom: 0.5rem;
}

.stat-label {
    font-size: 1.1rem;
    color: var(--text-light);
    font-weight: 500;
    margin-bottom: 1rem;
}

.goals-breakdown {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.goal-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.5rem;
    background-color: rgba(76, 175, 80, 0.05);
    border-radius: 4px;
}

.goal-label {
    font-weight: 500;
    color: var(--text-color);
}

.goal-value {
    font-weight: bold;
    color: var(--primary-color);
    font-size: 1.2rem;
}

/* Quick Actions */
.quick-actions {
    background-color: var(--white);
    padding: 2rem;
    border-radius: 8px;
    box-shadow: var(--shadow);
}

.action-buttons {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
}

/* ===================================
   Modal Styles
   =================================== */

.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0, 0, 0, 0.5);
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

.modal-content {
    background-color: var(--white);
    margin: 5% auto;
    padding: 2rem;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    max-width: 600px;
    width: 90%;
    position: relative;
    animation: slideDown 0.3s ease;
}

@keyframes slideDown {
    from {
        transform: translateY(-50px);
        opacity: 0;
    }

    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.close {
    position: absolute;
    right: 1.5rem;
    top: 1.5rem;
    color: var(--text-light);
    font-size: 2rem;
    font-weight: bold;
    cursor: pointer;
    transition: color 0.3s ease;
}

.close:hover,
.close:focus {
    color: var(--text-color);
}

/* ===================================
   Form Styles (New Client Page)
   =================================== */

.form-container {
    background-color: var(--white);
    padding: 2rem;
    border-radius: 8px;
    box-shadow: var(--shadow);
    max-width: 600px;
    margin: 0 auto;
}

.client-form {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.form-group {
    display: flex;
    flex-direction: column;
}

.form-group label {
    font-weight: 500;
    margin-bottom: 0.5rem;
    color: var(--text-color);
}

.form-group input,
.form-group select {
    padding: 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    font-size: 1rem;
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

.form-group input:focus,
.form-group select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(76, 175, 80, 0.1);
}

/* Form validation styles */
.error-message {
    color: var(--danger-color);
    font-size: 0.875rem;
    margin-top: 0.25rem;
    display: block;
    min-height: 1.2rem;
}

.input-error {
    border-color: var(--danger-color) !important;
    box-shadow: 0 0 0 3px rgba(244, 67, 54, 0.1) !important;
}

.success-message {
    background-color: rgba(76, 175, 80, 0.1);
    color: var(--primary-color);
    padding: 1rem;
    border-radius: 4px;
    border-left: 4px solid var(--primary-color);
    font-weight: 500;
    margin-bottom: 1rem;
}

.form-header {
    margin-bottom: 2rem;
}

.form-buttons {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
}

.form-buttons .btn {
    flex: 1;
    min-width: 120px;
    text-align: center;
    text-decoration: none;
    display: inline-block;
}

/* Client list header */
.client-list-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    flex-wrap: wrap;
    gap: 1rem;
}

.client-list-header h2 {
    margin-bottom: 0.5rem;
}

/* ===================================
   Buttons
   =================================== */

.btn {
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 4px;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: background-color 0.3s ease, transform 0.1s ease;
}

.btn:active {
    transform: translateY(1px);
}

.btn-primary {
    background-color: var(--primary-color);
    color: var(--white);
}

.btn-primary:hover {
    background-color: var(--primary-dark);
}

.btn-secondary {
    background-color: var(--text-light);
    color: var(--white);
    margin-left: 1rem;
}

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

/* ===================================
   Client List Styles
   =================================== */

.client-list-container {
    background-color: var(--white);
    padding: 2rem;
    border-radius: 8px;
    box-shadow: var(--shadow);
}

/* Search Box */
.search-container {
    margin-bottom: 1.5rem;
}

.search-input {
    width: 100%;
    max-width: 400px;
    padding: 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    font-size: 1rem;
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

.search-input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(76, 175, 80, 0.1);
}

/* Table Container */
.table-container {
    overflow-x: auto;
}

.client-table {
    width: 100%;
    border-collapse: collapse;
    background-color: var(--white);
}

.client-table thead {
    background-color: var(--primary-color);
    color: var(--white);
}

.client-table th,
.client-table td {
    padding: 1rem;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}

.client-table th {
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.9rem;
    letter-spacing: 0.5px;
}

.client-table tbody tr {
    transition: background-color 0.2s ease;
}

.client-table tbody tr:hover {
    background-color: rgba(76, 175, 80, 0.05);
}

/* Action Buttons */
.btn-action {
    padding: 0.4rem 0.8rem;
    border: none;
    border-radius: 4px;
    font-size: 0.85rem;
    cursor: pointer;
    margin-right: 0.5rem;
    transition: all 0.3s ease;
}

.btn-edit {
    background-color: var(--secondary-color);
    color: var(--white);
}

.btn-edit:hover {
    background-color: #0b7dda;
}

.btn-delete {
    background-color: var(--danger-color);
    color: var(--white);
}

.btn-delete:hover {
    background-color: var(--danger-dark);
}

/* ===================================
   Footer
   =================================== */

footer {
    background-color: var(--white);
    padding: 1.5rem 0;
    text-align: center;
    border-top: 1px solid var(--border-color);
    margin-top: auto;
}

footer p {
    color: var(--text-light);
    font-size: 0.9rem;
}

/* ===================================
   Responsive Design
   =================================== */

/* Tablet Styles (768px and below) */
@media screen and (max-width: 768px) {
    .navbar .container {
        flex-direction: column;
        gap: 1rem;
    }

    .nav-links {
        gap: 1rem;
    }

    .form-container {
        padding: 1.5rem;
    }

    h2 {
        font-size: 1.5rem;
    }

    .btn-secondary {
        margin-left: 0;
        margin-top: 0.5rem;
    }

    .client-form {
        gap: 1rem;
    }

    /* Dashboard responsive */
    .dashboard-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .stats-grid {
        grid-template-columns: 1fr;
    }

    .stat-card-wide {
        grid-column: span 1;
    }

    /* Make table responsive */
    .client-table {
        font-size: 0.9rem;
    }

    .client-table th,
    .client-table td {
        padding: 0.75rem;
    }

    /* Modal responsive */
    .modal-content {
        margin: 10% auto;
        width: 95%;
        padding: 1.5rem;
    }
}

/* Mobile Styles (600px and below) */
@media screen and (max-width: 600px) {
    .container {
        padding: 0 15px;
    }

    main {
        padding: 1.5rem 15px;
    }

    .logo {
        font-size: 1.5rem;
    }

    .nav-links {
        flex-direction: row;
        gap: 0.5rem;
    }

    .nav-links a {
        padding: 0.4rem 0.8rem;
        font-size: 0.9rem;
    }

    .form-container {
        padding: 1rem;
    }

    /* Stack table on mobile */
    .client-table thead {
        display: none;
    }

    .client-table,
    .client-table tbody,
    .client-table tr,
    .client-table td {
        display: block;
        width: 100%;
    }

    .client-table tr {
        margin-bottom: 1.5rem;
        border: 1px solid var(--border-color);
        border-radius: 8px;
        padding: 1rem;
        background-color: var(--white);
    }

    .client-table td {
        padding: 0.5rem 0;
        border: none;
        text-align: right;
        position: relative;
        padding-left: 50%;
    }

    .client-table td::before {
        content: attr(data-label);
        position: absolute;
        left: 0;
        font-weight: 600;
        text-align: left;
        color: var(--text-color);
    }

    .client-table td[data-label="Actions"] {
        text-align: center;
        padding-left: 0;
    }

    .client-table td[data-label="Actions"]::before {
        content: "";
        display: none;
    }

    .btn-action {
        display: inline-block;
        margin: 0.25rem;
    }

    .search-input {
        max-width: 100%;
    }
}

/* Small Mobile (400px and below) */
@media screen and (max-width: 400px) {
    .logo {
        font-size: 1.3rem;
    }

    h2 {
        font-size: 1.3rem;
    }

    .btn {
        width: 100%;
        margin-left: 0 !important;
        margin-top: 0.5rem;
    }

    .btn-action {
        width: calc(50% - 0.5rem);
        margin: 0.25rem;
    }
}

/* ===================================
   Toast Notifications
   =================================== */

.notification-toast {
    position: fixed;
    top: 100px;
    right: -400px;
    min-width: 300px;
    max-width: 400px;
    background-color: var(--white);
    color: var(--text-color);
    padding: 1rem 1.5rem;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
    z-index: 10000;
    transition: right 0.3s ease;
    font-weight: 500;
    border-left: 4px solid var(--primary-color);
}

.notification-toast.show {
    right: 20px;
}

.notification-success {
    border-left-color: var(--primary-color);
    background-color: rgba(76, 175, 80, 0.1);
    color: var(--primary-color);
}

.notification-error {
    border-left-color: var(--danger-color);
    background-color: rgba(244, 67, 54, 0.1);
    color: var(--danger-color);
}

.notification-info {
    border-left-color: var(--secondary-color);
    background-color: rgba(33, 150, 243, 0.1);
    color: var(--secondary-color);
}

/* ===================================
   Clickable Table Rows
   =================================== */

.client-row {
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.client-row:hover {
    background-color: rgba(76, 175, 80, 0.08) !important;
}

/* ===================================
   Loading States
   =================================== */

.loading-spinner {
    text-align: center;
    padding: 3rem;
}

.spinner {
    border: 4px solid var(--border-color);
    border-top: 4px solid var(--primary-color);
    border-radius: 50%;
    width: 50px;
    height: 50px;
    animation: spin 1s linear infinite;
    margin: 0 auto 1rem;
}

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

.loading-spinner p {
    color: var(--text-light);
    font-size: 0.95rem;
}

/* ===================================
   Error State
   =================================== */

.error-state {
    text-align: center;
    padding: 2rem;
}

.error-state .error-message {
    color: var(--danger-color);
    margin-bottom: 1rem;
    font-size: 1.1rem;
}

.no-data {
    text-align: center;
    color: var(--text-light);
    padding: 2rem;
    font-style: italic;
}

/* ===================================
   Client Detail Page
   =================================== */

.client-detail-container {
    background-color: var(--white);
    padding: 2rem;
    border-radius: 8px;
    box-shadow: var(--shadow);
}

.client-info-card {
    background-color: var(--white);
    padding: 2rem;
    border-radius: 8px;
    box-shadow: var(--shadow);
    margin-bottom: 2rem;
}

.client-name {
    font-size: 2rem;
    color: var(--text-color);
    margin-bottom: 1rem;
}

.client-info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
    margin-bottom: 1.5rem;
}

.info-item {
    display: flex;
    flex-direction: column;
}

.info-label {
    font-size: 0.85rem;
    color: var(--text-light);
    font-weight: 600;
    margin-bottom: 0.25rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.info-value {
    font-size: 1.1rem;
    color: var(--text-color);
}

.fitness-goal-badge {
    display: inline-block;
    padding: 0.5rem 1rem;
    background-color: rgba(76, 175, 80, 0.1);
    color: var(--primary-color);
    border-radius: 20px;
    font-weight: 600;
    font-size: 0.95rem;
}

.client-actions {
    display: flex;
    gap: 1rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border-color);
    flex-wrap: wrap;
}

/* ===================================
   Training History Section
   =================================== */

.training-history-section {
    background-color: var(--white);
    padding: 2rem;
    border-radius: 8px;
    box-shadow: var(--shadow);
    margin-bottom: 2rem;
}

.training-history-section h3 {
    margin-bottom: 1rem;
}

/* ===================================
   Exercises Section
   =================================== */

.exercises-section {
    background-color: var(--white);
    padding: 2rem;
    border-radius: 8px;
    box-shadow: var(--shadow);
}

.exercises-section h3 {
    margin-bottom: 1.5rem;
    color: var(--text-color);
}

.exercises-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1.5rem;
}

.exercise-card {
    background-color: var(--bg-color);
    padding: 1.5rem;
    border-radius: 8px;
    border-left: 4px solid var(--primary-color);
    transition: all 0.3s ease;
    position: relative;
}

.exercise-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-hover);
}

.exercise-number {
    position: absolute;
    top: 1rem;
    right: 1rem;
    width: 30px;
    height: 30px;
    background-color: var(--primary-color);
    color: var(--white);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 0.9rem;
}

.exercise-card h4 {
    font-size: 1.2rem;
    color: var(--text-color);
    margin-bottom: 0.75rem;
    padding-right: 40px;
}

.exercise-description {
    color: var(--text-light);
    font-size: 0.95rem;
    line-height: 1.6;
    max-height: 150px;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ===================================
   Responsive Adjustments for New Features
   =================================== */

@media screen and (max-width: 768px) {
    .client-info-grid {
        grid-template-columns: 1fr;
    }

    .exercises-grid {
        grid-template-columns: 1fr;
    }

    .client-actions {
        flex-direction: column;
    }

    .client-actions .btn {
        width: 100%;
    }

    .notification-toast {
        right: -100%;
        left: 10px;
        max-width: calc(100% - 20px);
    }

    .notification-toast.show {
        right: auto;
        left: 10px;
    }
}