/**
 * Terrain Nature — Registration Form Styles
 *
 * Responsive, accessible, mobile-first design.
 */

/* ─── Container ─── */
.tn-registration-form-wrap {
    max-width: 100%;
    margin: 0;
    padding: 0;
    background: transparent;
    border: none;
    border-radius: 0;
    box-shadow: none;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

.tn-form-title {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
    color: #1a1a1a;
}

/* ─── En-tête compact : places + tarif + montant ─── */
.tn-form-summary {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem 1.25rem;
    align-items: center;
    padding: 0.6rem 0.9rem;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    margin-bottom: 1rem;
    font-size: 0.9rem;
    color: #334155;
}
.tn-form-summary .tn-summary-item {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
}
.tn-form-summary .tn-summary-item strong {
    color: #0f172a;
}
.tn-form-summary .tn-summary-sep {
    color: #cbd5e1;
}

/* ─── Grille 2 colonnes (ordinateur) ─── */
.tn-form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.25rem;
    align-items: start;
}
.tn-form-col {
    min-width: 0;
}
.tn-form-section-title {
    font-size: 0.8rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: #475569;
    margin: 0 0 0.5rem;
    padding-bottom: 0.3rem;
    border-bottom: 1px solid #e2e8f0;
}
.tn-form-section-title:first-child {
    margin-top: 0;
}

/* ─── Cartes participants en grille ─── */
.tn-participants-list {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.5rem;
}
.tn-participant-card {
    padding: 0.5rem 0.7rem;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
}
.tn-participant-card .tn-participant-label {
    font-weight: 600;
    font-size: 0.75rem;
    color: #475569;
    display: block;
    margin-bottom: 0.25rem;
}
.tn-participant-card .tn-field-row {
    gap: 0.4rem;
}
.tn-participant-card .tn-field-half {
    min-width: 0;
}
.tn-participant-hint {
    font-size: 0.65rem;
    color: #94a3b8;
    margin: 0.15rem 0 0;
}

/* ─── Accordéon infos sensibles ─── */
.tn-sensitive-details {
    margin-top: 0.5rem;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    background: #fff;
    overflow: hidden;
}
.tn-sensitive-details > summary {
    list-style: none;
    cursor: pointer;
    padding: 0.5rem 0.75rem;
    font-size: 0.85rem;
    font-weight: 600;
    color: #334155;
    background: #f8fafc;
    display: flex;
    align-items: center;
    gap: 0.4rem;
    user-select: none;
}
.tn-sensitive-details > summary::-webkit-details-marker {
    display: none;
}
.tn-sensitive-details > summary::before {
    content: "▶";
    font-size: 0.7rem;
    color: #64748b;
    transition: transform 0.2s;
}
.tn-sensitive-details[open] > summary::before {
    transform: rotate(90deg);
}
.tn-sensitive-details[open] > summary {
    border-bottom: 1px solid #e2e8f0;
}
.tn-sensitive-body {
    padding: 0.6rem 0.75rem;
}
.tn-sensitive-hint {
    font-size: 0.72rem;
    color: #666;
    margin: 0.2rem 0 0.4rem;
    line-height: 1.4;
}

/* ─── RGPD : résumé + accordéon ─── */
.tn-rgpd-notice {
    margin-top: 1rem;
    padding: 0.7rem 0.9rem;
    background: #f8f9fa;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    font-size: 0.8rem;
    color: #555;
    line-height: 1.5;
}
.tn-rgpd-summary {
    margin: 0 0 0.4rem;
    color: #334155;
}
.tn-rgpd-details {
    margin-top: 0.3rem;
}
.tn-rgpd-details > summary {
    list-style: none;
    cursor: pointer;
    font-size: 0.8rem;
    font-weight: 600;
    color: #1565c0;
    padding: 0.2rem 0;
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
}
.tn-rgpd-details > summary::-webkit-details-marker {
    display: none;
}
.tn-rgpd-details > summary::before {
    content: "▶";
    font-size: 0.65rem;
    transition: transform 0.2s;
}
.tn-rgpd-details[open] > summary::before {
    transform: rotate(90deg);
}
.tn-rgpd-full {
    padding-top: 0.5rem;
}
.tn-rgpd-full p {
    margin: 0 0 0.3rem;
}

/* ─── Bouton final + montant ─── */
.tn-submit-row {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid #e2e8f0;
}
.tn-submit-amount {
    font-size: 1rem;
    font-weight: 700;
    color: #e65100;
    text-align: center;
    padding: 0.4rem 0.6rem;
    background: #fff8e1;
    border: 1px solid #ffe082;
    border-radius: 6px;
}
.tn-submit-amount:empty {
    display: none;
}

/* ─── Availability badges ─── */
.tn-availability {
    margin-bottom: 8px;
}

.tn-badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.02em;
}

.tn-badge-available {
    background: #e8f5e9;
    color: #2e7d32;
    border: 1px solid #a5d6a7;
}

.tn-badge-full {
    background: #fce4ec;
    color: #c62828;
    border: 1px solid #ef9a9a;
}

.tn-badge-open {
    background: #e3f2fd;
    color: #1565c0;
    border: 1px solid #90caf9;
}

/* ─── Notices ─── */
.tn-notice {
    padding: 8px 12px;
    border-radius: 6px;
    margin-bottom: 10px;
    font-size: 13px;
}

.tn-notice-info {
    background: #e3f2fd;
    border: 1px solid #90caf9;
    color: #0d47a1;
}

.tn-notice-warning {
    background: #fff3e0;
    border: 1px solid #ffcc80;
    color: #e65100;
}

/* ─── Form fields ─── */
.tn-field-group {
    margin-bottom: 8px;
}

.tn-label {
    display: block;
    margin-bottom: 2px;
    font-size: 13px;
    font-weight: 500;
    color: #333;
}

.tn-required {
    color: #c62828;
}

.tn-input {
    display: block;
    width: 100%;
    padding: 7px 10px;
    font-size: 14px;
    line-height: 1.4;
    color: #1a1a1a;
    background: #fafafa;
    border: 1px solid #ccc;
    border-radius: 5px;
    transition: border-color 0.2s, box-shadow 0.2s;
    box-sizing: border-box;
    -webkit-appearance: none;
    appearance: none;
}

.tn-input-sm {
    padding: 5px 8px;
    font-size: 13px;
    height: 32px;
}

.tn-input:focus {
    outline: none;
    border-color: #2e7d32;
    box-shadow: 0 0 0 3px rgba(46, 125, 50, 0.12);
    background: #fff;
}

.tn-input:invalid:not(:placeholder-shown) {
    border-color: #c62828;
}

.tn-input-number {
    width: 100%;
    text-align: center;
    font-size: 16px;
    font-weight: 600;
}

.tn-textarea {
    resize: vertical;
    min-height: 60px;
}

/* ─── Field row (side by side) ─── */
.tn-field-row {
    display: flex;
    gap: 12px;
}

.tn-field-half {
    flex: 1;
    min-width: 0;
}

/* ─── Submit button ─── */
.tn-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 24px;
    font-size: 15px;
    font-weight: 600;
    line-height: 1.4;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: background 0.2s, transform 0.1s, opacity 0.2s;
    -webkit-appearance: none;
    appearance: none;
    width: 100%;
}

.tn-btn:active {
    transform: scale(0.98);
}

.tn-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.tn-btn-primary {
    background: #2e7d32;
    color: #fff;
}

.tn-btn-primary:hover:not(:disabled) {
    background: #1b5e20;
}

/* ─── Message / feedback area ─── */
.tn-message {
    display: none;
    padding: 12px 16px;
    border-radius: 6px;
    margin-bottom: 16px;
    font-size: 14px;
    line-height: 1.5;
}

.tn-message.tn-message-success {
    display: block;
    background: #e8f5e9;
    border: 1px solid #a5d6a7;
    color: #2e7d32;
}

.tn-message.tn-message-error {
    display: block;
    background: #fce4ec;
    border: 1px solid #ef9a9a;
    color: #c62828;
}

/* ─── Error label ─── */
.tn-error {
    color: #c62828;
    font-size: 14px;
    padding: 12px;
    background: #fce4ec;
    border-radius: 6px;
}

/* ─── Loading spinner ─── */
.tn-spinner {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: #fff;
    border-radius: 50%;
    animation: tn-spin 0.6s linear infinite;
}

/* ─── Section publique injectée dans les pages d'événements ─── */
.tn-public-registration-section {
    /* Rester dans le flux du contenu du thème au lieu d'utiliser une
       technique de "breakout" (100vw + margin-left: calc(50% - 50vw))
       qui suppose que le conteneur parent est centré dans la fenêtre.
       Sur les pages The Events Calendar avec une sidebar, cette
       supposition est fausse et crée une bande vide à gauche + une
       barre de défilement horizontale. */
    width: 100%;
    max-width: 1100px;
    margin: 2rem 0;
    padding: 1.5rem;
    background: #fff;
    border-top: 1px solid #e2e8f0;
    border-bottom: 1px solid #e2e8f0;
    box-sizing: border-box;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

.tn-public-registration-title {
    margin: 0 0 1rem;
    font-size: 1.5rem;
    font-weight: 700;
    color: #0f172a;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid #10b981;
}

/* Messages de statut (annulé, terminé, complet, etc.) */
.tn-status-message {
    padding: 1rem 1.25rem;
    border-radius: 8px;
    border-left: 4px solid;
    margin: 0;
}

.tn-status-message p {
    margin: 0;
    font-size: 0.95rem;
    line-height: 1.6;
}

.tn-status-cancelled {
    background: #fee2e2;
    border-left-color: #dc2626;
    color: #991b1b;
}

.tn-status-past {
    background: #f1f5f9;
    border-left-color: #64748b;
    color: #334155;
}

.tn-status-pending {
    background: #fef9c3;
    border-left-color: #ca8a04;
    color: #854d0e;
}

.tn-status-full {
    background: #ffedd5;
    border-left-color: #ea580c;
    color: #9a3412;
}

@keyframes tn-spin {
    to {
        transform: rotate(360deg);
    }
}

/* ─── Responsive : tablette ─── */
@media (max-width: 900px) {
    .tn-form-grid {
        grid-template-columns: 1fr;
    }
    .tn-participants-list {
        grid-template-columns: 1fr 1fr;
    }
}

/* ─── Responsive : téléphone ─── */
@media (max-width: 600px) {
    .tn-public-registration-section {
        width: 100%;
        max-width: 100%;
        margin: 1rem 0;
        padding: 1rem;
        border-radius: 0;
    }

    .tn-public-registration-title {
        font-size: 1.2rem;
    }

    .tn-form-summary {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.3rem;
    }
    .tn-form-summary .tn-summary-sep {
        display: none;
    }

    .tn-form-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }

    .tn-participants-list {
        grid-template-columns: 1fr;
    }

    .tn-field-row {
        flex-direction: column;
        gap: 0;
    }

    .tn-btn {
        padding: 14px 20px;
        font-size: 16px;
    }

    .tn-input {
        font-size: 16px;
        /* Prevents iOS zoom on focus */
    }
}