#ai-agent-trigger-school {
    max-width: 1600px;
    margin: 0 auto;
    padding: 15px;
    background: #3A7ECC;
    border-radius: 8px;
    box-shadow: none;
    display: flex;
    flex-direction: column;
    font-family: Arial, sans-serif;
    min-height: 400px;
    height: 635px;
    position: relative;
}

#response-area-school {
    margin-bottom: 0;
    padding: 0px 15px 0px 15px;
    background: #3A7ECC;
    border-radius: 8px;
    max-height: 550px;
    height: 100%;
    overflow-y: auto;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    gap: 10px;
    scroll-behavior: smooth;
}

#scroll-buffer-school {
    max-height: 460px;
    height: 100%;
    flex-shrink: 0;
    pointer-events: none;
    transition: height 0.6s ease, opacity 0.3s ease;
    opacity: 1;
}

.hidden-scroll-buffer-school {
    height: 0 !important;
    opacity: 0;
    overflow: hidden;
}

#input-area-school {
    max-width: 850px;
    margin: 0 auto;
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    background: #3A3A3A;
    border-radius: 20px;
    border: 1px solid rgba(220, 220, 220, 0.2);
    padding-right: 15px;
    width: 100%;
    gap: 15px;
    box-sizing: border-box;
    /* Add overflow to catch any forced resizing */
    overflow: visible;
}

.input-centered-school {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, calc(-50% - 30px));
    z-index: 500;
    width: 90%;
    max-width: 850px;
}

#input-area-school > button {
    flex-shrink: 0 !important;
    flex-grow: 0 !important;
    flex-basis: 38px !important;
    width: 38px !important;
    height: 38px !important;
    min-width: 38px !important;
    min-height: 38px !important;
    max-width: 38px !important;
    max-height: 38px !important;
    padding: 0 !important;
    margin: 0px 0px 18px 0px !important;
    box-sizing: border-box !important;
    border-radius: 50% !important;
    display: flex !important;
    justify-content: center !important;
    align-items: center !important;
    cursor: pointer !important;
    align-self: flex-end !important;
}

#ai-query-school {
    flex: 1;
    padding: 12px 12px 12px 17px;
    font-size: 16px;
    border: none;
    border-radius: 20px;
    resize: none;
    outline: none;
    transition: border-color 0.3s ease;
    color: #fff;
    background: transparent;
    overflow-y: auto;
    max-height: calc(1.5em * 4 + 24px); /* Approx. 4 lines + padding */
    line-height: 1.5em;
    user-select: text !important;
    pointer-events: auto !important;
    -webkit-user-select: text !important;
    -moz-user-select: text !important;
    -ms-user-select: text !important;
}

/* Placeholder text in white */
#ai-query-school::placeholder {
    color: #fff;
    opacity: 1; /* Ensures full opacity on all browsers */
}

#ai-query-school::selection {
    background-color: rgba(255, 255, 255, 0.3); /* light translucent white */
}

#submit-query-school {
    background-color: #ffffff !important;
    color: #000000 !important;
    border: none !important;
    font-size: 18px !important;
    transition: transform 0.2s ease, background-color 0.3s ease !important;
    aspect-ratio: 1 / 1 !important;
}

#submit-query-school:hover {
    transform: scale(1.02) !important;
    background-color: #e6e6e6 !important;
}

#voice-btn-school {
    background-color: transparent !important;
    color: #ffffff !important;
    border: 2px solid #ffffff !important;
    font-size: 18px !important;
    transition: transform 0.2s ease, background-color 0.3s ease !important;
    aspect-ratio: 1 / 1 !important;
}

#voice-btn-school:hover {
    transform: scale(1.02) !important;
    background-color: rgba(255, 255, 255, 0.1) !important;
}

#submit-query-school i,
#voice-btn-school i {
    font-size: 18px !important;
    line-height: 1 !important;
}

.answer-source-area-school {
    display: none;
    background-color: transparent;
    border-radius: 8px;
    padding-bottom: 25px;

    display: flex;
    justify-content: flex-start; /* Align to the left */
    align-items: center;         /* Ensure vertical alignment is fine, but it's not really relevant here */
    position: relative;
    width: 100%;
    animation: fadeIn 0.4s ease forwards;
}

.icon-button-school {
    background-color: transparent;
    border: none;
    border-radius: 50%;
    padding: 4px;
    cursor: pointer;
    transition: background-color 0.2s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

/* Hover effect: light grey round background */
.icon-button-school:hover {
    background-color: rgba(200, 200, 200, 0.2);
}

/* Consistent icon size */
.icon-svg-school {
    width: 17px;
    height: 17px;
    stroke: white; /* or change to #3A3A3A for dark icons */
}

/* Optional: remove stroke on hover if you want a change effect */
.icon-button-school:hover .icon-svg-school {
    stroke: white;
}

.source-button-school,
.send-sentence-ready-event-school,
.retry-button-school,
.copy-latest-ai-message-school {
    margin-left: 10px;
    width: 30px;
    height: 30px;
    background: transparent;
    color: white;
    border: none;
    border-radius: 50%;
    font-size: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background 0.3s ease;
}

.source-button-school:hover,
.send-sentence-ready-event-school:hover,
.retry-button-school:hover,
.copy-latest-ai-message-school:hover {
    background: rgba(200, 200, 200, 0.2);
}

/* Optional: make icons sharp */
.source-button-school i,
.send-sentence-ready-event-school i,
.retry-button-school i,
.copy-latest-ai-message-school i {
    pointer-events: none;
}

/* Center the page-buttons-container */
.page-buttons-container-school {
    position: absolute;
    left: 180px;
    display: flex;
    gap: 5px;
    z-index: 500;
}

button.page-button-school {
    position: relative;
    margin: 0 5px;
    padding: 6.5px 5px;
    border-radius: 5px;
    background-color: rgba(200, 200, 200, 0.2);
    color: white;
    border: none;
    cursor: pointer;
}

button.page-button-school:hover {
    position: relative;
    margin: 0 5px;
    padding: 6.5px 5px;
    border-radius: 5px;
    background-color: white;
    color: #3A3A3A;
    border: none;
    cursor: pointer;
}

button.page-button-school.active {
    background-color: white;
    color: #3A3A3A;
}

.tooltip-wrapper-school {
    position: absolute;
    display: inline-block;
    overflow: visible; /* Required to show the arrow */
    z-index: 9999;
}

.tooltip-school {
    visibility: hidden;
    opacity: 0;
    position: absolute;
    bottom: 120%;
    left: 50%;
    transform: translateX(-50%);
    background-color: #666;
    color: white;
    text-align: left;
    border-radius: 10px;
    padding: 10px;
    width: 300px;
    transition: opacity 0.3s ease-in-out;
    z-index: 9998;
    white-space: normal;
    word-break: break-word;
}

/* NEW: Inner content box controls overflow */
.tooltip-content-school {
    max-height: 150px;
    overflow-y: auto;
}

/* Tooltip arrow (unchanged) */
.tooltip-school::after {
    content: "";
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    border-width: 7px;
    border-style: solid;
    border-color: #666 transparent transparent transparent;
    z-index: 9998;
}

/* Reveal logic */
.tooltip-wrapper-school:hover .tooltip-school {
    visibility: visible;
    opacity: 1;
    pointer-events: auto;
}

/* Create invisible space (5px) at the bottom for hover margin */
.tooltip-wrapper-school:hover::after {
    content: "";
    position: absolute;
    bottom: -5px; /* Adds 5px extra space */
    left: 0;
    width: 100%;
    height: 5px;
}

/* Tooltip BELOW the button */
.tooltip-school.arrow-down-school {
    top: 100%;
    bottom: auto;
    left: 50%;
    transform: translateX(-50%);
    margin-top: 5px;
    margin-bottom: 0;
}

/* Arrow flipped when tooltip is below */
.tooltip-school.arrow-down-school::after {
    top: auto;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    border-width: 7px;
    border-style: solid;
    border-color: transparent transparent #666 transparent;
}

button.sentence-button-school {
    position: relative;
    margin-right: 5px;
    margin-left: 5px;
    padding: 6.5px 5px;
    border-radius: 5px;
    background-color: rgba(200, 200, 200, 0.2);
    color: white;
    border: none;
    cursor: pointer;
}

button.sentence-button-school:hover {
    position: relative;
    margin-right: 5px;
    margin-left: 5px;
    padding: 6.5px 5px;
    border-radius: 5px;
    background-color: white;
    color: #3A3A3A;
    border: none;
    cursor: pointer;
}

button.sentence-button-school.active {
    background-color: white;
    color: #3A3A3A;
}

.sentence-tooltip-wrapper-school {
    position: relative;
    display: inline-block;
    overflow: visible;
}

/* Tooltip default ABOVE */
.sentence-tooltip-school {
    visibility: hidden;
    opacity: 0;
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    background-color: #666;
    color: white;
    text-align: left;
    border-radius: 10px;
    padding: 10px;
    width: 300px;
    transition: opacity 0.3s ease-in-out;
    z-index: 101;
    white-space: normal;
    word-break: break-word;
    margin-bottom: 5px;
}

/* Tooltip content scroll area */
.sentence-tooltip-content-school {
    max-height: 150px;
    overflow-y: auto;
}

/* Tooltip arrow (pointing down when above button) */
.sentence-tooltip-school::after {
    content: "";
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    border-width: 7px;
    border-style: solid;
    border-color: #666 transparent transparent transparent;
    z-index: 102;
}

/* Tooltip BELOW the button */
.sentence-tooltip-school.arrow-down-school {
    bottom: auto;
    top: 100%;
    margin-bottom: 0;
    margin-top: 5px;
}

/* Arrow flipped when tooltip is below */
.sentence-tooltip-school.arrow-down-school::after {
    top: auto;
    bottom: 100%;
    border-color: transparent transparent #666 transparent;
}

/* Show tooltip on hover */
.sentence-tooltip-wrapper-school:hover .sentence-tooltip-school {
    visibility: visible;
    opacity: 1;
    pointer-events: auto;
}

#loading-school {
    text-align: center;
    color: #666;
    padding: 10px;
    font-style: italic;
    display: none;
}

/* Chat message styles */

.user-message-school, .ai-message-school {
    padding: 12px;
    border-radius: 12px;
    word-wrap: break-word;
    font-size: 16px;
    line-height: 1.4;
}

.user-message-school::selection {
    background-color: rgba(255, 255, 255, 0.3); /* light translucent white */
}

.ai-message-school::selection {
    background-color: rgba(255, 255, 255, 0.3); /* light translucent white */
}

.user-message-school {
    background: #3A3A3A;
    color: white;
    align-self: flex-end;
    text-align: left;
    margin-left: auto;
    margin-bottom: 15px;
    margin-top: 10px;
    max-width: 50%;
    width: fit-content;
    white-space: pre-wrap;
    word-break: break-word;      /* <- Force break on long words */
    overflow-wrap: break-word;   /* <- Better browser support */
    overflow: visible;
}

.ai-message-school {
    background-color: #3A7ECC;
    color: #fff;
    align-self: flex-start;
    border-bottom-left-radius: 0;
    text-align: left;
    margin-right: auto;
    width: fit-content;
    max-width: 85%;        
    white-space: pre-wrap;
    margin-top: 0px;
    overflow: visible;
}

.message-wrapper-school {
    max-width: 850px;
    min-height: 30px;
    margin: 0 auto;
    width: 100%;
    display: flex;
    flex-direction: column;
    padding: 0 10px;
    box-sizing: border-box;
    background: transparent;
    border: none;
    overflow: visible;
    position: relative;
}

.message-wrapper-school::selection {
    background-color: rgba(255, 255, 255, 0.3); /* light translucent white */
}

.message-wrapper-school.placeholder-school {
    max-width: 950px;
    min-height: 450px;
    margin: 0 auto;
    width: 100%;
    display: flex;
    flex-direction: column;
    padding: 0;
    box-sizing: border-box;
    background: transparent;
    border: none;
    box-shadow: none;
    overflow: visible;
    box-shadow:
        inset 4px 0px 6px -6px rgba(0, 0, 0, 0.4),   /* Subtle left */
        inset -4px 0px 6px -6px rgba(0, 0, 0, 0.4);
}

.loading-message-school {
    color: #ccc;
    font-style: italic;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    z-index: 2;
}

.loading-message-school .fa-spinner {
    font-size: 16px;
}

.typing-indicator-school {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 4px;
    height: 20px;
    margin: 5px 0;
}

.typing-indicator-school span {
    display: block;
    width: 6px;
    height: 6px;
    background-color: #ccc;
    border-radius: 50%;
    animation: bounce 1.4s infinite ease-in-out both;
}

.typing-indicator-school span:nth-child(1) {
    animation-delay: -0.24s;
}
.typing-indicator-school span:nth-child(2) {
    animation-delay: -0.12s;
}
.typing-indicator-school span:nth-child(3) {
    animation-delay: 0s;
}

@keyframes bounce {
    0%, 80%, 100% {
        transform: scale(0);
    }
    40% {
        transform: scale(1);
    }
}

@keyframes fadeIn {
    from {
      opacity: 0;
      transform: translateY(5px);
    }
    to {
      opacity: 1;
      transform: translateY(0);
    }
}

.intro-message-school {
    color: #fff;
    display: inline-block;
    margin: 0 auto;
    font-size: 22px;
    font-weight: bold;
    text-align: center;
    background: transparent;
    box-shadow: none;
    padding-top: 170px
}

#load-school-audio-btn {
    color: #fff;
    border: 2px solid #fff;
    border-radius: 15px;
    background-color: transparent;
    cursor: pointer;
    padding: 8px 15px;
}

#load-school-audio-btn:hover {
    color: #3A3A3A;
    border: 2px solid #fff;
    border-radius: 15px;
    background-color: #fff;
}

.school-audio-chapter-player-wrapper {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 20px;
    margin-bottom: 10px;
    margin-top: 10px;
}

.custom-audio-player {
    display: flex;
    align-items: center;
    gap: 10px;
    background: #f2f2f2;
    padding: 8px 14px;
    border-radius: 20px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    width: fit-content;
}

.play-pause-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    background: #3A3A3A;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    padding: 5px;
    width: 34px;
    height: 34px;
}

.play-pause-btn svg {
    width: 24px;
    height: 24px;
}

audio.real-audio {
    display: block !important;
    width: 0 !important;
    height: 0 !important;
    visibility: hidden !important;
    opacity: 0 !important;
    position: absolute !important;
    z-index: -1 !important;
    pointer-events: none !important;
}

.volume-slider {
    -webkit-appearance: none !important;
    appearance: none !important;
    width: 120px;
    height: 5px;
    background: transparent;
    border-radius: 5px;
    cursor: pointer;
    position: relative;
    padding: 0;
    margin: 0;
    box-shadow: none !important;
}

/* Track styling */
.volume-slider::-webkit-slider-runnable-track {
    width: 100%;
    height: 5px;
    background: transparent !important;
    border-radius: 5px;
    box-shadow: none !important;
}

.volume-slider::-moz-range-track {
    width: 100%;
    height: 5px;
    background: transparent !important;
    border-radius: 5px;
    box-shadow: none !important;
}

.volume-slider::-ms-track {
    width: 100%;
    height: 5px;
    background: transparent !important;
    border-color: transparent !important;
    color: transparent !important;
    border-radius: 5px !important;
    box-shadow: none !important;
}

/* Thumb styling */
.volume-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    margin-top: -4px;
    width: 20px;
    height: 20px;
    background: #3A3A3A;
    border-radius: 50%;
    border: none;
    box-shadow: none !important;
}

.volume-slider::-moz-range-thumb {
    width: 20px;
    height: 20px;
    background: #3A3A3A;
    border-radius: 50%;
    border: none;
    box-shadow: none !important;
}

.volume-slider::-ms-thumb {
    width: 20px;
    height: 20px;
    background: #3A3A3A;
    border-radius: 50%;
    border: none;
    box-shadow: none !important;
}

.volume-slider:focus {
    outline: none !important;
    box-shadow: none !important;
    border: none !important;
}

.volume-slider::-moz-focus-inner {
    border: 0 !important;
}

.volume-slider::-webkit-focus-ring {
    outline: none !important;
}
  