:root {
    --green: #7A9D96;
    --sky: #CAE4DB;
    --dark: #263632;
    --text: #34433f;
    --muted: #71807c;
    --background: #f5f7f6;
    --white: #ffffff;
    --border: #dfe7e4;
    --danger: #a33b3b;
}

* {
    box-sizing: border-box;
}

html {
    font-family:
        "Trebuchet MS",
        "Segoe UI",
        sans-serif;
    color: var(--text);
    background: var(--background);
}

body {
    margin: 0;
}

.topbar {
    background: var(--white);
    border-bottom: 1px solid var(--border);
}

.topbar-inner {
    max-width: 1180px;
    margin: auto;
    padding: 18px 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.brand {
    color: var(--dark);
    text-decoration: none;
}

.brand-name {
    display: block;
    font-weight: 700;
    font-size: 20px;
}

.brand-subtitle {
    display: block;
    color: var(--green);
    font-size: 13px;
    margin-top: 2px;
}

.page {
    max-width: 1180px;
    margin: 0 auto;
    padding: 48px 24px 80px;
}

.page-heading {
    margin-bottom: 48px;
}

.eyebrow {
    color: var(--green);
    font-size: 12px;
    font-weight: 800;
    letter-spacing: .14em;
    margin-bottom: 8px;
}

h1 {
    color: var(--dark);
    font-size: 38px;
    margin: 0 0 8px;
}

h2 {
    color: var(--dark);
    font-size: 24px;
    margin: 0;
}

h3 {
    color: var(--dark);
    margin: 8px 0;
    font-size: 19px;
}

p {
    line-height: 1.6;
}

.muted {
    color: var(--muted);
}

section {
    margin-bottom: 52px;
}

.section-heading {
    margin-bottom: 20px;
}

.section-heading p {
    color: var(--muted);
    margin: 6px 0 0;
}

.cards {
    display: grid;
    grid-template-columns:
        repeat(auto-fit, minmax(220px, 1fr));
    gap: 18px;
}

.dashboard-card {
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 24px;
    min-height: 210px;
}

.dashboard-card.featured {
    background: var(--sky);
    border-color: transparent;
}

.card-number {
    color: var(--green);
    font-size: 34px;
    font-weight: 800;
}

.featured .card-number {
    color: var(--dark);
}

.coming {
    display: inline-block;
    margin-top: 12px;
    font-size: 13px;
    color: var(--muted);
}

.login-wrap {
    min-height: calc(100vh - 180px);
    display: flex;
    align-items: center;
    justify-content: center;
}

.login-card {
    width: 100%;
    max-width: 440px;
    padding: 38px;
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: 16px;
}

label {
    display: block;
    margin: 22px 0 7px;
    font-weight: 700;
}

input {
    width: 100%;
    padding: 13px 14px;
    border: 1px solid #cbd7d3;
    border-radius: 8px;
    font: inherit;
    background: var(--white);
}

input:focus {
    outline: 2px solid var(--sky);
    border-color: var(--green);
}

.primary-button,
.logout-button {
    border: 0;
    border-radius: 8px;
    font: inherit;
    cursor: pointer;
}

.primary-button {
    width: 100%;
    margin-top: 26px;
    padding: 14px;
    background: var(--green);
    color: white;
    font-weight: 700;
}

.logout-button {
    padding: 9px 14px;
    background: transparent;
    color: var(--muted);
}

.flash {
    padding: 14px 16px;
    border-radius: 8px;
    margin-bottom: 20px;
}

.flash-error {
    background: #f8e5e5;
    color: var(--danger);
}

@media (max-width: 600px) {
    .page {
        padding: 32px 18px 60px;
    }

    h1 {
        font-size: 31px;
    }

    .login-card {
        padding: 26px;
    }
}

/* ========================================================
   Bibliotheek en formulieren
   ======================================================== */

.page-heading-row {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 24px;
}

.button-link,
.secondary-button,
.danger-button,
.card-link,
.back-link {
    text-decoration: none;
}

.button-link {
    display: inline-block;
    background: var(--green);
    color: white;
    padding: 12px 18px;
    border-radius: 8px;
    font-weight: 700;
    white-space: nowrap;
}

.card-link {
    display: inline-block;
    margin-top: 12px;
    color: var(--green);
    font-weight: 700;
}

.library-list {
    display: grid;
    gap: 12px;
}

.library-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 20px 22px;
}

.library-item h3 {
    margin-top: 0;
}

.library-meta {
    margin-top: 8px;
    color: var(--muted);
    font-size: 13px;
}

.library-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.library-actions form {
    margin: 0;
}

.secondary-button,
.danger-button {
    display: inline-block;
    padding: 9px 13px;
    border-radius: 7px;
    font: inherit;
    cursor: pointer;
    background: white;
}

.secondary-button {
    border: 1px solid var(--border);
    color: var(--text);
}

.danger-button {
    border: 1px solid #e5caca;
    color: var(--danger);
}

.empty-state {
    background: white;
    border: 1px dashed #c8d5d1;
    border-radius: 14px;
    padding: 40px;
    text-align: center;
}

.form-card {
    max-width: 900px;
    background: white;
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 30px;
}

.form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

textarea {
    width: 100%;
    padding: 13px 14px;
    border: 1px solid #cbd7d3;
    border-radius: 8px;
    font: inherit;
    line-height: 1.55;
    resize: vertical;
}

textarea:focus {
    outline: 2px solid var(--sky);
    border-color: var(--green);
}

.form-actions {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 10px;
    margin-top: 26px;
}

.inline-button {
    width: auto;
    margin: 0;
    padding-left: 24px;
    padding-right: 24px;
}

.back-link {
    display: inline-block;
    margin-bottom: 22px;
    color: var(--green);
}

.flash-success {
    background: #e2f0eb;
    color: #315c50;
}

@media (max-width: 700px) {
    .page-heading-row,
    .library-item {
        align-items: stretch;
        flex-direction: column;
    }

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

    .library-actions {
        justify-content: flex-start;
    }
}

/* Media */

.media-section {
    max-width: 900px;
    margin-top: 40px;
}

.photo-grid {
    display: grid;
    grid-template-columns: repeat(
        auto-fill,
        minmax(240px, 1fr)
    );
    gap: 18px;
    margin-bottom: 22px;
}

.photo-card {
    overflow: hidden;
    background: white;
    border: 1px solid var(--border);
    border-radius: 12px;
}

.photo-preview {
    aspect-ratio: 16 / 9;
    background: #e8eeec;
}

.photo-preview img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.photo-card-body {
    padding: 15px;
}

.cover-badge {
    display: inline-block;
    margin: 8px 0 0;
    padding: 4px 8px;
    border-radius: 999px;
    background: var(--sky);
    color: var(--dark);
    font-size: 12px;
    font-weight: 700;
}

.photo-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 7px;
    margin-top: 14px;
}

.photo-actions form {
    margin: 0;
}

.upload-card {
    margin-top: 18px;
    padding: 22px;
    background: white;
    border: 1px dashed #bdcdc8;
    border-radius: 12px;
}

.upload-card h3 {
    margin-top: 0;
}

.upload-card .primary-button {
    margin-top: 22px;
}

.document-list {
    display: grid;
    gap: 8px;
    margin-bottom: 20px;
}

.document-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    padding: 15px 18px;
    background: white;
    border: 1px solid var(--border);
    border-radius: 9px;
}

.small-text {
    margin-top: 4px;
    font-size: 12px;
}

@media (max-width: 650px) {
    .document-row {
        align-items: stretch;
        flex-direction: column;
    }
}

.form-section-title {
    margin-top: 38px;
    padding-top: 28px;
    border-top: 1px solid var(--border);
}

.future-media {
    max-width: 900px;
    margin-top: 38px;
    padding: 26px 30px;
    background: var(--sky);
    border-radius: 14px;
}

.future-media h2 {
    margin-top: 0;
}


/* Compact fotobeheer */
.media-section {
    max-width: 1000px;
    margin-top: 38px;
}

.media-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 18px;
    margin: 20px 0 28px;
}

.media-card {
    min-width: 0;
    overflow: hidden;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: #fff;
}

.media-card > img {
    display: block;
    width: 100%;
    aspect-ratio: 16 / 9;
    height: auto;
    object-fit: cover;
}

.media-card-body {
    padding: 12px;
}

.media-card-body strong {
    display: block;
    overflow: hidden;
    margin-bottom: 6px;
    font-size: 14px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.media-badge {
    display: inline-block;
    margin: 2px 0 8px;
    padding: 3px 7px;
    border-radius: 999px;
    background: var(--sky);
    font-size: 12px;
}

.media-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 7px;
    margin-top: 8px;
}

.media-actions form {
    margin: 0;
}

.media-actions .secondary-button,
.media-actions .danger-button {
    padding: 6px 9px;
    font-size: 12px;
}

.media-upload-form {
    max-width: 760px;
    margin-top: 20px;
    padding: 18px;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: #fff;
}

@media (max-width: 600px) {
    .media-grid {
        grid-template-columns: 1fr 1fr;
        gap: 10px;
    }
}


/* Reisbeheer */
.trip-section {
    margin-top: 28px;
}

.inline-add-row {
    display: flex;
    align-items: end;
    gap: 12px;
    margin-top: 8px;
}

.inline-add-row select {
    flex: 1;
    min-width: 0;
}

@media (max-width: 650px) {
    .inline-add-row {
        display: block;
    }

    .inline-add-row button {
        margin-top: 10px;
    }
}


/* Omslagfoto reis */
.cover-choice {
    display: grid;
    grid-template-columns:
        repeat(auto-fill, minmax(190px, 1fr));
    gap: 14px;
    margin: 18px 0 28px;
}

.cover-option {
    position: relative;
    overflow: hidden;
    border: 2px solid var(--border);
    border-radius: 12px;
    background: #fff;
    cursor: pointer;
}

.cover-option input {
    position: absolute;
    top: 10px;
    left: 10px;
    z-index: 2;
    width: 18px;
    height: 18px;
}

.cover-option img {
    display: block;
    width: 100%;
    aspect-ratio: 16 / 9;
    object-fit: cover;
}

.cover-option span {
    display: block;
    padding: 9px 11px;
    font-size: 13px;
    font-weight: 600;
}

.cover-option:has(input:checked) {
    border-color: var(--green);
    box-shadow: 0 0 0 2px
        rgba(122, 157, 150, .18);
}

.cover-option.no-cover {
    display: flex;
    min-height: 80px;
    align-items: center;
}

.cover-option.no-cover span {
    padding-left: 42px;
}


/* =========================================================
   EENVOUDIGE RICH-TEXT EDITOR
   ========================================================= */

.rich-editor-wrapper {
    margin-bottom: 1rem;
}

.rich-editor-toolbar {
    display: flex;
    gap: .35rem;
    padding: .45rem;
    background: #f3f7f6;
    border: 1px solid #ccd8d5;
    border-bottom: 0;
    border-radius: 8px 8px 0 0;
}

.rich-editor-button {
    min-width: 2.4rem;
    padding: .4rem .65rem;
    border: 1px solid #c5d2cf;
    border-radius: 5px;
    background: #fff;
    cursor: pointer;
    font: inherit;
}

.rich-editor-button:hover {
    background: #CAE4DB;
}

.rich-editor-bold {
    font-weight: 700;
}

.rich-editor-italic {
    font-style: italic;
}

.rich-editor-area {
    box-sizing: border-box;
    width: 100%;
    min-height: 180px;
    padding: .85rem;
    overflow-y: auto;
    border: 1px solid #ccd8d5;
    border-radius: 0 0 8px 8px;
    background: #fff;
    line-height: 1.6;
    white-space: normal;
}

.rich-editor-area:focus {
    outline: 2px solid #7A9D96;
    outline-offset: 1px;
}

.rich-editor-area p:first-child,
.rich-editor-area ul:first-child,
.rich-editor-area ol:first-child {
    margin-top: 0;
}

.rich-editor-area p:last-child,
.rich-editor-area ul:last-child,
.rich-editor-area ol:last-child {
    margin-bottom: 0;
}

.rich-editor-source {
    display: none !important;
}


/* Doorzoeken van bibliotheek bij koppelen aan reis */

.library-select-search {
    width: 100%;
    margin: 6px 0 10px;
}

