/* The wrapper is now only a container: the visual box moved onto the two
   panels, so each section reads as its own thing. It keeps the
   .dcasim-ai-export class because the front end treats it as the instance
   root, and there must be exactly one per shortcode. */
.dcasim-ai-export {
    box-sizing: border-box;
    width: 100%;
    margin: 24px 0;
}

.dcasim-ai-export *,
.dcasim-ai-export *::before,
.dcasim-ai-export *::after {
    box-sizing: inherit;
}

.dcasim-ai-export__header {
    margin-bottom: 18px;
}

.dcasim-ai-export__title {
    margin: 0 0 4px;
    font-size: 20px;
    line-height: 1.3;
}

.dcasim-ai-export__help,
.dcasim-ai-export__field-help,
.dcasim-ai-export__status {
    margin: 0;
    color: #50575e;
    font-size: 14px;
    line-height: 1.5;
}

/* =========================================
   The two panels
   ========================================= */
.dcasim-ai-export__panel {
    margin: 0 0 18px;
    padding: 18px;
    border: 1px solid #dcdcde;
    border-radius: 8px;
    background: #fff;
}

/* Nothing below the read-only panel in the normal case, so the report ends
   where the box ends. */
.dcasim-ai-export__panel:last-of-type {
    margin-bottom: 0;
}

.dcasim-ai-export__label {
    display: block;
    margin-bottom: 2px;
    color: #1d2327;
    font-size: 15px;
    font-weight: 600;
}

.dcasim-ai-export__field-help {
    margin-bottom: 6px;
}

.dcasim-ai-export__textarea {
    display: block;
    width: 100%;
    padding: 12px;
    border: 1px solid #8c8f94;
    border-radius: 4px;
    color: #1d2327;
    font-size: 13px;
    line-height: 1.5;
    overflow-y: auto;
    resize: vertical;
}

/* Section 1 — the editable brief. White, because white is the page's cue for
   a field you can type in; prose font and wrapped lines, because the text is
   ordinary prose rather than Markdown. */
.dcasim-ai-export__textarea--prose {
    height: 200px;
    background: #fff;
    font-family: inherit;
    font-size: 14px;
    white-space: pre-wrap;
    overflow-wrap: break-word;
}

/* Section 2 — the report. Very light grey for read-only, monospace with no
   wrapping so the Markdown tables line up as they will for the AI. */
.dcasim-ai-export__textarea--code {
    height: 360px;
    background: #f6f7f7;
    font-family: Consolas, Monaco, monospace;
    white-space: pre;
}

.dcasim-ai-export__textarea:focus {
    border-color: #2271b1;
    outline: 2px solid transparent;
    box-shadow: 0 0 0 1px #2271b1;
}

/* Reset in section 1 and Copy in section 2 both sit at the right. */
.dcasim-ai-export__field-actions {
    display: flex;
    justify-content: flex-end;
    margin-top: 8px;
}

/* Section 2's Copy sits at the top right of its panel, beside the heading;
   the heading and help text wrap around it, and the report starts below. */
.dcasim-ai-export__field-actions--top {
    float: right;
    margin: 0 0 8px 12px;
}

.dcasim-ai-export__panel--read .dcasim-ai-export__textarea {
    clear: both;
}

/* Carries no height while it has nothing to say, which is the usual state
   once the result has loaded. */
.dcasim-ai-export__status {
    margin: 16px 0 0;
}

.dcasim-ai-export__status:empty {
    margin: 0;
}

.dcasim-ai-export__button {
    min-height: 38px;
    padding: 8px 16px;
    border: 1px solid #8c8f94;
    border-radius: 4px;
    background: #fff;
    color: #1d2327;
    font: inherit;
    cursor: pointer;
}

.dcasim-ai-export__button:hover {
    background: #f6f7f7;
}

.dcasim-ai-export__button:focus-visible {
    outline: 2px solid #2271b1;
    outline-offset: 1px;
}

.dcasim-ai-export__button--small {
    min-width: 88px;
    min-height: 30px;
    padding: 4px 12px;
    font-size: 13px;
}

.dcasim-ai-export__button--primary {
    border-color: #2271b1;
    background: #2271b1;
    color: #fff;
}

.dcasim-ai-export__button--primary:hover {
    background: #135e96;
}

@media (max-width: 560px) {
    .dcasim-ai-export__panel {
        padding: 14px;
    }

    .dcasim-ai-export__textarea--prose {
        height: 180px;
    }

    .dcasim-ai-export__textarea--code {
        height: 280px;
    }
}

/* Spacing on the export page only: the navigation row sits closer to the
   report panel, and leaves more room before what follows it (the Save &
   Share button). Other pages keep the shared spacing below. */
.dcasim-ai-export {
    margin-bottom: 0;
}

.dcasim-ai-export + .dca-nav-actions {
    margin-top: 16px;
    margin-bottom: 40px;
}

/* =========================================
   Shared navigation buttons
   Matches the Result and Advanced Result pages: equal-width buttons that
   share the row, centred, capped at 300px each. Defined here so the export
   page looks the same whether or not the theme provides these rules.
   ========================================= */
.dca-nav-actions {
    display: flex;
    gap: 16px;
    margin-top: 30px;
    justify-content: center;
}

.dca-nav-actions .button {
    flex: 1;
    max-width: 300px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 16px;
    border: 1px solid #e4e4e7;
    border-radius: 8px;
    background: #ffffff;
    color: #09090b;
    font-family: inherit;
    font-size: 0.95em;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.dca-nav-actions .button:active {
    transform: translateY(1px);
}

.dca-nav-actions .btn-secondary {
    background: #ffffff;
    color: #71717a;
    border: 1px solid #e4e4e7;
}

.dca-nav-actions .btn-secondary:hover {
    background: #f4f4f5;
    color: #09090b;
}

.dca-nav-actions .button:focus-visible {
    outline: 2px solid #2271b1;
    outline-offset: 1px;
}

@media (max-width: 600px) {
    .dca-nav-actions {
        flex-direction: column;
        align-items: center;
    }

    .dca-nav-actions .button {
        width: 100%;
        max-width: 100%;
    }
}
