/* Long admin forms (Add project). Builds on dre-dashboard.css (glass cards, colours). */
.dre-form-page .dre-glass {
    height: auto;
}
.dre-form-page .dre-hero {
    margin-bottom: 18px;
}
.dre-form-layout {
    display: grid;
    grid-template-columns: 210px minmax(0, 1fr);
    gap: 22px;
    align-items: start;
}

/* Jump links */
.dre-form-nav {
    position: sticky;
    top: 86px;
    display: flex;
    flex-direction: column;
    gap: 3px;
    padding: 12px;
    border-radius: 18px;
    background: rgba(255, 255, 255, 0.5);
    border: 1px solid rgba(255, 255, 255, 0.72);
    -webkit-backdrop-filter: blur(16px);
    backdrop-filter: blur(16px);
}
.dre-form-page .dre-form-nav a {
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 9px 11px;
    border-radius: 10px;
    color: var(--dd-muted);
    font-size: 0.9rem;
    font-weight: 500;
    white-space: nowrap;
}
.dre-form-page .dre-form-nav a:hover {
    background: rgba(95, 87, 76, 0.08);
    color: var(--dd-main);
    text-decoration: none;
}
.dre-form-page .dre-form-nav a.is-on {
    background: linear-gradient(135deg, var(--dd-main), var(--dd-accent));
    color: #fff;
}
.dre-form-nav i {
    font-size: 1rem;
}

/* Sections */
.dre-form-section {
    margin-bottom: 18px;
    padding: 24px 26px;
    scroll-margin-top: 90px;
}
.dre-form-section h2 {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 0 0 18px;
    padding-bottom: 12px;
    border-bottom: 1px solid rgba(95, 87, 76, 0.12);
    color: var(--dd-ink);
    font-size: 1.15rem;
    font-weight: 600;
}
.dre-form-section h2 i {
    color: var(--dd-accent);
}
.dre-form-section h3 {
    margin: 22px 0 12px;
    color: var(--dd-main);
    font-size: 0.98rem;
    font-weight: 600;
}
.dre-form-note {
    margin: -6px 0 16px;
    color: var(--dd-muted);
    font-size: 0.88rem;
}
.dre-form-grid {
    display: grid;
    gap: 16px;
}
.dre-cols-2 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}
.dre-cols-3 {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

/* One field: label, control, hint */
.dre-field {
    display: block;
    margin: 0 0 16px;
    min-width: 0;
}
.dre-field > span,
.dre-field > label > span {
    display: block;
    margin-bottom: 6px;
    color: var(--dd-ink);
    font-size: 0.86rem;
    font-weight: 600;
}
.dre-field > label {
    display: block;
    margin: 0;
}
.dre-field b {
    color: #b9524a;
}
.dre-form input[type="text"],
.dre-form input[type="email"],
.dre-form input[type="number"],
.dre-form input[type="date"],
.dre-form input[type="file"],
.dre-form select,
.dre-form textarea {
    width: 100%;
    min-height: 44px;
    padding: 10px 13px;
    border: 1px solid rgba(95, 87, 76, 0.2);
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.85);
    color: var(--dd-ink);
    font-family: inherit;
    font-size: 0.95rem;
    outline: none;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.dre-form textarea {
    resize: vertical;
}
.dre-form input[type="file"] {
    padding: 8px;
    cursor: pointer;
}
.dre-form input[type="file"]::file-selector-button {
    margin-right: 10px;
    padding: 6px 12px;
    border: 0;
    border-radius: 8px;
    background: rgba(95, 87, 76, 0.12);
    color: var(--dd-main);
    font-weight: 600;
    cursor: pointer;
}
.dre-form input:focus,
.dre-form select:focus,
.dre-form textarea:focus {
    border-color: var(--dd-accent);
    box-shadow: 0 0 0 3px rgba(171, 152, 137, 0.25);
}
.dre-form .dre-invalid {
    border-color: #b9524a !important;
    box-shadow: 0 0 0 3px rgba(185, 82, 74, 0.16) !important;
}
.dre-field small {
    display: block;
    margin-top: 5px;
    color: var(--dd-muted);
    font-size: 0.8rem;
}
.dre-field small.dre-warn-text {
    color: #a8701a;
}
.dre-field code {
    padding: 1px 5px;
    border-radius: 6px;
    background: rgba(95, 87, 76, 0.08);
    color: var(--dd-main);
    font-size: 0.8rem;
    overflow-wrap: anywhere;
}
.dre-form .tox-tinymce {
    border-radius: 12px;
    border-color: rgba(95, 87, 76, 0.2);
}

/* Tick boxes shown as chips */
.dre-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}
.dre-chips label {
    margin: 0;
    cursor: pointer;
}
.dre-chips input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}
.dre-chips i {
    display: inline-flex;
    align-items: center;
    min-height: 38px;
    padding: 6px 14px;
    border: 1px solid rgba(95, 87, 76, 0.2);
    border-radius: 20px;
    background: rgba(255, 255, 255, 0.7);
    color: var(--dd-main);
    font-size: 0.88rem;
    font-style: normal;
    font-weight: 500;
    transition: background 0.12s ease, color 0.12s ease;
}
.dre-chips label:hover i {
    background: #fff;
}
.dre-chips input:checked + i {
    border-color: transparent;
    background: var(--dd-main);
    color: #fff;
}
.dre-chips input:focus-visible + i {
    outline: 2px solid var(--dd-accent);
    outline-offset: 2px;
}

/* Switches */
.dre-toggle {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 0 0 16px;
    min-height: 44px;
    cursor: pointer;
}
.dre-toggle input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}
.dre-toggle > i {
    position: relative;
    flex: none;
    width: 44px;
    height: 24px;
    border-radius: 24px;
    background: rgba(95, 87, 76, 0.26);
    transition: background 0.15s ease;
}
.dre-toggle > i::after {
    content: '';
    position: absolute;
    top: 3px;
    left: 3px;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #fff;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25);
    transition: left 0.15s ease;
}
.dre-toggle input:checked + i {
    background: #3f8f6b;
}
.dre-toggle input:checked + i::after {
    left: 23px;
}
.dre-toggle input:focus-visible + i {
    outline: 2px solid var(--dd-accent);
    outline-offset: 3px;
}
.dre-toggle strong {
    display: block;
    font-size: 0.92rem;
    font-weight: 600;
}
.dre-toggle small {
    display: block;
    color: var(--dd-muted);
    font-size: 0.8rem;
}

/* Rows that can be added and removed */
.dre-repeat-row {
    display: grid;
    gap: 10px;
    align-items: start;
    margin-bottom: 10px;
}
.dre-repeat-gallery {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) 44px;
}
.dre-repeat-plan {
    grid-template-columns: minmax(0, 1.4fr) minmax(0, 0.7fr) minmax(0, 1.2fr) 44px;
}
.dre-repeat-faq {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1.6fr) 44px;
}
.dre-form-page .dre-icon-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    padding: 0;
    border: 1px solid rgba(95, 87, 76, 0.16);
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.7);
    color: #b9524a;
    cursor: pointer;
}
.dre-form-page .dre-icon-btn:hover {
    background: #b9524a;
    color: #fff;
}
.dre-form-page .dre-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    min-height: 44px;
    padding: 0 18px;
    border: 1px solid rgba(95, 87, 76, 0.2);
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.75);
    color: var(--dd-main);
    font-size: 0.92rem;
    font-weight: 500;
    cursor: pointer;
}
.dre-form-page .dre-btn:hover {
    background: #fff;
}
.dre-form-page .dre-btn-main {
    border-color: transparent;
    background: var(--dd-main);
    color: #fff;
}
.dre-form-page .dre-btn-main:hover {
    background: #4a433a;
}

/* Picked images */
.dre-previews {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 8px;
}
.dre-previews img {
    width: 76px;
    height: 58px;
    border-radius: 10px;
    object-fit: cover;
    border: 1px solid rgba(95, 87, 76, 0.14);
}
.dre-file-link {
    display: inline-block;
    margin-top: 6px;
    font-size: 0.84rem;
    font-weight: 600;
}

/* Messages */
.dre-form-alert {
    display: flex;
    gap: 12px;
    margin-bottom: 18px;
    padding: 14px 18px;
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.8);
    border: 1px solid rgba(95, 87, 76, 0.16);
}
.dre-form-alert > i {
    font-size: 1.3rem;
}
.dre-form-alert ul {
    margin: 6px 0;
    padding-left: 18px;
}
.dre-form-alert em {
    color: var(--dd-muted);
    font-size: 0.85rem;
    font-style: normal;
}
.dre-form-bad {
    border-color: rgba(185, 82, 74, 0.4);
}
.dre-form-bad > i,
.dre-form-bad strong {
    color: #9c3f38;
}
.dre-form-ok {
    border-color: rgba(63, 143, 107, 0.4);
}
.dre-form-ok > i {
    color: #2c7353;
}

/* Save bar */
.dre-form-bar {
    position: sticky;
    bottom: 14px;
    z-index: 40;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    padding: 12px 16px;
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.9);
    border: 1px solid rgba(95, 87, 76, 0.14);
    box-shadow: 0 12px 34px rgba(73, 62, 50, 0.2);
    -webkit-backdrop-filter: blur(14px);
    backdrop-filter: blur(14px);
}
.dre-form-progress {
    flex: 1 1 240px;
    min-width: 0;
    font-size: 0.88rem;
}
.dre-form-progress .dre-track {
    margin: 6px 0 4px;
    max-width: 320px;
}
.dre-form-progress small {
    display: block;
    color: var(--dd-muted);
    font-size: 0.78rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.dre-form-bar-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

@media (max-width: 1199px) {
    .dre-form-layout {
        grid-template-columns: minmax(0, 1fr);
    }
    /* The jump links become one row that scrolls sideways. */
    .dre-form-nav {
        top: 60px;
        z-index: 30;
        flex-direction: row;
        overflow-x: auto;
        padding: 8px;
        background: rgba(255, 255, 255, 0.88);
        -webkit-overflow-scrolling: touch;
    }
    .dre-form-section {
        scroll-margin-top: 130px;
    }
}
@media (max-width: 767px) {
    .dre-cols-2,
    .dre-cols-3 {
        grid-template-columns: minmax(0, 1fr);
        gap: 0;
    }
    .dre-form-section {
        padding: 18px 16px;
    }
    .dre-repeat-gallery,
    .dre-repeat-plan,
    .dre-repeat-faq {
        grid-template-columns: minmax(0, 1fr) 44px;
        padding: 10px;
        border: 1px solid rgba(95, 87, 76, 0.12);
        border-radius: 14px;
        background: rgba(255, 255, 255, 0.45);
    }
    .dre-repeat-row > :not(.dre-repeat-remove) {
        grid-column: 1;
    }
    .dre-repeat-row > .dre-repeat-remove {
        grid-column: 2;
        grid-row: 1;
    }
    .dre-form input[type="text"],
    .dre-form input[type="email"],
    .dre-form input[type="number"],
    .dre-form input[type="date"],
    .dre-form select,
    .dre-form textarea {
        font-size: 16px;
    }
    .dre-form-bar {
        bottom: 8px;
    }
    .dre-form-bar-buttons,
    .dre-form-bar-buttons .dre-btn {
        flex: 1 1 auto;
    }
    .dre-form-progress small {
        display: none;
    }
}

/* A "How to edit" button next to a field label, and the pop-up it opens. */
.dre-field > label.dre-guide-label {
    display: inline-block;
    margin-right: 10px;
}
.dre-guide-open {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 6px;
    vertical-align: middle;
}
.dre-form-page .dre-guide-btn {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 3px 10px;
    border-radius: 20px;
    background: rgba(255, 255, 255, 0.7);
    border: 1px solid rgba(95, 87, 76, 0.2);
    color: var(--dd-main);
    font-size: 0.78rem;
    font-weight: 600;
    cursor: pointer;
}
.dre-form-page .dre-guide-btn:hover {
    background: #fff;
}
.dre-guide-flag {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 9px;
    border-radius: 20px;
    background: rgba(192, 138, 46, 0.14);
    color: #8a5a12;
    font-size: 0.74rem;
    font-weight: 600;
}
.dre-guide-dialog {
    width: min(640px, calc(100vw - 32px));
    max-height: min(80vh, 720px);
    padding: 0;
    border: 0;
    border-radius: 18px;
    background: #fbf8f5;
    color: #2f2a25;
    box-shadow: 0 24px 60px rgba(47, 42, 37, 0.35);
}
.dre-guide-dialog::backdrop {
    background: rgba(47, 42, 37, 0.45);
}
.dre-guide-head {
    position: sticky;
    top: 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 14px 18px;
    background: #fbf8f5;
    border-bottom: 1px solid rgba(95, 87, 76, 0.14);
}
.dre-guide-head strong {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 1rem;
}
.dre-guide-head strong i {
    color: #ab9889;
}
.dre-guide-close {
    width: 32px;
    height: 32px;
    border: 0;
    border-radius: 10px;
    background: rgba(95, 87, 76, 0.1);
    color: #5f574c;
    cursor: pointer;
}
.dre-guide-close:hover {
    background: rgba(95, 87, 76, 0.2);
}
.dre-guide-dialog .dre-field-guide-body {
    padding: 4px 18px 18px;
    overflow-y: auto;
}
.dre-field-guide-body {
    font-size: 0.88rem;
    line-height: 1.55;
}
.dre-field-guide-body h4 {
    margin: 14px 0 6px;
    color: #2f2a25;
    font-size: 0.92rem;
    font-weight: 600;
}
.dre-field-guide-body ul {
    margin: 0;
    padding-left: 18px;
}
.dre-field-guide-body li + li {
    margin-top: 3px;
}
.dre-field-guide-body p {
    margin: 10px 0 6px;
}
.dre-field-guide-body b {
    color: #2f2a25;
    font-weight: 600;
}
.dre-field-guide-body a {
    color: #5f574c;
    font-weight: 600;
}
.dre-field-guide-body kbd {
    padding: 1px 5px;
    border-radius: 5px;
    background: rgba(95, 87, 76, 0.12);
    color: #2f2a25;
    font-size: 0.8rem;
    box-shadow: none;
}
.dre-field-guide-body code {
    color: #9c3f38;
    background: rgba(95, 87, 76, 0.08);
    border-radius: 4px;
    padding: 0 4px;
}
.dre-field-guide-code {
    margin: 8px 0 0;
    padding: 10px 12px;
    border-radius: 10px;
    background: #2f2a25;
    color: #f3ede6;
    font-size: 0.8rem;
    white-space: pre-wrap;
}
.dre-field-guide-warn {
    display: flex;
    gap: 10px;
    margin-top: 14px;
    padding: 10px 12px;
    border-radius: 12px;
    background: rgba(192, 138, 46, 0.12);
    border: 1px solid rgba(192, 138, 46, 0.35);
}
.dre-field-guide-warn > i {
    color: #a8701a;
    font-size: 1.1rem;
}
