/* ============================================================
   AI Lesson Plan Generator – v2.1 design
   (Figma 22557-61486 input card · 22587-44120 result box)
   Palette: heading #101010 · paragraph #333 · disable #8D8F94
            placeholder #CCCDCF · border #E5E5E5 · light-grey #F9F9F9
   ============================================================ */

/* ---------- Tool container / input card --------------------- */
.tool-section .tool__container {
    background: transparent;
    width: calc(100% - 20px);
    max-width: 920px;
    box-shadow: none;
    padding: 0;
}

.tool__container.ai_tool .input__output {
    gap: 20px;
}

.lesson-input-card {
    display: flex;
    flex-direction: column;
    /* gap: 20px; */
    padding: 15px;
    width: 100%;
    max-width: 920px;
    margin: 0 auto;
    background: #ffffff;
    box-shadow: 0px 10px 50px rgba(0, 0, 0, 0.1);
    border-radius: 20px;
}

div#ajaxloaderwrapper {
    border-radius: 20px;
}

.form__container .input__container {
    gap: 0px !important;
}

/* ---------- Shared field bits ------------------------------- */
.lesson-input-card .input_text_label {
    display: block;
    margin-bottom: 10px;
    font-size: 16px;
    font-weight: var(--font-weight-semibold, 600);
    line-height: 20px;
    color: #101010;
}

/* ---------- Row 1: Lesson Title + Subject ------------------- */
.lesson-top-row {
    display: flex;
    width: 100%;
    flex-wrap: wrap;
    align-items: flex-start;
    flex-direction: row;
}

.lesson-top-row .lesson-field {
    /* flex: 1 1 300px; */
    min-width: 0;
    margin: 0;
    padding: 0;
}

.lesson-input-wrap {
    position: relative;
    width: 100%;
}

.tool__container.ai_tool .lesson-text-input {
    width: 100%;
    height: 50px;
    border: 1px solid #e5e5e5;
    border-radius: 12px;
    padding: 15px 34px 15px 10px;
    font-size: 16px;
    line-height: 20px;
    color: #101010;
    background: #ffffff;
}

.lesson-text-input::placeholder,
.lesson-textarea::placeholder {
    color: #cccdcf;
}

/* ---------- Main textarea ----------------------------------- */
.lesson-understand-field {
    width: 100%;
    margin: 0;
    padding: 0;
}

/* The wrap draws the box so the counter sits in its own row below the
   textarea instead of floating over (and under) the scrolled text. */
.lesson-textarea-wrap {
    display: flex;
    flex-direction: column;
    position: relative;
    width: 100%;
    border: 1px solid #e5e5e5;
    border-radius: 12px;
    background: #ffffff;
    overflow: hidden;
}

.lesson-textarea-wrap:focus-within {
    border-color: #101010;
}

.tool__container.ai_tool .lesson-textarea {
    width: 100%;
    height: 60px !important;
    min-height: 60px !important;
    border: 0 !important;
    border-radius: 0 !important;
    padding: 10px 30px 0 10px !important;
    font-size: 16px;
    line-height: 20px;
    color: #101010;
    background: #ffffff;
    resize: none;
}

/* Long placeholders: hide the native one and show a 2-line clamped copy,
   so an empty field never overflows or shows a scrollbar. */
.tool__container.ai_tool .lesson-textarea:placeholder-shown {
    overflow-y: hidden;
}

.tool__container.ai_tool .lesson-textarea::placeholder {
    color: transparent;
}

.lesson-textarea-placeholder {
    display: none;
    position: absolute;
    top: 10px;
    left: 10px;
    right: 30px;
    font-family: inherit;
    font-size: 16px;
    line-height: 20px;
    color: #8d8f94;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    pointer-events: none;
}

.lesson-textarea:placeholder-shown ~ .lesson-textarea-placeholder {
    display: -webkit-box;
}

.lesson-char-count {
    align-self: flex-end;
    max-width: 100%;
    padding: 0 12px 10px;
    font-size: 14px;
    line-height: 20px;
    color: #8d8f94;
    white-space: nowrap;
    pointer-events: none;
}

/* Clear (X) inside inputs / textarea */
.lesson-input-card .textarea-clear-input {
    position: absolute;
    right: 10px;
    top: 15px;
    width: 16px;
    height: 16px;
    cursor: pointer;
    display: none;
}

.lesson-textarea-wrap .textarea-clear-input {
    top: 10px;
    right: 10px;
}

/* ---------- Controls row: dropdowns + Generate -------------- */
.lesson-controls-row {
    width: 100%;
    align-items: flex-end !important;
    justify-content: space-between;
    gap: 20px;
    flex-wrap: wrap;
}

.lesson-dropdowns {
    align-items: flex-end;
    gap: 20px;
    flex: unset;
    width: fit-content !important;
}

.lesson-grade-dd,
.lesson-duration-dd {
    max-width: 155px;
    min-width: 110px;
    margin: 0;
}

.lesson-grade-dd .dropdown___label,
.lesson-duration-dd .dropdown___label {
    color: #8d8f94;
    font-size: 14px;
    font-weight: 400;
    margin-bottom: 10px;
}

.lesson-grade-dd .selected__option__container,
.lesson-duration-dd .selected__option__container {
    background: #f9f9f9;
    border: 1px solid #e5e5e5;
    border-radius: 12px;
    height: 36px;
    padding: 4px 10px;
}

.lesson-grade-dd .selected__option,
.lesson-duration-dd .selected__option {
    font-size: 14px;
    color: #101010;
}

.dropdown___container {
    gap: 0px !important;
}

/* Arrow: point up when closed, flip to down when the list opens */
.lesson-input-card .dropdown___container .selected__option__container img {
    transform: rotate(180deg);
}

.lesson-input-card .dropdown___container .selected__option__container img.rotate180 {
    transform: rotate(0deg);
}
.dropdown___container .selected__option{
    text-align: left;
}
.lesson-generate-wrap {
    flex: 0 0 auto;
    width: fit-content !important;
    position: relative;
}

#submit__btn__shadow__root,
#submit-btn {
    display: flex;
    justify-content: center;
}

.lesson-input-card #submit-btn,
#submit-btn {
    padding: 10px 20px !important;
    min-width: 180px;
    line-height: 20px;
    font-size: 18px;
    color: #ffffff;
    background: #333333;
    border: none !important;
    border-radius: 99px !important;
}

/* ============================================================
   Output – Generated result (Figma 22587-44120)
   Lives INSIDE the input card: no card chrome of its own.
   ============================================================ */
.output__box__container {
    display: flex;
    flex-direction: column;
    gap: 12px;
    width: 100%;
    margin: 20px 0 0;
    background: transparent;
    border-radius: 0;
    box-shadow: none;
    padding: 0;
}

.output__container {
    flex-direction: column;
}

.lesson-result-card {
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.lesson-result-header {
    display: flex;
    align-items: center;
    gap: 10px;
}

.lesson-result-title {
    font-size: 16px;
    font-weight: var(--font-weight-semibold, 600);
    line-height: 20px;
    color: #101010;
}

/* Mobile expand header (Figma 23945-45236): word count + expand/collapse pill */
.lesson-result-header-extra {
    display: none;
    align-items: center;
    gap: 10px;
    margin-left: auto;
}

.lesson-result-words {
    font-size: 14px;
    line-height: 20px;
    color: #8d8f94;
    white-space: nowrap;
}

.lesson-result-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
    width: 32px;
    height: 32px;
    padding: 0;
    background: #ffffff;
    border: 1px solid #e5e5e5;
    border-radius: 50%;
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.lesson-result-toggle:hover {
    background: #f9f9f9;
}

.lesson-result-toggle svg {
    display: block;
    width: 32px;
    height: 32px;
}

.lesson-result-toggle.d-none {
    display: none;
}

.lesson-result-box {
    position: relative;
    display: flex;
    flex-direction: column;
    width: 100%;
    background: #fff;
    border: 1px solid #e5e5e5;
    border-radius: 10px;
    overflow: visible;
}

.lesson-result-box .output-content {
    width: 100%;
    padding: 10px;
    font-size: 16px;
    line-height: 22px;
    color: #333;
    min-height: 200px;
    max-height: 460px;
    overflow-y: auto;
    outline: none;
}

.lesson-result-box .output-content ul,
.lesson-result-box .output-content ol {
    padding-left: 19px;
}

.lesson-result-box .output-content p {
    font-size: 16px !important;
}

.tooltip:after,
.copy-tooltip:after {
    top: -12px !important;
}

/* Parsed markdown: the global `* { margin: 0 }` reset strips every default
   gap, so the blocks marked emits need their own spacing. */
.lesson-result-box .output-content h1,
.lesson-result-box .output-content h2,
.lesson-result-box .output-content h3,
.lesson-result-box .output-content h4,
.lesson-result-box .output-content h5,
.lesson-result-box .output-content h6 {
    margin: 18px 0 8px;
    line-height: 1.35;
}

.lesson-result-box .output-content h1 {
    font-size: 20px;
}

.lesson-result-box .output-content h2 {
    font-size: 18px;
}

.lesson-result-box .output-content h3 {
    font-size: 17px;
}

.lesson-result-box .output-content h4,
.lesson-result-box .output-content h5,
.lesson-result-box .output-content h6 {
    font-size: 16px;
}

.lesson-result-box .output-content p,
.lesson-result-box .output-content ul,
.lesson-result-box .output-content ol,
.lesson-result-box .output-content pre,
.lesson-result-box .output-content table,
.lesson-result-box .output-content blockquote {
    margin: 0 0 12px;
}

.lesson-result-box .output-content li {
    margin-bottom: 4px;
}

.lesson-result-box .output-content>*:first-child {
    margin-top: 0;
}

.lesson-result-box .output-content hr {
    margin: 16px 0;
    border: 0;
    border-top: 1px solid #e5e5e5;
}

.lesson-result-box .output-content blockquote {
    padding-left: 12px;
    border-left: 3px solid #e5e5e5;
    color: #555;
}

.lesson-result-box .output-content table {
    width: 100%;
    border-collapse: collapse;
}

.lesson-result-box .output-content th,
.lesson-result-box .output-content td {
    padding: 6px 8px;
    border: 1px solid #e5e5e5;
    text-align: left;
}

.lesson-result-box .output-content pre {
    padding: 10px;
    background: #f6f6f6;
    border-radius: 6px;
    overflow-x: auto;
}

/* Bottom bar: word count left, copy/download icon buttons right */
.lesson-result-bottom {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    height: 60px;
    padding: 10px;
    border-top: 1px solid #e5e5e5;
}

.lesson-word-count {
    font-size: 14px;
    line-height: 20px;
    color: #8d8f94;
}

.lesson-word-count span {
    font-weight: var(--font-weight-medium, 500);
}

.lesson-result-actions {
    display: flex;
    align-items: center;
}

.lesson-action-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 8px;
    background: transparent;
    border: none;
    border-radius: 99px;
    cursor: pointer;
}

.lesson-action-btn:hover {
    background: #f9f9f9;
}

.lesson-action-btn img {
    display: block;
    width: 20px;
    height: 20px;
}

/* Output loader overlay */
#ajaxloaderwrapperOutput {
    position: absolute;
    inset: 0;
    background: rgba(255, 255, 255, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 6;
}

.inputArea-disabled {
    position: relative;
}

.inputArea-disabled::before {
    content: '';
    position: absolute;
    inset: 0;
    z-index: 2;
}

.feedback-form-container {
    margin: auto;
}

/* ============================================================
   Content sections (shared layout with other tools)
   ============================================================ */
.feature_lists_description_container {
    display: flex;
    flex-direction: row;
    gap: 24px;
}

.feature_lists_description_container .feature_lists_image {
    flex: 1;
}

.feature_lists_description_container .feature_lists {
    flex: 1;
    grid-template-columns: repeat(1, minmax(250px, 1fr));
    max-width: 618px;
}

.feature_lists_description_container img {
    width: 100%;
    max-width: 618px;
}

.points_list .point_container {
    justify-content: center;
}

.dropdown___label {
    text-align: left !important;
}

.tool-section .tool__container.ai_tool #captcha_container {
    bottom: 35px !important;
}

/* ============================================================
   Responsive
   ============================================================ */
@media (max-width: 1024px) {
    .tool_options {
        flex-direction: row;
        text-align: start;
    }
}

@media (max-width: 992px) {
    .lesson-controls-row {
        align-items: stretch;
    }

    .feature_lists_description_container {
        flex-direction: column;
    }

    .feature_lists_description_container .feature_lists {
        max-width: 100%;
    }

    .feature_lists_image {
        display: flex;
        justify-content: center;
    }

    .lesson-controls-row {
        flex-direction: unset !important;
    }

    .lesson-dropdowns {
        flex-direction: row !important;
    }

    #clear-btn {
        height: 16px;
        width: 16px;
    }
}

@media (max-width: 768px) {
    /* .lesson-top-row {
        gap: 16px;
    } */

    /* .lesson-top-row .lesson-field {
        flex: 1 1 100%;
    } */

    .lesson-dropdowns {
        width: 100% !important;
    }

    .lesson-grade-dd,
    .lesson-duration-dd {
        flex: 1 1 0;
        max-width: 50%;
    }

    .lesson-generate-wrap {
        width: 100% !important;
    }

    .lesson-input-card #submit-btn {
        width: 100%;
        align-self: center;
    }
/* 
    .tool-section .tool__container.ai_tool #captcha_container {
        bottom: -40px !important;
    } */
}

/* Mobile: expandable result header (Figma 23945-45236) */
@media (max-width: 767px) {
    .lesson-result-card {
        gap: 0;
    }

    .lesson-result-header {
        justify-content: space-between;
        padding: 9px 20px;
        background: #f9f9f9;
        border: 1px solid #e5e5e5;
        border-bottom: 0;
        border-radius: 12px 12px 0 0;
    }

    .lesson-result-header-extra {
        display: flex;
    }

    /* the header already shows the count on mobile */
    .lesson-result-bottom .lesson-word-count {
        visibility: hidden;
    }

    .lesson-result-box {
        border-top: 0;
        border-radius: 0 0 10px 10px;
    }

    .lesson-result-box .output-content {
        max-height: 450px;
    }
    .tool__container.ai_tool .output__box {
        border-radius: 0 !important;
    }

    .lesson-input-card {
        padding: 10px;
    }

    .output__box__container {
        margin-top: 10px;
    }
}

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

    .lesson-controls-row {
        flex-direction: column;
        align-items: stretch !important;
    }

    .lesson-generate-wrap {
        margin: auto;
    }
}

@media (max-width: 520px) {
    
    .dropdown___container,
    .form__container .input__container {
        min-width: 147px !important;
    }
}

@media (max-width: 425px) {
    #submit__btn__shadow__root, #submit-btn {
        width: 100%;
    }
}

@media (max-width: 374px) {
    .lesson-dropdowns {
        display: flex;
        flex-direction: column !important;
        align-items: stretch !important;
    }

    .lesson-grade-dd,
    .lesson-duration-dd {
        max-width: 100%;
    }

    /* .lesson-grade-dd,
    .lesson-duration-dd {
        max-width: 100%;
    }

    .dropdown___container,
    .form__container .input__container {
        min-width: 100% !important;
    } */
}