:root {
    --cream: #ffffff;
    --ink: #16261e;
    --forest: #0b6b44;
    --forest-dark: #084d31;
    --forest-soft: #e7f3ec;
    --line: #e1e6e3;
    --danger: #b33f2f;
    --shadow: 0 4px 12px rgba(0, 0, 0, 0.06);
}





h1 {
    font-size: 1.5rem;
    color: var(--forest-dark);
    margin-bottom: 4px;
}

.subtitle {
    color: #4a5f55;
    margin-bottom: 24px;
    font-size: 0.95rem;
}

.layout {
    display: grid;
    grid-template-columns: minmax(320px, 480px) 1fr;
    gap: 24px;
    align-items: start;
}

@media (max-width: 900px) {
    .layout {
        grid-template-columns: 1fr;
    }
}

.panel {
    background: #fff;
    border-radius: 16px;
    border: 1px solid var(--line);
    padding: 20px;
    box-shadow: var(--shadow);
}

.panel h2 {
    font-size: 1.05rem;
    color: var(--forest-dark);
    margin: 0 0 14px;
}

.template-choice {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    margin-bottom: 20px;
}

.template-choice label {
    display: block;
    border: 2px solid var(--line);
    border-radius: 12px;
    padding: 12px 8px;
    text-align: center;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: border-color 0.2s, background 0.2s;
}

.template-choice input {
    display: none;
}

.template-choice input:checked+label {
    border-color: var(--forest);
    background: var(--forest-soft);
    color: var(--forest-dark);
}

fieldset {
    border: none;
    padding: 0;
    margin: 0 0 20px;
}

fieldset legend {
    font-weight: 600;
    color: var(--forest-dark);
    font-size: 0.9rem;
    margin-bottom: 8px;
    padding: 0;
}

label.field-label {
    display: block;
    font-size: 0.85rem;
    font-weight: 500;
    margin: 12px 0 4px;
    color: var(--ink);
}

input[type="text"],
input[type="url"],
input[type="password"],
textarea {
    width: 100%;
    padding: 9px 12px;
    border: 1px solid var(--line);
    border-radius: 8px;
    font-size: 0.9rem;
    
    color: var(--ink);
    background: #fafcfa;
    transition: border-color 0.2s;
}

input[type="text"]:focus,
input[type="url"]:focus,
input[type="password"]:focus,
textarea:focus {
    border-color: var(--forest);
    outline: none;
    box-shadow: 0 0 0 3px rgba(11, 107, 68, 0.1);
}

textarea {
    resize: vertical;
    min-height: 70px;
}

.hint {
    font-size: 0.78rem;
    color: #6b7d74;
    margin-top: 3px;
}

.repeat-block {
    border: 1px dashed var(--line);
    border-radius: 10px;
    padding: 12px;
    margin-top: 10px;
    position: relative;
    background: #fafcfa;
}

.repeat-block .remove-btn {
    position: absolute;
    top: 8px;
    right: 8px;
    background: none;
    border: none;
    color: var(--danger);
    font-size: 0.8rem;
    cursor: pointer;
    font-weight: 600;
}

.add-btn {
    margin-top: 10px;
    background: var(--forest-soft);
    color: var(--forest-dark);
    border: none;
    border-radius: 999px;
    padding: 8px 18px;
    font-weight: 600;
    font-size: 0.85rem;
    cursor: pointer;
    transition: background 0.2s;
}

.add-btn:hover {
    background: #d8ece1;
}

.checkbox-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 10px;
}

.actions {
    display: flex;
    gap: 12px;
    margin-top: 20px;
    flex-wrap: wrap;
}

.btn-primary,
.btn-secondary {
    border: none;
    border-radius: 999px;
    padding: 12px 26px;
    font-weight: 600;
    font-size: 0.95rem;
    cursor: pointer;
    transition: background 0.2s, transform 0.1s;
}

.btn-primary {
    background: var(--forest);
    color: #fff;
}

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

.btn-secondary {
    background: #fff;
    color: var(--forest-dark);
    border: 2px solid var(--forest);
}

.btn-secondary:hover {
    background: var(--forest-soft);
}

.btn-publish {
    background: var(--danger);
    color: #fff;
    border: none;
    border-radius: 999px;
    padding: 12px 26px;
    font-weight: 600;
    font-size: 0.95rem;
    cursor: pointer;
    transition: background 0.2s, transform 0.1s;
}

.btn-publish:hover {
    background: #8c2a1d;
}

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

.preview-panel {
    position: sticky;
    top: 24px;
    height: calc(100vh - 48px);
    display: flex;
    flex-direction: column;
}

.preview-panel iframe {
    flex: 1;
    width: 100%;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: #fff;
}

.status {
    font-size: 0.85rem;
    color: var(--forest-dark);
    margin-top: 8px;
    min-height: 18px;
    padding: 8px 12px;
    border-radius: 8px;
}

.status.success {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.status.error {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

/* ============================================================
   AMÉLIORATIONS DE L'INTERFACE
   ============================================================ */
fieldset legend::before {
    content: "▸ ";
    color: var(--forest);
    font-weight: 700;
}

.template-choice label:has(input:checked) {
    border-color: var(--forest);
    background: var(--forest-soft);
}

.repeat-block:first-of-type {
    margin-top: 0;
}

.repeat-block .remove-btn:hover {
    color: #8a1f12;
    transform: scale(1.1);
}

/* Scroll fluide pour l'aperçu */
.preview-panel iframe {
    scroll-behavior: smooth;
}

/* Petite animation sur les boutons */
.btn-primary:active,
.btn-secondary:active,
.btn-publish:active {
    transform: scale(0.97);
}

/* Champ de mot de passe (token) */
input[type="password"] {
    letter-spacing: 2px;
}

/* Responsive : ajustements supplémentaires */
@media (max-width: 600px) {
    

    .panel {
        padding: 14px;
    }

    .template-choice {
        grid-template-columns: 1fr;
        gap: 6px;
    }

    .actions {
        flex-direction: column;
    }

    .btn-primary,
    .btn-secondary,
    .btn-publish {
        width: 100%;
        text-align: center;
        justify-content: center;
    }

    .preview-panel {
        height: 400px;
        position: static;
    }
}

/* ============================================================
   STYLES OVERLAY AUTHENTIFICATION ADMIN & BARRE SUPÉRIEURE
   ============================================================ */
.auth-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(11, 38, 24, 0.88);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.auth-overlay.hidden {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

.auth-card {
    background: #ffffff;
    border-radius: 20px;
    padding: 36px 32px;
    width: 100%;
    max-width: 440px;
    box-shadow: 0 25px 60px rgba(0, 0, 0, 0.35), 0 0 0 1px rgba(255, 255, 255, 0.1);
    animation: authCardPop 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes authCardPop {
    from { opacity: 0; transform: scale(0.92) translateY(20px); }
    to { opacity: 1; transform: scale(1) translateY(0); }
}

.auth-header {
    text-align: center;
    margin-bottom: 24px;
}

.auth-icon {
    font-size: 2.2rem;
    background: #e7f3ec;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    margin: 0 auto 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 12px rgba(11, 107, 68, 0.15);
}

.auth-header h2 {
    font-size: 1.35rem;
    color: var(--forest-dark, #084d31);
    margin: 0 0 6px;
    font-weight: 700;
}

.auth-subtitle {
    font-size: 0.86rem;
    color: #5a6b63;
    margin: 0;
    line-height: 1.45;
}

/* Onglets Connexion / Inscription Membre Admin */
.auth-tabs {
    display: flex;
    background: #f4f8f6;
    border-radius: 12px;
    padding: 4px;
    margin-bottom: 20px;
    gap: 4px;
    border: 1px solid #d0e2d7;
}

.auth-tab-btn {
    flex: 1;
    padding: 9px;
    font-size: 0.83rem;
    font-weight: 600;
    border: none;
    border-radius: 8px;
    background: transparent;
    color: #5a6b63;
    cursor: pointer;
    transition: all 0.2s ease;
}

.auth-tab-btn.active {
    background: #084d31;
    color: #ffffff;
    box-shadow: 0 2px 8px rgba(8, 77, 49, 0.2);
}

.auth-notice-box {
    background: #e7f3ec;
    border-left: 4px solid #0b6b44;
    padding: 10px 12px;
    border-radius: 8px;
    font-size: 0.81rem;
    color: #084d31;
    margin-bottom: 16px;
    line-height: 1.4;
}

.auth-field {
    margin-bottom: 16px;
}

.auth-field label {
    display: block;
    font-size: 0.84rem;
    font-weight: 600;
    color: var(--forest-dark, #084d31);
    margin-bottom: 6px;
}

.input-with-icon {
    position: relative;
    display: flex;
    align-items: center;
}

.input-with-icon .icon {
    position: absolute;
    left: 12px;
    font-size: 1rem;
    pointer-events: none;
}

.input-with-icon input {
    width: 100%;
    padding: 10px 14px 10px 40px !important;
    border: 1.5px solid #cbd5d1 !important;
    border-radius: 10px !important;
    font-size: 0.92rem !important;
    background: #fafcfa !important;
    transition: all 0.2s ease !important;
}

.input-with-icon input:focus {
    border-color: var(--forest, #0b6b44) !important;
    background: #ffffff !important;
    box-shadow: 0 0 0 3.5px rgba(11, 107, 68, 0.15) !important;
    outline: none !important;
}

.auth-hint {
    font-size: 0.76rem;
    color: #6b7d74;
    margin: 4px 0 0;
}

.auth-hint code {
    background: #e7f3ec;
    color: #084d31;
    padding: 2px 6px;
    border-radius: 4px;
    font-weight: 600;
}

.auth-error-msg {
    background: #fdecec;
    color: #b42318;
    border: 1px solid #f3b4ae;
    padding: 10px 12px;
    border-radius: 10px;
    font-size: 0.85rem;
    margin-bottom: 16px;
    text-align: center;
    line-height: 1.4;
}

.auth-btn {
    width: 100%;
    padding: 13px;
    border: none;
    border-radius: 10px;
    background: linear-gradient(135deg, #0b6b44, #084d31);
    color: #ffffff;
    font-size: 0.98rem;
    font-weight: 600;
    cursor: pointer;
    margin-top: 8px;
    box-shadow: 0 4px 14px rgba(11, 107, 68, 0.3);
    transition: all 0.2s ease;
}

.auth-btn:hover {
    background: linear-gradient(135deg, #084d31, #053320);
    transform: translateY(-1px);
    box-shadow: 0 6px 18px rgba(11, 107, 68, 0.4);
}

.auth-btn:active {
    transform: translateY(0);
}

/* Barre d'en-tête admin */
.admin-topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #ffffff;
    padding: 16px 24px;
    border-radius: 14px;
    border: 1px solid var(--line, #e1e6e3);
    margin-bottom: 24px;
    box-shadow: var(--shadow, 0 4px 12px rgba(0,0,0,0.06));
    flex-wrap: wrap;
    gap: 16px;
}

.admin-topbar-info h1 {
    margin: 0 0 4px;
    font-size: 1.4rem;
}

.admin-topbar-info .subtitle {
    margin: 0;
    font-size: 0.88rem;
}

.admin-user-badge {
    display: flex;
    align-items: center;
    gap: 12px;
    background: #f4f8f6;
    padding: 8px 16px;
    border-radius: 999px;
    border: 1px solid #d0e2d7;
    font-size: 0.85rem;
}

.admin-user-details {
    color: #16261e;
    font-weight: 500;
}

.admin-user-details strong {
    color: var(--forest-dark, #084d31);
}

.btn-logout-custom {
    background: #fdecec;
    color: #b42318;
    border: 1px solid #f8b4af;
    padding: 6px 14px;
    border-radius: 999px;
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    transition: all 0.2s;
}

.btn-logout-custom:hover {
    background: #b42318;
    color: #ffffff;
}