/*
 * All selectors are scoped to BookMaster AI Tools.
 * This file does not style or modify the website header, sidebar, menus, or theme containers.
 */
.bmat-app,
.bmat-directory {
    --bmat-green: #00b54f;
    --bmat-green-dark: #009640;
    --bmat-navy: #17223b;
    --bmat-text: #263043;
    --bmat-muted: #737d8e;
    --bmat-border: #e3e8ef;
    --bmat-bg: #f7f9fc;
    --bmat-soft-green: #effbf4;
    --bmat-white: #ffffff;
    --bmat-danger: #b42318;
    width: 100%;
    max-width: 1280px;
    margin: 0 auto;
    padding: 28px 18px 42px;
    color: var(--bmat-text);
    font-family: "Outfit", Arial, sans-serif;
    font-size: 16px;
    line-height: 1.5;
    box-sizing: border-box;
}

.bmat-app *,
.bmat-directory * {
    box-sizing: border-box;
}

.bmat-app [hidden],
.bmat-directory [hidden] {
    display: none !important;
}

.bmat-app__header {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 22px;
    padding: 0 2px;
}

.bmat-app__header-icon {
    display: grid;
    flex: 0 0 54px;
    width: 54px;
    height: 54px;
    place-items: center;
    border-radius: 15px;
    background: var(--bmat-green);
    color: #fff;
    box-shadow: 0 10px 24px rgba(0, 181, 79, .2);
}

.bmat-eyebrow {
    display: block;
    margin: 0 0 3px;
    color: var(--bmat-green-dark);
    font-size: 12px;
    font-weight: 600;
    letter-spacing: .065em;
    text-transform: uppercase;
}

.bmat-app h2,
.bmat-app h3,
.bmat-app h4,
.bmat-directory h2,
.bmat-directory h3 {
    margin: 0;
    color: var(--bmat-navy);
    font-family: "Poppins", Arial, sans-serif;
    font-weight: 600;
    line-height: 1.25;
}

.bmat-app__header h2 {
    margin: 0 0 4px;
    font-size: clamp(27px, 3vw, 36px);
    letter-spacing: -.025em;
}

.bmat-app__header p,
.bmat-panel__heading p,
.bmat-result-heading p {
    margin: 0;
    color: var(--bmat-muted);
}

.bmat-layout {
    display: grid;
    grid-template-columns: minmax(360px, .9fr) minmax(0, 1.35fr);
    gap: 22px;
    align-items: start;
}

.bmat-panel {
    overflow: hidden;
    border: 1px solid var(--bmat-border);
    border-radius: 18px;
    background: var(--bmat-white);
    box-shadow: 0 12px 34px rgba(32, 46, 66, .06);
}

.bmat-panel--form {
    padding: 24px;
}

.bmat-panel--result {
    min-height: 610px;
    background: var(--bmat-white);
}

.bmat-panel__heading,
.bmat-result-heading {
    display: flex;
    align-items: center;
    gap: 12px;
}

.bmat-panel__heading {
    margin-bottom: 22px;
}

.bmat-result-heading {
    padding: 22px 24px;
    border-bottom: 1px solid var(--bmat-border);
}

.bmat-panel__heading h3,
.bmat-result-heading h3 {
    margin-bottom: 2px;
    font-size: 18px;
}

.bmat-step {
    display: grid;
    flex: 0 0 34px;
    width: 34px;
    height: 34px;
    place-items: center;
    border-radius: 50%;
    background: var(--bmat-soft-green);
    color: var(--bmat-green-dark);
    font-weight: 600;
}

.bmat-form {
    position: relative;
    margin: 0;
}

.bmat-form-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
}

.bmat-field--full {
    grid-column: 1 / -1;
}

.bmat-field label {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin: 0 0 7px;
    color: var(--bmat-navy);
    font-size: 14px;
    font-weight: 600;
}

.bmat-field label small {
    color: #9099a7;
    font-size: 11px;
    font-weight: 400;
}

.bmat-field input,
.bmat-field select,
.bmat-field textarea {
    display: block;
    width: 100%;
    min-height: 48px;
    margin: 0 !important;
    padding: 11px 13px;
    border: 1px solid #dce2e9;
    border-radius: 10px;
    outline: none;
    background: #fff;
    color: var(--bmat-text);
    box-shadow: none;
    font: 400 14px/1.45 "Outfit", Arial, sans-serif;
    transition: border-color .18s ease, box-shadow .18s ease;
}

.bmat-field textarea {
    min-height: 118px;
    resize: vertical;
}

.bmat-field input::placeholder,
.bmat-field textarea::placeholder {
    color: #a6aebb;
}

.bmat-field input:focus,
.bmat-field select:focus,
.bmat-field textarea:focus {
    border-color: var(--bmat-green);
    box-shadow: 0 0 0 3px rgba(0, 181, 79, .11);
}

.bmat-generate-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 9px;
    width: 100%;
    min-height: 51px;
    margin: 20px 0 0 !important;
    padding: 13px 18px;
    border: 1px solid var(--bmat-green) !important;
    border-radius: 10px;
    background: var(--bmat-green) !important;
    color: #fff !important;
    cursor: pointer;
    box-shadow: 0 8px 18px rgba(0, 181, 79, .17);
    font: 600 15px/1 "Outfit", Arial, sans-serif;
    text-decoration: none;
    transition: background .18s ease, border-color .18s ease, transform .18s ease;
}

.bmat-generate-button:hover,
.bmat-generate-button:focus {
    border-color: var(--bmat-green-dark) !important;
    background: var(--bmat-green-dark) !important;
    color: #fff !important;
    transform: translateY(-1px);
}

.bmat-generate-button:disabled {
    cursor: wait;
    opacity: .76;
    transform: none;
}

.bmat-button-icon {
    font-size: 17px;
}

.bmat-button-loader {
    display: none;
    width: 17px;
    height: 17px;
    border: 2px solid rgba(255, 255, 255, .45);
    border-top-color: #fff;
    border-radius: 50%;
    animation: bmat-spin .75s linear infinite;
}

.bmat-generate-button.is-loading .bmat-button-icon {
    display: none;
}

.bmat-generate-button.is-loading .bmat-button-loader {
    display: inline-block;
}

@keyframes bmat-spin {
    to { transform: rotate(360deg); }
}

.bmat-form-note {
    margin: 12px 0 0;
    color: var(--bmat-muted);
    font-size: 12px;
    line-height: 1.5;
    text-align: center;
}

.bmat-message {
    display: none;
    margin: 14px 0 0;
    padding: 11px 13px;
    border-radius: 9px;
    font-size: 13px;
    line-height: 1.45;
}

.bmat-message.is-success,
.bmat-message.is-error {
    display: block;
}

.bmat-message.is-success {
    border: 1px solid #b7ebca;
    background: #effcf4;
    color: #067647;
}

.bmat-message.is-error {
    border: 1px solid #ffd0cc;
    background: #fff2f1;
    color: var(--bmat-danger);
}

.bmat-empty-state {
    display: flex;
    min-height: 520px;
    padding: 45px 28px;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    background:
        radial-gradient(circle at 50% 25%, rgba(0, 181, 79, .09), transparent 29%),
        linear-gradient(180deg, #ffffff 0%, #f8fbf9 100%);
}

.bmat-empty-state__icon {
    display: grid;
    width: 72px;
    height: 72px;
    margin-bottom: 17px;
    place-items: center;
    border: 1px solid #cdeedb;
    border-radius: 20px;
    background: #fff;
    color: var(--bmat-green);
    box-shadow: 0 12px 30px rgba(0, 181, 79, .1);
}

.bmat-empty-state h4 {
    margin-bottom: 7px;
    font-size: 21px;
}

.bmat-empty-state p {
    max-width: 400px;
    margin: 0;
    color: var(--bmat-muted);
}

.bmat-result-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 15px 20px;
    border-bottom: 1px solid var(--bmat-border);
    background: #fbfcfd;
}

.bmat-result-toolbar > div:first-child {
    display: flex;
    flex-direction: column;
}

.bmat-result-label {
    color: var(--bmat-muted);
    font-size: 11px;
    letter-spacing: .06em;
    text-transform: uppercase;
}

.bmat-result-actions {
    display: flex;
    gap: 8px;
}

.bmat-result-actions button {
    min-height: 36px;
    margin: 0 !important;
    padding: 8px 12px;
    border: 1px solid var(--bmat-border) !important;
    border-radius: 8px;
    background: #fff !important;
    color: var(--bmat-navy) !important;
    cursor: pointer;
    font: 600 12px/1 "Outfit", Arial, sans-serif;
}

.bmat-result-actions button:hover {
    border-color: var(--bmat-green) !important;
    color: var(--bmat-green-dark) !important;
}

.bmat-result-content {
    max-height: 720px;
    overflow: auto;
    padding: 28px;
}

.bmat-generated-exam {
    color: #263043;
    font-size: 15px;
    line-height: 1.7;
}

.bmat-generated-exam h1,
.bmat-generated-exam h2,
.bmat-generated-exam h3,
.bmat-generated-exam h4,
.bmat-generated-exam h5 {
    margin: 1.25em 0 .5em;
    color: var(--bmat-navy);
    font-family: "Poppins", Arial, sans-serif;
    font-weight: 600;
}

.bmat-generated-exam h1:first-child,
.bmat-generated-exam h2:first-child,
.bmat-generated-exam h3:first-child {
    margin-top: 0;
}

.bmat-generated-exam h1 { font-size: 28px; }
.bmat-generated-exam h2 { font-size: 22px; }
.bmat-generated-exam h3 { font-size: 18px; }
.bmat-generated-exam h4 { font-size: 16px; }

.bmat-generated-exam p {
    margin: 0 0 1em;
}

.bmat-generated-exam ol,
.bmat-generated-exam ul {
    margin: 0 0 1.15em;
    padding-left: 1.45em;
}

.bmat-generated-exam li {
    margin-bottom: .55em;
}

.bmat-generated-exam hr {
    height: 1px;
    margin: 24px 0;
    border: 0;
    background: var(--bmat-border);
}

.bmat-generated-exam table {
    width: 100%;
    margin: 16px 0 22px;
    border-collapse: collapse;
}

.bmat-generated-exam th,
.bmat-generated-exam td {
    padding: 10px 11px;
    border: 1px solid var(--bmat-border);
    text-align: left;
    vertical-align: top;
}

.bmat-generated-exam th {
    background: #f5f8f6;
    color: var(--bmat-navy);
}

/* Tools directory */
.bmat-directory__intro {
    max-width: 700px;
    margin-bottom: 22px;
}

.bmat-directory__intro h2 {
    margin-bottom: 7px;
    font-size: clamp(27px, 3vw, 36px);
}

.bmat-directory__intro p {
    margin: 0;
    color: var(--bmat-muted);
}

.bmat-tools-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 18px;
}

.bmat-tool-card {
    display: flex;
    min-height: 255px;
    padding: 22px;
    flex-direction: column;
    border: 1px solid var(--bmat-border);
    border-radius: 17px;
    background: #fff;
    box-shadow: 0 12px 32px rgba(32, 46, 66, .06);
}

.bmat-tool-card__icon {
    display: grid;
    width: 48px;
    height: 48px;
    margin-bottom: 18px;
    place-items: center;
    border-radius: 13px;
    background: var(--bmat-soft-green);
    color: var(--bmat-green-dark);
}

.bmat-tool-card__tag {
    display: inline-flex;
    margin-bottom: 7px;
    color: var(--bmat-green-dark);
    font-size: 11px;
    font-weight: 600;
    letter-spacing: .05em;
    text-transform: uppercase;
}

.bmat-tool-card h3 {
    margin-bottom: 8px;
    font-size: 20px;
}

.bmat-tool-card p {
    margin: 0;
    color: var(--bmat-muted);
}

.bmat-tool-card__link {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    margin-top: auto;
    padding-top: 18px;
    color: var(--bmat-green-dark) !important;
    font-weight: 600;
    text-decoration: none !important;
}

.bmat-tool-card__link:hover {
    color: var(--bmat-green) !important;
}

@media (max-width: 1024px) {
    .bmat-layout {
        grid-template-columns: 1fr;
    }

    .bmat-panel--result {
        min-height: 500px;
    }

    .bmat-empty-state {
        min-height: 410px;
    }

    .bmat-tools-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 640px) {
    .bmat-app,
    .bmat-directory {
        padding: 20px 12px 32px;
    }

    .bmat-app__header {
        align-items: flex-start;
    }

    .bmat-app__header-icon {
        flex-basis: 46px;
        width: 46px;
        height: 46px;
        border-radius: 13px;
    }

    .bmat-app__header h2 {
        font-size: 25px;
    }

    .bmat-panel--form {
        padding: 19px;
    }

    .bmat-result-heading {
        padding: 19px;
    }

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

    .bmat-field--half,
    .bmat-field--full {
        grid-column: 1;
    }

    .bmat-result-toolbar {
        align-items: flex-start;
        flex-direction: column;
    }

    .bmat-result-content {
        max-height: none;
        padding: 20px;
    }

    .bmat-tools-grid {
        grid-template-columns: 1fr;
    }
}

@media print {
    body.bmat-printing * {
        visibility: hidden !important;
    }

    body.bmat-printing .bmat-print-target,
    body.bmat-printing .bmat-print-target * {
        visibility: visible !important;
    }

    body.bmat-printing .bmat-print-target {
        position: absolute !important;
        inset: 0 auto auto 0 !important;
        width: 100% !important;
        max-width: none !important;
        margin: 0 !important;
        padding: 0 !important;
    }

    body.bmat-printing .bmat-app__header,
    body.bmat-printing .bmat-panel--form,
    body.bmat-printing .bmat-result-heading,
    body.bmat-printing .bmat-result-toolbar {
        display: none !important;
    }

    body.bmat-printing .bmat-layout,
    body.bmat-printing .bmat-panel--result {
        display: block !important;
        border: 0 !important;
        box-shadow: none !important;
    }

    body.bmat-printing .bmat-result-content {
        max-height: none !important;
        overflow: visible !important;
        padding: 0 !important;
    }
}

.bmat-unavailable {
    display: block;
    padding: 18px 20px;
    border: 1px solid #ffd0cc;
    border-radius: 12px;
    background: #fff2f1;
    color: #b42318;
    font: 500 14px/1.5 "Outfit", Arial, sans-serif;
}
