/* Variables */
:root {
    --primary-color: #1a1a1a;
    --background-color: #ffffff;
    --accent-color: #3498db;
    --error-color: #e74c3c;
    --success-color: #2ecc71;
    --border-color: #e1e1e1;
    --text-color: #333333;
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    line-height: 1.6;
    text-align: justify;
    color: var(--text-color);
    background-color: var(--background-color);
}

/* Layout */
.container {
    max-width: 1080px;
    margin: 0 auto;
    padding: 2rem;
}

/* Header */
header {
    margin-bottom: 2rem;
    text-align: center;
}

header h1 {
    color: var(--primary-color);
    font-size: 2.5rem;
    margin-bottom: 1rem;
}

/* Main content */
main {
    background-color: #ffffff;
    padding: 2rem;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}


/* Forms */
form {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

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

label {
    font-weight: 500;
    color: var(--primary-color);
}

input[type="text"],
input[type="email"],
input[type="tel"],
input[type="date"],
input[type="password"],
textarea {
    padding: 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    font-size: 1rem;
    transition: border-color 0.3s ease;
}

input:focus,
textarea:focus {
    outline: none;
    border-color: var(--accent-color);
}

button {
    background-color: var(--accent-color);
    color: white;
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 4px;
    font-size: 1rem;
    cursor: pointer;
    transition: background-color 0.3s ease;
}

button:hover {
    background-color: #2980b9;
}

/* Messages */
.errorlist {
    color: var(--error-color);
    list-style: none;
    margin-bottom: 1rem;
}

.success {
    color: var(--success-color);
    margin-bottom: 1rem;
}

/* Tables */
table {
    width: 100%;
    border-collapse: collapse;
    margin: 1rem 0;
}

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

th {
    background-color: #f8f9fa;
    font-weight: 600;
}

/* Links */
a {
    color: var(--accent-color);
    text-decoration: none;
    transition: color 0.3s ease;
}

a:hover {
    color: #2980b9;
}

hr {
    margin: 15px 0;;
}

/* Footer */
footer {
    margin-top: 2rem;
    text-align: center;
    color: #666;
    font-size: 0.9rem;
}

/* Login Page Styles */
.login-container {
    max-width: 400px;
    margin: 0 auto;
}

.form-info {
    text-align: center;
    margin-bottom: 2rem;
    color: var(--text-color);
}

.form-container {
    background: #fff;
    padding: 2rem;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

/* Message Styles */
.message-container {
    max-width: 600px;
    margin: 0 auto;
    text-align: center;
}

.success-message,
.info-message {
    padding: 2rem;
    border-radius: 8px;
    margin-bottom: 1.5rem;
}

.success-message {
    background-color: #e8f5e9;
    color: #2e7d32;
    border: 1px solid #c8e6c9;
}

.info-message {
    background-color: #e3f2fd;
    color: #1565c0;
    border: 1px solid #bbdefb;
}

.message {
    padding: 1rem;
    border-radius: 4px;
    margin-bottom: 1.5rem;
}

.message.info {
    background-color: #e3f2fd;
    color: #1565c0;
    border: 1px solid #bbdefb;
}

/* Form Styling Enhancements */
.form p {
    margin-bottom: 1rem;
}

.form label {
    display: block;
    margin-bottom: 0.5rem;
}

.form input[type="email"] {
    width: 100%;
}

.form button {
    width: 100%;
    margin-top: 1rem;
}

/* Course List Styles */
.course-list {
    margin-top: 2rem;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 2rem;
    max-width: 1200px;
    margin-left: auto;
    margin-right: auto;
}

.course {
    background-color: #ffffff;
    border: 1px solid var(--border-color);
    padding: 1.5rem;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    height: 100%;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.course-actions {
    display: flex;
    flex-direction: column;
    align-items: center;
}

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

.course h3 {
    margin: 0 0 1rem 0;
    color: var(--primary-color);
    font-size: 1.25rem;
}

/* Buttons */
.button {
    display: inline-block;
    padding: 0.75rem 1.5rem;
    color: white;
    text-decoration: none;
    border-radius: 4px;
    margin-right: 0.75rem;
    border: none;
    cursor: pointer;
    font-weight: 500;
    transition: background-color 0.3s ease, transform 0.2s ease;
}

.button:hover {
    transform: translateY(-1px);
}

.button.primary {
    background-color: var(--accent-color);
}

.button.enrolled {
    background-color: var(--success-color);
}

.button.unregister {
    background-color: #ffc107;
    color: #000;
}

.button.logout {
    background-color: var(--error-color);
}

.button[disabled] {
    background-color: var(--border-color);
    cursor: not-allowed;
    opacity: 0.7;
}

/* Alerts and Messages */
.messages {
    max-width: 800px;
    margin: 1.5rem auto;
}

.alert {
    padding: 1rem 1.5rem;
    margin-bottom: 1rem;
    border-radius: 4px;
    font-weight: 500;
}

.alert-success {
    background-color: #e8f5e9;
    color: #2e7d32;
    border: 1px solid #c8e6c9;
}

.alert-error {
    background-color: #ffebee;
    color: #c62828;
    border: 1px solid #ffcdd2;
}

/* Required Fields Styles */
.required {
    position: relative;
}

label.required:after {
    content: " *";
    color: var(--error-color);
}

.field-help-text {
    font-size: 0.875rem;
    color: #666;
    margin-top: 0.25rem;
}

/* Required Field Indicator */
.required-field::after {
    content: " *";
    color: var(--error-color);
    font-weight: bold;
    margin-left: 4px;
}

/* Form Validation Styles */
input:invalid,
textarea:invalid {
    border-color: var(--error-color);
    background-color: #fff5f5;
}

input:invalid:focus,
textarea:invalid:focus {
    border-color: var(--error-color);
    box-shadow: 0 0 0 2px rgba(231, 76, 60, 0.25);
}

/* Animation */
@keyframes flash {
    0% { opacity: 1; }
    50% { opacity: 0.5; }
    100% { opacity: 1; }
}

.spots-updating {
    animation: flash 1s ease;
}

/* Course Details */
.course-details {
    margin-bottom: 1.5rem;
    flex-grow: 1;
}

.course-actions {
    margin-top: auto;
    display: flex;
    gap: 0.75rem;
}

/* Section Headers */
h2 {
    color: var(--primary-color);
    margin: 2rem 0 1rem;
    text-align: center;
    font-size: 1.75rem;
}

/* Règlement Styles */
.pdf-download {
    text-align: center;
    margin: 2rem 0;
}

.pdf-download .button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 1rem 2rem;
    font-size: 1.1rem;
}

/* Button with Icon */
.button svg {
    display: inline-block;
    vertical-align: middle;
}

/* Responsive Design */
@media (max-width: 768px) {
    .container {
        padding: 1rem;
    }

    header h1 {
        font-size: 2rem;
    }

    main {
        padding: 1rem;
    }

    .course-list {
        grid-template-columns: 1fr;
        padding: 0 1rem;
    }

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

    .button {
        width: 100%;
        margin-right: 0;
        margin-bottom: 0.5rem;
        text-align: center;
    }
}
