/* Pages événements, inscriptions, compte membre et leurs pages d'administration */

/* Boutons de base (spécificité nulle : le style admin, s'il est chargé, reste prioritaire) */
:where(.btn) {
    display: inline-block;
    padding: 10px 18px;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    background: var(--background-alt-color);
    color: var(--text-color);
}

:where(.btn-success) {
    background: #1e7e34;
    color: #fff;
}

:where(.btn-danger) {
    background: #c82333;
    color: #fff;
}

:where(.btn-secondary) {
    background: var(--secondary-color-light);
    color: var(--text-inverted-color);
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn.btn-small {
    padding: 5px 10px;
    font-size: 13px;
}

/* Messages */
.events-message {
    margin: 12px 0;
    padding: 10px 14px;
    border-radius: 6px;
    border-left: 4px solid var(--info-color);
    background: #eef4ff;
    white-space: pre-line;
}

.events-message-success {
    border-color: var(--success-color);
    background: #ecfdf3;
}

.events-message-error {
    border-color: var(--error-color);
    background: #fef2f2;
}

.events-hint {
    color: var(--text-muted-color);
    font-size: 0.92em;
}

/* Cartes d'événements */
.events-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 16px;
    margin: 16px 0;
}

.event-card {
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 16px;
    border-radius: 10px;
    background: var(--surface-color);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    border-top: 4px solid var(--primary-color);

    h3 {
        margin: 0;
    }

    p {
        margin: 0;
    }

    .btn {
        margin-top: auto;
        align-self: flex-start;
    }
}

.event-type {
    align-self: flex-start;
    padding: 2px 10px;
    border-radius: 12px;
    font-size: 0.8em;
    font-weight: 600;
    background: var(--secondary-color);
    color: var(--secondary-text-color);
}

.event-type-formation {
    background: var(--info-color);
    color: #fff;
}

.event-type-match {
    background: var(--accent-color);
    color: #fff;
}

.event-description {
    white-space: pre-line;
}

.event-meta {
    color: var(--text-muted-color);
    font-size: 0.9em;
}

.event-registered {
    color: #1e7e34;
    font-weight: 600;
}

.event-closed {
    color: var(--text-muted-color);
    font-style: italic;
}

.event-details {
    margin-bottom: 12px;
}

/* Formulaires */
.events-form {
    display: flex;
    flex-direction: column;
    gap: 12px;
    max-width: 900px;

    label {
        display: flex;
        flex-direction: column;
        gap: 4px;
        font-weight: 600;
    }

    label.checkbox-line {
        flex-direction: row;
        align-items: center;
        font-weight: normal;
    }

    input:not([type=checkbox]),
    select,
    textarea {
        padding: 8px 10px;
        border: 1px solid #cbd5e1;
        border-radius: 6px;
        font: inherit;
        font-weight: normal;
    }

    fieldset {
        border: 1px solid #e2e8f0;
        border-radius: 8px;
        padding: 12px 16px;
        display: flex;
        flex-direction: column;
        gap: 10px;
    }

    legend {
        font-weight: 700;
        padding: 0 6px;
    }
}

.form-row {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;

    > label {
        flex: 1 1 180px;
    }

    > label.grow {
        flex: 3 1 260px;
    }
}

.form-buttons {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
    margin: 12px 0;
}

.account-forms {
    max-width: 480px;

    form[hidden] {
        display: none;
    }
}

.account-switch {
    margin-top: 4px;
    text-align: center;
}

.account-header {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
}

/* Éditeurs de lignes (rôles, questions) */
.editor-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    padding: 6px 0;
    border-bottom: 1px dashed #e2e8f0;

    .role-name,
    .field-label {
        flex: 2 1 200px;
    }

    .field-options {
        flex: 2 1 200px;
    }
}

/* Tableaux */
.table-scroll {
    overflow-x: auto;
}

.admin-table {
    width: 100%;
    border-collapse: collapse;

    th,
    td {
        padding: 6px 8px;
        border-bottom: 1px solid #e2e8f0;
        text-align: left;
        vertical-align: top;
    }

    td.actions {
        white-space: nowrap;

        .btn {
            margin: 2px;
        }
    }
}

.registrants-table {
    input,
    select {
        width: 100%;
        min-width: 110px;
        padding: 5px 6px;
        border: 1px solid #cbd5e1;
        border-radius: 4px;
        font: inherit;
    }

    .reg-answers {
        max-width: 240px;
        font-size: 0.85em;
        white-space: pre-line;
        color: var(--text-muted-color);
    }
}

.registrants-count {
    font-weight: 600;
}

.badge-account {
    display: inline-block;
    margin-top: 2px;
    background: var(--info-color);
    color: #fff;
}

.badge-success {
    background: #dcfce7;
    color: #166534;
}

.badge-muted {
    background: #e5e7eb;
    color: #4b5563;
}

.member-roles {
    width: 100%;
    min-width: 200px;
    padding: 5px 6px;
}

.ical-link a {
    font-weight: 600;
}
