/* Reset and base styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    background-color: #f5f5f7;
    color: #1d1d1f;
    line-height: 1.5;
    min-height: 100vh;
}

.container {
    max-width: 800px;
    margin: 0 auto;
    padding: 1rem;
}

/* Typography */
h1 {
    font-size: 1.75rem;
    font-weight: 600;
}

h2 {
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 1rem;
}

h3 {
    font-size: 1rem;
    font-weight: 600;
}

/* Buttons */
.btn {
    display: inline-block;
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 500;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: center;
}

.btn-primary {
    background-color: #4f46e5;
    color: white;
}

.btn-primary:hover {
    background-color: #4338ca;
}

.btn-secondary {
    background-color: #e5e5e5;
    color: #1d1d1f;
}

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

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

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

.btn-text {
    background: none;
    color: #6b7280;
    padding: 0.5rem;
}

.btn-text:hover {
    color: #1d1d1f;
}

.btn-small {
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
}

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

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

input[type="text"],
input[type="number"],
input[type="password"],
select {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    font-size: 1rem;
    transition: border-color 0.2s ease;
}

input:focus,
select:focus {
    outline: none;
    border-color: #4f46e5;
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}

/* Flash messages */
.flash-messages {
    margin-bottom: 1rem;
}

.flash {
    padding: 1rem;
    border-radius: 8px;
    margin-bottom: 0.5rem;
}

.flash-error {
    background-color: #fef2f2;
    color: #dc2626;
    border: 1px solid #fecaca;
}

.flash-success {
    background-color: #f0fdf4;
    color: #16a34a;
    border: 1px solid #bbf7d0;
}

/* Landing page */
.landing {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 80vh;
    text-align: center;
}

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

.landing-header h1 {
    font-size: 2.5rem;
    color: #4f46e5;
    margin-bottom: 0.5rem;
}

.tagline {
    color: #6b7280;
    font-size: 1.125rem;
}

.auth-card {
    background: white;
    padding: 2rem;
    border-radius: 16px;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    width: 100%;
    max-width: 400px;
}

.auth-card h2 {
    text-align: center;
    margin-bottom: 1.5rem;
}

.auth-card .btn {
    width: 100%;
}

.auth-divider {
    display: flex;
    align-items: center;
    margin: 1.5rem 0;
}

.auth-divider::before,
.auth-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background-color: #e5e5e5;
}

.auth-divider span {
    padding: 0 1rem;
    color: #6b7280;
    font-size: 0.875rem;
}

/* Page header */
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 2rem;
    flex-wrap: wrap;
    gap: 1rem;
}

.header-title .back-link {
    color: #6b7280;
    text-decoration: none;
    font-size: 0.875rem;
    display: block;
    margin-bottom: 0.25rem;
}

.header-title .back-link:hover {
    color: #4f46e5;
}

.header-actions {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

/* Section header */
.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

/* Workout list */
.workout-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.workout-card {
    display: flex;
    align-items: center;
    background: white;
    padding: 1rem;
    border-radius: 12px;
    text-decoration: none;
    color: inherit;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.workout-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.workout-date {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding-right: 1rem;
    border-right: 1px solid #e5e5e5;
    min-width: 60px;
}

.workout-date .day {
    font-size: 1.5rem;
    font-weight: 600;
    color: #4f46e5;
}

.workout-date .month {
    font-size: 0.75rem;
    color: #6b7280;
}

.workout-info {
    flex: 1;
    padding: 0 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.workout-recap {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    margin-top: 0.5rem;
    font-size: 0.875rem;
}

.exercise-recap {
    color: #6b7280;
}

.exercise-recap strong {
    color: #1d1d1f;
    font-weight: 500;
}

.set-recap {
    display: inline;
}

.workout-time {
    font-size: 0.875rem;
    color: #6b7280;
}

.workout-exercises {
    font-weight: 500;
}

.workout-weight {
    text-align: right;
}

.workout-weight .weight-value {
    display: block;
    font-size: 1.25rem;
    font-weight: 600;
    color: #4f46e5;
}

.workout-weight .weight-unit {
    font-size: 0.75rem;
    color: #6b7280;
}

/* Empty state */
.empty-state {
    text-align: center;
    padding: 3rem;
    background: white;
    border-radius: 12px;
    color: #6b7280;
}

.empty-state .btn {
    margin-top: 1rem;
}

/* Workout summary */
.workout-summary {
    display: flex;
    gap: 1rem;
    margin-bottom: 2rem;
}

.summary-stat {
    flex: 1;
    background: white;
    padding: 1.5rem;
    border-radius: 12px;
    text-align: center;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.summary-stat .stat-value {
    display: block;
    font-size: 2rem;
    font-weight: 600;
    color: #4f46e5;
}

.summary-stat .stat-label {
    color: #6b7280;
    font-size: 0.875rem;
}

/* Body weight form */
.body-weight-stat {
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.body-weight-form {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
}

.body-weight-form label {
    color: #6b7280;
    font-size: 0.875rem;
}

.body-weight-input-group {
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.body-weight-input {
    width: 70px;
    padding: 0.5rem;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    font-size: 1.25rem;
    font-weight: 600;
    text-align: center;
    color: #4f46e5;
}

.body-weight-unit {
    color: #6b7280;
    font-size: 0.875rem;
}

/* Checkbox label */
.checkbox-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.875rem;
    color: #374151;
    cursor: pointer;
    white-space: nowrap;
}

.checkbox-label input[type="checkbox"] {
    width: 1rem;
    height: 1rem;
    cursor: pointer;
}

/* Exercise card */
.exercises-section {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.exercise-card {
    background: white;
    padding: 1.5rem;
    border-radius: 12px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

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

.sets-table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 1rem;
}

.sets-table th,
.sets-table td {
    padding: 0.5rem;
    text-align: left;
    border-bottom: 1px solid #e5e5e5;
}

.sets-table th {
    font-weight: 500;
    color: #6b7280;
    font-size: 0.875rem;
}

.no-sets {
    color: #6b7280;
    font-style: italic;
    margin-bottom: 1rem;
}

.add-set-form {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    align-items: center;
}

.set-form {
    display: flex;
    gap: 0.5rem;
    flex: 1;
}

.set-form input {
    width: 100px;
}

/* Add exercise card */
.add-exercise-card {
    background: white;
    padding: 1.5rem;
    border-radius: 12px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    border: 2px dashed #d1d5db;
}

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

/* Stats page */
.stats-overview {
    display: flex;
    gap: 1rem;
    margin-bottom: 2rem;
}

.stat-card {
    flex: 1;
    background: white;
    padding: 1.5rem;
    border-radius: 12px;
    text-align: center;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.stat-card .stat-value {
    display: block;
    font-size: 2rem;
    font-weight: 600;
    color: #4f46e5;
}

.stat-card .stat-label {
    color: #6b7280;
    font-size: 0.875rem;
}

.chart-section {
    background: white;
    padding: 1.5rem;
    border-radius: 12px;
    margin-bottom: 1.5rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.chart-container {
    width: 100%;
    min-height: 150px;
    overflow-x: auto;
}

.empty-chart {
    text-align: center;
    color: #6b7280;
    padding: 2rem;
}

.exercise-stats-section {
    background: white;
    padding: 1.5rem;
    border-radius: 12px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.table-responsive {
    overflow-x: auto;
}

.stats-table {
    width: 100%;
    border-collapse: collapse;
}

.stats-table th,
.stats-table td {
    padding: 0.75rem;
    text-align: left;
    border-bottom: 1px solid #e5e5e5;
}

.stats-table th {
    font-weight: 500;
    color: #6b7280;
    font-size: 0.875rem;
    white-space: nowrap;
}

.stats-table tbody tr:hover {
    background-color: #f9fafb;
}

/* Utility classes */
.inline-form {
    display: inline;
}

/* Date form */
.date-form {
    display: flex;
    gap: 0.5rem;
    align-items: center;
    margin-top: 0.5rem;
}

.date-input {
    padding: 0.5rem;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    font-size: 0.875rem;
}

/* Responsive design */
@media (max-width: 600px) {
    .container {
        padding: 0.75rem;
    }

    h1 {
        font-size: 1.5rem;
    }

    .page-header {
        flex-direction: column;
    }

    .header-actions {
        width: 100%;
        justify-content: flex-end;
    }

    .workout-card {
        flex-wrap: wrap;
    }

    .workout-date {
        border-right: none;
        border-bottom: 1px solid #e5e5e5;
        padding-right: 0;
        padding-bottom: 0.5rem;
        margin-bottom: 0.5rem;
        width: 100%;
        flex-direction: row;
        justify-content: space-between;
    }

    .workout-info {
        padding: 0;
        width: 100%;
    }

    .workout-weight {
        width: 100%;
        text-align: left;
        margin-top: 0.5rem;
        padding-top: 0.5rem;
        border-top: 1px solid #e5e5e5;
    }

    .workout-summary {
        flex-direction: column;
    }

    .stats-overview {
        flex-direction: column;
    }

    .add-set-form {
        flex-direction: column;
        align-items: stretch;
    }

    .set-form {
        flex-direction: column;
    }

    .set-form input {
        width: 100%;
    }

    .sets-table {
        font-size: 0.875rem;
    }

    .sets-table th,
    .sets-table td {
        padding: 0.375rem;
    }

    .date-form {
        flex-direction: column;
        align-items: stretch;
    }

    .date-input {
        width: 100%;
    }

    .checkbox-label {
        width: 100%;
        justify-content: flex-start;
    }

    .set-form .weight-input {
        width: 100%;
    }
}
