* {
    box-sizing: border-box;
}

:root {
    --bg: #f3f3f3;
    --card: #ffffff;
    --line: #dddddd;
    --text: #222222;
    --muted: #5f5f5f;
    --primary: #1f4b99;
    --primary-hover: #163b7e;
    --danger: #c62828;
    --danger-hover: #a61f1f;
    --success: #1e6b38;
    --success-bg: #edf8f0;
    --danger-bg: #fdeeee;
    --radius: 18px;
    --shadow: 0 10px 30px rgba(0, 0, 0, 0.06);
}

body {
    margin: 0;
    font-family: Arial, Helvetica, sans-serif;
    background: #f4f4f4;
    color: var(--text);
}

.container {
    max-width: 1280px;
    margin: 0 auto;
    padding: 20px;
}

.auth-container {
    max-width: 520px;
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
}

.auth-card {
    width: 100%;
}

.card {
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 20px;
    box-shadow: var(--shadow);
}

.public-card {
    background: #fff;
    border: 1px solid #dadada;
    border-radius: 8px;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.04);
}

.topbar {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 16px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.topbar h1 {
    margin: 0 0 8px;
}

.intro-text {
    margin: 0;
    color: var(--muted);
}

.grid {
    display: grid;
    grid-template-columns: 430px 1fr;
    gap: 20px;
    align-items: start;
}

.field-group {
    margin-bottom: 16px;
}

label {
    display: block;
    font-weight: 700;
    margin-bottom: 8px;
}

input[type="text"],
input[type="email"],
input[type="password"],
textarea,
select {
    width: 100%;
    border: 1px solid #cfcfcf;
    border-radius: 10px;
    padding: 12px 14px;
    font-size: 15px;
    background: #fff;
    outline: none;
    color: #222;
}

input[type="text"]:focus,
input[type="email"]:focus,
input[type="password"]:focus,
textarea:focus,
select:focus {
    border-color: var(--primary);
}

textarea {
    min-height: 110px;
    resize: vertical;
}

.admin-rich-textarea {
    min-height: 260px;
    font-family: Consolas, Monaco, monospace;
    line-height: 1.5;
}

button,
.btn {
    border: none;
    background: var(--primary);
    color: #fff;
    padding: 12px 16px;
    border-radius: 10px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 700;
    text-decoration: none;
    display: inline-block;
}

button:hover,
.btn:hover {
    background: var(--primary-hover);
}

.btn-secondary {
    background: #e8e8e8;
    color: #111;
}

.btn-secondary:hover {
    background: #d8d8d8;
}

.btn-danger {
    background: var(--danger);
    color: #fff;
}

.btn-danger:hover {
    background: var(--danger-hover);
}

.top-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.notice {
    padding: 14px 16px;
    border-radius: 12px;
    font-weight: 600;
    margin-bottom: 16px;
}

.notice.success {
    background: var(--success-bg);
    color: var(--success);
    border: 1px solid #cfead7;
}

.notice.error {
    background: var(--danger-bg);
    color: var(--danger);
    border: 1px solid #f4c8c8;
}

.small {
    font-size: 13px;
    color: var(--muted);
    line-height: 1.55;
}

.separator {
    margin: 20px 0;
    border: none;
    border-top: 1px solid #e5e5e5;
}

.field-item {
    border: 1px solid #e2e2e2;
    background: #fafafa;
    border-radius: 14px;
    padding: 14px;
    margin-bottom: 12px;
}

.field-item-header {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    align-items: center;
    margin-bottom: 8px;
}

.badge {
    display: inline-block;
    background: #eef3ff;
    color: #1d4ed8;
    border: 1px solid #c6d6ff;
    border-radius: 999px;
    padding: 4px 10px;
    font-size: 12px;
    font-weight: 700;
}

.preview-form {
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.choice-group {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.choice-line {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 500;
    margin-bottom: 0;
}

.checkbox-line label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 600;
}

.required {
    color: #c62828;
}

.honeypot {
    position: absolute !important;
    left: -9999px !important;
    top: -9999px !important;
    opacity: 0 !important;
    pointer-events: none !important;
    height: 0 !important;
    width: 0 !important;
    overflow: hidden !important;
}

.empty-state {
    padding: 18px;
    text-align: center;
    color: var(--muted);
    border: 1px dashed #d8d8d8;
    border-radius: 14px;
    background: #fafafa;
}

.table-wrap {
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
    background: #fff;
}

table th,
table td {
    border: 1px solid #e2e2e2;
    padding: 12px;
    text-align: left;
    vertical-align: top;
}

table th {
    background: #f8f8f8;
}

pre {
    margin: 0;
    white-space: pre-wrap;
    word-break: break-word;
    font-size: 13px;
    line-height: 1.5;
}

.mt8 {
    margin-top: 8px;
}

.mt12 {
    margin-top: 12px;
}

.admin-description-preview {
    border: 1px solid #e4e4e4;
    background: #fafafa;
    border-radius: 14px;
    padding: 18px;
}

.doc-builder {
    border: 1px solid #dfe4ea;
    background: #f8fafc;
    border-radius: 14px;
    padding: 14px;
}

.doc-builder-steps {
    margin: 0 0 12px 18px;
    padding: 10px 12px;
    border: 1px dashed #c5d2e2;
    border-radius: 10px;
    background: #f1f6fc;
}

.doc-builder-steps li {
    margin-bottom: 5px;
}

.doc-builder-steps li:last-child {
    margin-bottom: 0;
}

.doc-builder-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.doc-builder-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 10px;
    margin-bottom: 10px;
}

.hidden {
    display: none !important;
}

.builder-modal {
    position: fixed;
    inset: 0;
    z-index: 1000;
}

.builder-modal__overlay {
    position: absolute;
    inset: 0;
    background: rgba(15, 23, 42, 0.45);
}

.builder-modal__content {
    position: relative;
    z-index: 1;
    max-width: 860px;
    margin: 5vh auto 0;
    width: calc(100% - 28px);
    max-height: 90vh;
    overflow-y: auto;
    background: #fff;
    border: 1px solid #dbe3ef;
    border-radius: 14px;
    box-shadow: 0 20px 45px rgba(15, 23, 42, 0.25);
    padding: 16px;
}

.builder-modal__head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    margin-bottom: 14px;
}

.builder-modal__head h3 {
    margin: 0;
}

/* Partie publique */

.public-body {
    background: #eeeeee;
    color: #222;
}

.public-wrapper {
    max-width: 1300px;
    margin: 0 auto;
    padding: 28px 18px 40px;
}

.public-anchor-nav {
    position: sticky;
    top: 10px;
    z-index: 30;
    margin-bottom: 16px;
    padding: 8px;
    background: rgba(255, 255, 255, 0.95);
    border: 1px solid #d8d8d8;
    border-radius: 10px;
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    backdrop-filter: blur(4px);
}

.public-anchor-nav a {
    display: inline-block;
    padding: 10px 12px;
    border-radius: 8px;
    border: 1px solid #dadada;
    background: #f8f8f8;
    color: #1f1f1f;
    text-decoration: none;
    font-size: 14px;
    font-weight: 600;
}

.public-anchor-nav a:hover {
    background: #efefef;
}

.public-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 24px;
    align-items: start;
}

.public-doc-card {
    overflow: hidden;
}

.public-doc-header {
    padding: 24px 28px;
    border-bottom: 1px solid #dedede;
    background: #fafafa;
}

.public-doc-header h1 {
    margin: 0;
    font-size: 24px;
    font-weight: 500;
    color: #2b2b2b;
}

.public-doc-content {
    padding: 34px 42px 42px;
    background: #f7f7f7;
    min-height: 500px;
}

.content-anchor-section {
    scroll-margin-top: 90px;
}

.content-anchor-title {
    margin: 0 0 14px;
    padding-bottom: 10px;
    border-bottom: 1px solid #dbdbdb;
    font-size: 24px;
    font-weight: 600;
}

.content-anchor-section + .content-anchor-section {
    margin-top: 26px;
    padding-top: 10px;
}

.public-form-card {
    position: static;
    padding: 26px;
    background: #ffffff;
}

.form-side-head {
    margin-bottom: 18px;
    padding-bottom: 14px;
    border-bottom: 1px solid #ececec;
}

.form-side-head h2 {
    margin: 0 0 8px;
    font-size: 22px;
    font-weight: 600;
}

.form-side-head p {
    margin: 0;
    color: var(--muted);
    line-height: 1.5;
}

.public-field {
    margin-bottom: 0;
}

.public-field label {
    font-size: 15px;
    color: #1f1f1f;
}

.public-field input[type="text"],
.public-field input[type="email"],
.public-field textarea,
.public-field select {
    border-radius: 8px;
    border: 1px solid #cfcfcf;
    background: #fff;
}

.public-field textarea {
    min-height: 120px;
}

.submit-btn {
    width: 100%;
    padding: 14px 18px;
    font-size: 15px;
    border-radius: 8px;
}

/* Rendu HTML description */

.rich-content {
    color: #202020;
    line-height: 1.7;
    font-size: 16px;
}

.rich-content p {
    margin: 0 0 18px;
}

.rich-content h1,
.rich-content h2,
.rich-content h3,
.rich-content h4 {
    margin: 26px 0 14px;
    color: #1f1f1f;
    font-weight: 600;
}

.rich-content h2 {
    font-size: 28px;
    line-height: 1.3;
}

.rich-content h3 {
    font-size: 22px;
}

.rich-content h4 {
    font-size: 18px;
}

.rich-content a {
    color: #1f4b99;
    text-decoration: underline;
}

.rich-content img {
    display: block;
    max-width: 70%;
    height: auto;
    margin: 0 auto 28px;
    border-radius: 4px;
}

.rich-content ul,
.rich-content ol {
    margin: 0 0 18px 22px;
    padding: 0;
}

.rich-content li {
    margin-bottom: 8px;
}

.rich-content blockquote {
    margin: 20px 0;
    padding: 14px 18px;
    border-left: 4px solid #d0d0d0;
    background: #fcfcfc;
    color: #444;
}

/* Bloc documents */

.documents-block {
    background: #f5f5f5;
    border: 1px solid #d9d9d9;
    border-radius: 6px;
    overflow: hidden;
    margin-top: 30px;
}

.documents-title {
    margin: 0;
    padding: 18px 22px;
    font-size: 20px;
    font-weight: 400;
    color: #1f1f1f;
    background: #f5f5f5;
    border-bottom: 1px solid #d9d9d9;
}

.documents-intro {
    padding: 22px;
    background: #f5f5f5;
    color: #222;
    line-height: 1.7;
}

.documents-intro p {
    margin: 0 0 16px;
}

.main-doc-link {
    color: #1d6fd6;
    text-decoration: none;
    font-size: 15px;
}

.main-doc-link:hover {
    text-decoration: underline;
}

.main-doc-link span {
    color: #8c8c8c;
    font-style: italic;
}

.doc-accordion {
    padding: 0 22px 22px;
    background: #f5f5f5;
}

.doc-item {
    margin-bottom: 16px;
}

.doc-toggle {
    width: 100%;
    display: flex;
    align-items: flex-start;
    gap: 12px;
    background: transparent !important;
    border: none !important;
    padding: 0 !important;
    cursor: pointer;
    text-align: left;
    color: #111 !important;
    box-shadow: none !important;
}

.doc-toggle:hover {
    background: transparent !important;
}

.doc-icon {
    width: 20px;
    height: 20px;
    min-width: 20px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: #0f74c9;
    color: #fff;
    font-weight: 700;
    font-size: 16px;
    border-radius: 2px;
    margin-top: 3px;
    line-height: 1;
}

.doc-label {
    font-size: 18px;
    font-weight: 700;
    line-height: 1.35;
    text-transform: uppercase;
}

.doc-content {
    margin-left: 32px;
    margin-top: 10px;
    display: none;
}

.doc-links {
    list-style: none;
    margin: 0;
    padding: 0;
}

.doc-links li {
    margin-bottom: 12px;
}

.doc-links a {
    color: #1d6fd6;
    text-decoration: none;
    font-size: 15px;
    line-height: 1.5;
}

.doc-links a:hover {
    text-decoration: underline;
}

.doc-links a span {
    color: #8c8c8c;
    font-style: italic;
}

.doc-content p {
    margin: 0;
    color: #111;
    font-size: 15px;
}


.public-footer {
    max-width: 1300px;
    margin: 0 auto 28px;
    padding: 0 18px;
}

.public-footer-link {
    display: inline-block;
    border: 1px solid #d7d7d7;
    border-radius: 8px;
    padding: 14px 16px;
    background: #f8f8f8;
    color: #1f4b99;
    text-decoration: none;
    font-size: 14px;
    line-height: 1.5;
}

.public-footer-link:hover {
    text-decoration: underline;
}

.rgpd-wrapper {
    max-width: 900px;
}

.rgpd-card h1 {
    margin-top: 0;
}

.rgpd-card p {
    line-height: 1.6;
}

@media (max-width: 1100px) {
    .public-layout {
        grid-template-columns: 1fr;
    }

    .public-form-card {
        position: static;
    }
}

@media (max-width: 900px) {
    .grid {
        grid-template-columns: 1fr;
    }

    .doc-builder-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 700px) {
    .public-anchor-nav {
        top: 6px;
    }

    .public-anchor-nav a {
        width: 100%;
        text-align: center;
    }

    .public-doc-content {
        padding: 22px 18px 24px;
    }

    .public-doc-header {
        padding: 18px;
    }

    .public-form-card {
        padding: 18px;
    }

    .rich-content h2 {
        font-size: 22px;
    }

    .rich-content h3 {
        font-size: 19px;
    }

    .documents-title,
    .documents-intro,
    .doc-accordion {
        padding-left: 16px;
        padding-right: 16px;
    }

    .doc-label {
        font-size: 16px;
    }

    .doc-content {
        margin-left: 28px;
    }
}

@media (max-width: 640px) {
    .container {
        padding: 12px;
    }

    .card {
        padding: 16px;
        border-radius: 14px;
    }

    .top-actions {
        width: 100%;
        flex-direction: column;
    }

    .top-actions .btn {
        width: 100%;
        text-align: center;
    }

    button,
    .btn {
        width: 100%;
    }

    .doc-builder-actions {
        flex-direction: column;
    }

    .doc-toggle {
        width: 100% !important;
    }

    .field-item-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .public-wrapper {
        padding: 14px 10px 24px;
    }
}

.answer-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    min-width: 260px;
}

.answer-item {
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    background: #fafafa;
    padding: 8px 10px;
}

.answer-question {
    font-size: 12px;
    font-weight: 700;
    color: #4b5563;
    margin-bottom: 4px;
}

.answer-value {
    font-size: 13px;
    line-height: 1.5;
    white-space: pre-wrap;
    word-break: break-word;
}
