/**
 * MADO AI ANSWER SETTINGS PAGE CSS SSOT / AIの答え方画面CSS正本
 *
 * ROLE / 役割（2026-08-12）:
 * - /mado-app/ai-answer-settings/ のheader、panel、card、入力欄、model選択、保存button、responsiveをこの1枚で担当する。
 * - この画面では public/css/crawl-usage-page.css と public/css/ai-usage-page.css を読み込まない。
 * - 共通ポータル基盤（font / shell / heading）と共通ヘルプチップの挙動・見た目だけは public/css/mado-base.css を正本として再利用する。
 *
 * CHANGE RULE / 変更ルール:
 * - AIの答え方専用selectorを crawl-usage-page.css / ai-usage-page.css へ追加しない。
 * - PHP / JavaScriptへCSS文字列を追加しない。
 * - 共通ヘルプチップ自体のCSSはここへ複製しない。
 * - 削除条件: AIの答え方画面そのものを別画面へ完全移行した場合のみ、このファイルとenqueueを同時削除する。
 */

body.mado-portal-standalone--ai-answer-settings .mado-portal-shell__content-frame.is-standard {
    box-sizing: border-box;
    width: 100%;
    max-width: calc(
        1140px
        + var(--mado-portal-page-gutter-x, clamp(18px, 2.4vw, 32px))
        + var(--mado-portal-page-gutter-x, clamp(18px, 2.4vw, 32px))
    );
    margin-right: auto;
    margin-left: auto;
    padding-right: var(--mado-portal-page-gutter-x, clamp(18px, 2.4vw, 32px));
    padding-left: var(--mado-portal-page-gutter-x, clamp(18px, 2.4vw, 32px));
}

body.mado-portal-standalone--ai-answer-settings .mado-portal-container {
    width: 100%;
    max-width: none;
    margin: 0;
}

body.mado-portal-standalone--ai-answer-settings .mado-crawl-view-answer.mado-ai-management-standalone {
    --mado-ai-answer-text: #0f172a;
    --mado-ai-answer-text-soft: #475569;
    --mado-ai-answer-muted: #64748b;
    --mado-ai-answer-border: #dbe5ef;
    --mado-ai-answer-border-strong: #cbd8e5;
    --mado-ai-answer-surface: #ffffff;
    --mado-ai-answer-surface-soft: #f8fcfd;
    --mado-ai-answer-primary: #0b6870;
    --mado-ai-answer-primary-soft: #e9f9fb;
    box-sizing: border-box;
    width: 100%;
    max-width: none;
    margin: 0;
    padding: 0;
    border: 0;
    border-radius: 0;
    background: transparent;
    color: var(--mado-ai-answer-text);
    box-shadow: none;
}

body.mado-portal-standalone--ai-answer-settings .mado-crawl-view-answer *,
body.mado-portal-standalone--ai-answer-settings .mado-crawl-view-answer *::before,
body.mado-portal-standalone--ai-answer-settings .mado-crawl-view-answer *::after {
    box-sizing: border-box;
}

body.mado-portal-standalone--ai-answer-settings .mado-crawl-view-answer .mado-crawl-usage-hero {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 0;
    align-items: stretch;
    margin: 0 0 28px;
}

body.mado-portal-standalone--ai-answer-settings .mado-crawl-view-answer .mado-crawl-usage-hero__copy {
    min-width: 0;
}

body.mado-portal-standalone--ai-answer-settings .mado-crawl-view-answer .mado-crawl-usage-eyebrow {
    margin: 0 0 8px;
    color: var(--mado-ai-answer-primary);
    font-size: 12px;
    font-weight: 800;
    line-height: 1.5;
    letter-spacing: 0.08em;
}

body.mado-portal-standalone--ai-answer-settings .mado-crawl-view-answer .mado-crawl-usage-title {
    margin: 0;
    color: var(--mado-ai-answer-text);
    line-height: 1.5;
}

body.mado-portal-standalone--ai-answer-settings .mado-crawl-view-answer .mado-crawl-usage-intro {
    max-width: 780px;
    margin: 12px 0 0;
    color: var(--mado-ai-answer-text-soft);
    font-size: 14px;
    line-height: 1.8;
}

body.mado-portal-standalone--ai-answer-settings .mado-ai-answer-settings-page,
body.mado-portal-standalone--ai-answer-settings .mado-ai-answer-settings-page * {
    min-width: 0;
}

body.mado-portal-standalone--ai-answer-settings .mado-ai-answer-settings-page {
    display: grid;
    width: 100%;
    margin: 0;
    color: var(--mado-ai-answer-text);
    font-family: var(--mado-portal-font-family, "Noto Sans JP", "Noto Sans", system-ui, -apple-system, "Segoe UI", sans-serif);
    font-size: 14px;
    line-height: 1.7;
}

body.mado-portal-standalone--ai-answer-settings #mado-ai-answer-section {
    width: 100%;
    padding: clamp(22px, 3.2vw, 30px);
    border: 1px solid var(--mado-ai-answer-border);
    border-radius: 20px;
    background: var(--mado-ai-answer-surface);
    box-shadow: 0 14px 38px rgba(15, 23, 42, 0.06);
}

body.mado-portal-standalone--ai-answer-settings #mado-ai-answer-section h3,
body.mado-portal-standalone--ai-answer-settings #mado-ai-answer-section h4,
body.mado-portal-standalone--ai-answer-settings #mado-ai-answer-section p,
body.mado-portal-standalone--ai-answer-settings #mado-ai-answer-section fieldset {
    margin: 0;
}

body.mado-portal-standalone--ai-answer-settings #mado-ai-answer-section fieldset {
    min-width: 0;
    padding: 0;
    border: 0;
}

body.mado-portal-standalone--ai-answer-settings #mado-ai-answer-section button,
body.mado-portal-standalone--ai-answer-settings #mado-ai-answer-section input,
body.mado-portal-standalone--ai-answer-settings #mado-ai-answer-section textarea {
    font-family: inherit;
}

body.mado-portal-standalone--ai-answer-settings #mado-ai-answer-section .screen-reader-text {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

body.mado-portal-standalone--ai-answer-settings #mado-ai-answer-section button:focus-visible,
body.mado-portal-standalone--ai-answer-settings #mado-ai-answer-section input:focus-visible,
body.mado-portal-standalone--ai-answer-settings #mado-ai-answer-section textarea:focus-visible,
body.mado-portal-standalone--ai-answer-settings #mado-ai-answer-section a:focus-visible {
    outline: 3px solid rgba(21, 169, 186, 0.26);
    outline-offset: 2px;
}

body.mado-portal-standalone--ai-answer-settings #mado-ai-answer-settings-form {
    display: grid;
    gap: 14px;
    margin: 22px 0 0;
}

body.mado-portal-standalone--ai-answer-settings #mado-ai-answer-section .mado-ai-usage-page__settings-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 14px;
}

body.mado-portal-standalone--ai-answer-settings #mado-ai-answer-section .mado-ai-setting-card {
    display: grid;
    align-content: start;
    gap: 12px;
    min-width: 0;
    padding: 16px;
    border: 1px solid var(--mado-ai-answer-border);
    border-radius: 14px;
    background: var(--mado-ai-answer-surface-soft);
    overflow-wrap: anywhere;
}

body.mado-portal-standalone--ai-answer-settings #mado-ai-answer-section .mado-ai-setting-card--wide {
    grid-column: 1 / -1;
}

body.mado-portal-standalone--ai-answer-settings #mado-ai-answer-section .mado-ai-setting-card__title {
    margin: 0 0 8px;
    color: #1e293b;
    font-size: 16px;
    font-weight: 900;
    line-height: 1.5;
    overflow-wrap: anywhere;
}

body.mado-portal-standalone--ai-answer-settings #mado-ai-answer-section .mado-ai-setting-card__title .mado-ui-help-chip {
    margin-left: 4px;
    vertical-align: middle;
}

body.mado-portal-standalone--ai-answer-settings #mado-ai-answer-section .mado-ai-setting-label {
    margin: 0;
    padding: 0;
    color: var(--mado-ai-answer-text);
    font-size: 13px;
    font-weight: 800;
    line-height: 1.5;
}

body.mado-portal-standalone--ai-answer-settings #mado-ai-answer-section .mado-ai-setting-help {
    margin: 0;
    color: var(--mado-ai-answer-muted);
    font-size: 12px;
    line-height: 1.65;
}

body.mado-portal-standalone--ai-answer-settings #mado-ai-answer-section .mado-ai-setting-help a {
    color: var(--mado-portal-link, #2271b1);
}

body.mado-portal-standalone--ai-answer-settings #mado-ai-answer-section .mado-ai-setting-textarea {
    width: 100%;
    min-width: 0;
    min-height: 132px;
    padding: 10px 12px;
    border: 1px solid var(--mado-ai-answer-border-strong);
    border-radius: 9px;
    background: #ffffff;
    color: var(--mado-ai-answer-text);
    font-size: 14px;
    line-height: 1.65;
    resize: vertical;
    box-shadow: none;
}

body.mado-portal-standalone--ai-answer-settings #mado-ai-answer-section .mado-ai-setting-textarea::placeholder {
    color: #64748b;
    font-size: 13px;
    font-weight: 400;
    opacity: 1;
}

body.mado-portal-standalone--ai-answer-settings #mado-ai-answer-section .mado-ai-setting-textarea:focus {
    border-color: var(--mado-ai-answer-primary);
    outline: 0;
    box-shadow: 0 0 0 3px rgba(15, 118, 110, 0.13);
}

body.mado-portal-standalone--ai-answer-settings #mado-ai-answer-section .mado-ai-range-row {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
    padding: 12px 0 0;
    border-top: 1px solid var(--mado-ai-answer-border);
    color: var(--mado-ai-answer-text-soft);
    font-size: 13px;
    font-weight: 400;
}

body.mado-portal-standalone--ai-answer-settings #mado-ai-answer-section .mado-ai-choice-grid {
    display: grid;
    gap: 10px;
}

/* 24px -> 36px: individual model group frames are now 1.5x farther apart. */
body.mado-portal-standalone--ai-answer-settings #mado-ai-answer-section .mado-ai-model-choice-stack {
    gap: 36px;
}

body.mado-portal-standalone--ai-answer-settings #mado-ai-answer-section .mado-ai-model-choice-card {
    display: grid;
    min-width: 0;
    padding: 16px;
    border: 1px solid #d8e4ef;
    border-radius: 10px;
    background: #ffffff;
    color: var(--mado-ai-answer-text);
}

body.mado-portal-standalone--ai-answer-settings #mado-ai-answer-section .mado-ai-model-choice-card > fieldset {
    display: grid;
    gap: 8px;
}

/*
 * 2026-08-12 visual tune:
 * - Previous target was 15px / 700. User requested one more 1px down and one more 100 weight down.
 * - Keep only the four model-group headings on this compact scale; major card headings remain unchanged.
 */
body.mado-portal-standalone--ai-answer-settings #mado-ai-answer-section .mado-ai-model-choice-title {
    position: relative;
    top: 1px;
    margin: 0;
    font-size: 14px;
    font-weight: 600;
    line-height: 1.5;
}

body.mado-portal-standalone--ai-answer-settings #mado-ai-answer-section .mado-ai-choice-card {
    position: relative;
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    align-items: center;
    min-width: 0;
    min-height: 46px;
    padding: 12px;
    border: 1px solid var(--mado-ai-answer-border);
    border-radius: 12px;
    background: #ffffff;
    color: var(--mado-ai-answer-text);
    cursor: pointer;
}

body.mado-portal-standalone--ai-answer-settings #mado-ai-answer-section .mado-ai-choice-card:has(input:checked) {
    border-color: #49b6c3;
    background: #eefbfd;
    box-shadow: 0 0 0 2px rgba(73, 182, 195, 0.10);
}

body.mado-portal-standalone--ai-answer-settings #mado-ai-answer-section .mado-ai-choice-card span {
    display: grid;
    gap: 2px;
    min-width: 0;
}

body.mado-portal-standalone--ai-answer-settings #mado-ai-answer-section .mado-ai-choice-card strong {
    color: var(--mado-ai-answer-text);
    font-size: 13px;
    font-weight: 800;
    line-height: 1.45;
}

body.mado-portal-standalone--ai-answer-settings #mado-ai-answer-section .mado-ai-answer-settings__save-scope {
    margin-top: 18px;
}

body.mado-portal-standalone--ai-answer-settings #mado-ai-answer-section .mado-ai-usage-page__settings-actions {
    display: flex;
    justify-content: flex-end;
}

body.mado-portal-standalone--ai-answer-settings #mado-ai-answer-section .mado-ai-answer-settings__save-button.button {
    appearance: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 44px;
    padding: 8px 18px;
    border: 1px solid #2eb2c1;
    border-radius: 10px;
    background: #e7f8fa;
    color: #0b6870;
    font-size: 14px;
    font-weight: 800;
    line-height: 1.4;
    text-decoration: none;
    text-shadow: none;
    box-shadow: none;
    cursor: pointer;
}

body.mado-portal-standalone--ai-answer-settings #mado-ai-answer-section .mado-ai-answer-settings__save-button.button:hover,
body.mado-portal-standalone--ai-answer-settings #mado-ai-answer-section .mado-ai-answer-settings__save-button.button:focus-visible {
    border-color: #2197a5;
    background: #dff4f7;
    color: #075861;
}

body.mado-portal-standalone--ai-answer-settings #mado-ai-answer-section .mado-ai-answer-settings__save-button.button:disabled {
    cursor: default;
    opacity: 0.64;
}

.mado-crawl-usage-alert {
    max-width: 760px;
    padding: 16px 18px;
    border: 1px solid #d8e4ef;
    border-radius: 14px;
    background: #ffffff;
    color: #0f172a;
    font-size: 14px;
    line-height: 1.7;
}

.mado-crawl-usage-alert--warning {
    border-color: #f1c36d;
    background: #fffaf0;
}

@media (max-width: 820px) {
    body.mado-portal-standalone--ai-answer-settings #mado-ai-answer-section .mado-ai-usage-page__settings-grid {
        grid-template-columns: minmax(0, 1fr);
    }

    body.mado-portal-standalone--ai-answer-settings #mado-ai-answer-section .mado-ai-setting-card--wide {
        grid-column: auto;
    }
}

@media (max-width: 640px) {
    body.mado-portal-standalone--ai-answer-settings .mado-portal-shell__content-frame.is-standard {
        padding-right: 12px;
        padding-left: 12px;
    }

    body.mado-portal-standalone--ai-answer-settings .mado-crawl-view-answer .mado-crawl-usage-hero {
        margin-bottom: 22px;
    }

    body.mado-portal-standalone--ai-answer-settings #mado-ai-answer-section {
        padding: 16px;
        border-radius: 18px;
    }

    body.mado-portal-standalone--ai-answer-settings #mado-ai-answer-settings-form {
        margin-top: 16px;
    }

    body.mado-portal-standalone--ai-answer-settings #mado-ai-answer-section .mado-ai-model-choice-stack {
        gap: 28px;
    }

    body.mado-portal-standalone--ai-answer-settings #mado-ai-answer-section .mado-ai-usage-page__settings-actions {
        justify-content: stretch;
    }

    body.mado-portal-standalone--ai-answer-settings #mado-ai-answer-section .mado-ai-answer-settings__save-button.button {
        width: 100%;
    }
}
