/* =========================================================
   1. VARIABLES
========================================================= */

:root {
    --professor-owl-primary: #123d35;
    --professor-owl-primary-dark: #082720;
    --professor-owl-primary-soft: #eaf6f1;
    --professor-owl-accent: #49e38f;
    --professor-owl-accent-strong: #20bf6b;
    --professor-owl-gold: #d3a84f;
    --professor-owl-surface: #ffffff;
    --professor-owl-surface-soft: #f5f8f7;
    --professor-owl-border: #dce7e2;
    --professor-owl-text: #17241f;
    --professor-owl-text-soft: #68756f;
    --professor-owl-shadow: 0 24px 70px rgba(8, 35, 29, 0.24);
    --professor-owl-button-shadow: 0 14px 35px rgba(8, 35, 29, 0.28);
    --professor-owl-radius: 24px;
    --professor-owl-layer: 999999;
}


/* =========================================================
   2. ROOT
========================================================= */

.professor-owl-widget {
    position: fixed;
    right: 22px;
    bottom: 22px;
    z-index: var(--professor-owl-layer);
    width: auto;
    height: auto;
    font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    color: var(--professor-owl-text);
    line-height: 1.5;
    text-align: left;
    pointer-events: none;
}

.professor-owl-widget,
.professor-owl-widget * {
    box-sizing: border-box;
}


/* =========================================================
   3. LAUNCHER
========================================================= */

.professor-owl-launcher {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 88px;
    height: 88px;
    margin-left: auto;
    padding: 0;
    border: 3px solid rgba(73, 227, 143, 0.8);
    border-radius: 50%;
    overflow: visible;
    background: radial-gradient(circle at 50% 32%, #1a5548 0%, #0d332b 55%, #061d19 100%);
    box-shadow: var(--professor-owl-button-shadow);
    cursor: pointer;
    pointer-events: auto;
    isolation: isolate;
    transition: transform 180ms ease, box-shadow 180ms ease, border-color 180ms ease;
}

.professor-owl-launcher::before {
    content: "";
    position: absolute;
    inset: -7px;
    z-index: -1;
    border: 1px solid rgba(73, 227, 143, 0.34);
    border-radius: 50%;
    animation: professorOwlPulse 2.8s infinite ease-out;
}

.professor-owl-launcher:hover {
    transform: translateY(-3px) scale(1.025);
    border-color: var(--professor-owl-accent);
    box-shadow: 0 18px 44px rgba(8, 35, 29, 0.34);
}

.professor-owl-launcher:focus-visible {
    outline: 4px solid rgba(73, 227, 143, 0.32);
    outline-offset: 4px;
}

.professor-owl-launcher-image-wrap {
    width: 76px;
    height: 76px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    border-radius: 50%;
    background: #09251f;
    color: #ffffff;
    font-size: 42px;
}

.professor-owl-launcher-image-wrap.uses-fallback-icon {
    background: linear-gradient(145deg, #174d42, #082720);
}

.professor-owl-launcher-image {
    width: 100%;
    height: 100%;
    display: block;
    object-fit: cover;
    object-position: center 18%;
    transform: scale(1.08);
}

.professor-owl-launcher-status {
    position: absolute;
    right: 2px;
    bottom: 5px;
    width: 18px;
    height: 18px;
    border: 3px solid #ffffff;
    border-radius: 50%;
    background: var(--professor-owl-accent-strong);
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.2);
}

.professor-owl-launcher-tooltip {
    position: absolute;
    right: 100px;
    bottom: 10px;
    width: max-content;
    max-width: 230px;
    padding: 11px 14px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 13px;
    color: #ffffff;
    background: rgba(8, 39, 32, 0.96);
    box-shadow: 0 12px 28px rgba(0, 0, 0, 0.2);
    opacity: 0;
    visibility: hidden;
    transform: translateX(8px);
    transition: opacity 160ms ease, visibility 160ms ease, transform 160ms ease;
    pointer-events: none;
}

.professor-owl-launcher:hover .professor-owl-launcher-tooltip,
.professor-owl-launcher:focus-visible .professor-owl-launcher-tooltip {
    opacity: 1;
    visibility: visible;
    transform: translateX(0);
}

.professor-owl-launcher-tooltip-title {
    display: block;
    margin-bottom: 2px;
    font-size: 0.84rem;
    font-weight: 800;
}

.professor-owl-launcher-tooltip-text {
    display: block;
    color: rgba(255, 255, 255, 0.76);
    font-size: 0.7rem;
    font-weight: 600;
}

.professor-owl-launcher-label {
    display: none;
}


/* =========================================================
   4. PANEL
========================================================= */

.professor-owl-panel {
    position: absolute;
    right: 0;
    bottom: 104px;
    width: min(410px, calc(100vw - 32px));
    height: min(660px, calc(100vh - 135px));
    display: flex;
    flex-direction: column;
    overflow: hidden;
    border: 1px solid rgba(18, 61, 53, 0.14);
    border-radius: var(--professor-owl-radius);
    background: var(--professor-owl-surface);
    box-shadow: var(--professor-owl-shadow);
    opacity: 0;
    visibility: hidden;
    transform: translateY(18px) scale(0.96);
    transform-origin: bottom right;
    pointer-events: none;
    transition: opacity 190ms ease, visibility 190ms ease, transform 190ms ease;
}

.professor-owl-widget.is-open .professor-owl-panel {
    opacity: 1;
    visibility: visible;
    transform: translateY(0) scale(1);
    pointer-events: auto;
}

.professor-owl-panel.is-minimized {
    height: auto;
}

.professor-owl-panel.is-minimized .professor-owl-body,
.professor-owl-panel.is-minimized .professor-owl-quick-actions-section,
.professor-owl-panel.is-minimized .professor-owl-support-section,
.professor-owl-panel.is-minimized .professor-owl-composer {
    display: none;
}


/* =========================================================
   5. HEADER
========================================================= */

.professor-owl-header {
    position: relative;
    flex: 0 0 auto;
    min-height: 96px;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px;
    color: #ffffff;
    background: linear-gradient(135deg, #092b25 0%, #12483c 56%, #176147 100%);
    overflow: hidden;
}

.professor-owl-header::after {
    content: "";
    position: absolute;
    width: 190px;
    height: 190px;
    right: -88px;
    top: -118px;
    border: 1px solid rgba(73, 227, 143, 0.2);
    border-radius: 50%;
    box-shadow: 0 0 0 26px rgba(73, 227, 143, 0.04);
    pointer-events: none;
}

.professor-owl-header-main {
    position: relative;
    z-index: 1;
    min-width: 0;
    flex: 1 1 auto;
    display: flex;
    align-items: center;
    gap: 12px;
}

.professor-owl-header-avatar {
    flex: 0 0 58px;
    width: 58px;
    height: 58px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    border: 2px solid rgba(73, 227, 143, 0.72);
    border-radius: 50%;
    background: #08241f;
    color: #ffffff;
    font-size: 31px;
    box-shadow: 0 8px 18px rgba(0, 0, 0, 0.22);
}

.professor-owl-header-avatar.uses-fallback-icon {
    background: linear-gradient(145deg, #174d42, #082720);
}

.professor-owl-header-avatar img {
    width: 100%;
    height: 100%;
    display: block;
    object-fit: cover;
    object-position: center 18%;
    transform: scale(1.08);
}

.professor-owl-header-identity {
    min-width: 0;
    flex: 1 1 auto;
}

.professor-owl-header-title {
    margin: 0;
    color: #ffffff;
    font-size: 1.05rem;
    font-weight: 850;
    letter-spacing: -0.01em;
}

.professor-owl-header-subtitle {
    margin: 2px 0 0;
    color: rgba(255, 255, 255, 0.77);
    font-size: 0.72rem;
    font-weight: 650;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.professor-owl-header-status {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-top: 5px;
    color: rgba(255, 255, 255, 0.9);
    font-size: 0.67rem;
    font-weight: 700;
}

.professor-owl-header-status-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--professor-owl-accent);
    box-shadow: 0 0 10px rgba(73, 227, 143, 0.75);
}

.professor-owl-header-actions {
    position: relative;
    z-index: 2;
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    gap: 6px;
}

.professor-owl-header-button {
    width: 34px;
    height: 34px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 0;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.12);
    color: #ffffff;
    font-size: 1rem;
    cursor: pointer;
    transition: background 180ms ease, transform 180ms ease;
}

.professor-owl-header-button:hover {
    background: rgba(255, 255, 255, 0.22);
    transform: translateY(-1px);
}


/* =========================================================
   6. BODY AND WELCOME
========================================================= */

.professor-owl-body {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    padding: 16px;
    background: var(--professor-owl-surface-soft);
}

.professor-owl-messages {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.professor-owl-welcome-card {
    padding: 17px;
    border: 1px solid var(--professor-owl-border);
    border-radius: 18px;
    background: #ffffff;
    box-shadow: 0 8px 24px rgba(18, 61, 53, 0.06);
}

.professor-owl-welcome-eyebrow {
    margin-bottom: 4px;
    color: var(--professor-owl-primary);
    font-size: 0.72rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.professor-owl-welcome-title {
    margin: 0 0 7px;
    color: var(--professor-owl-text);
    font-size: 1.1rem;
    line-height: 1.25;
}

.professor-owl-welcome-greeting {
    margin: 0;
    color: var(--professor-owl-text-soft);
    font-size: 0.9rem;
    line-height: 1.58;
}

.professor-owl-welcome-capabilities {
    display: flex;
    flex-wrap: wrap;
    gap: 7px;
    margin-top: 13px;
}

.professor-owl-welcome-capability {
    padding: 6px 9px;
    border-radius: 999px;
    background: var(--professor-owl-primary-soft);
    color: var(--professor-owl-primary);
    font-size: 0.68rem;
    font-weight: 750;
}


/* =========================================================
   7. MESSAGES
========================================================= */

.professor-owl-message {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    animation: professorOwlFadeUp 0.22s ease;
}

.professor-owl-message-user {
    flex-direction: row-reverse;
}

.professor-owl-message-avatar {
    flex: 0 0 38px;
    width: 38px;
    height: 38px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: var(--professor-owl-primary);
    color: #ffffff;
    font-size: 0.68rem;
    font-weight: 800;
    box-shadow: 0 6px 14px rgba(18, 61, 53, 0.15);
}

.professor-owl-message-assistant .professor-owl-message-avatar {
    background: linear-gradient(145deg, #174d42, #082720);
    font-size: 20px;
}

.professor-owl-message-content {
    max-width: 79%;
    padding: 12px 14px;
    border: 1px solid var(--professor-owl-border);
    border-radius: 16px 16px 16px 5px;
    background: #ffffff;
    box-shadow: 0 5px 14px rgba(18, 61, 53, 0.05);
}

.professor-owl-message-user .professor-owl-message-content {
    border: 0;
    border-radius: 16px 16px 5px 16px;
    background: var(--professor-owl-primary);
    color: #ffffff;
}

.professor-owl-message-title {
    margin: 0 0 5px;
    color: var(--professor-owl-primary);
    font-size: 0.8rem;
    line-height: 1.3;
}

.professor-owl-message-text {
    color: var(--professor-owl-text);
    font-size: 0.86rem;
    line-height: 1.55;
    overflow-wrap: anywhere;
}

.professor-owl-message-user .professor-owl-message-text {
    color: #ffffff;
}

.professor-owl-message-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 7px;
    margin-top: 10px;
}

.professor-owl-message-action {
    padding: 7px 10px;
    border: 1px solid var(--professor-owl-border);
    border-radius: 10px;
    background: var(--professor-owl-primary-soft);
    color: var(--professor-owl-primary);
    font-size: 0.7rem;
    font-weight: 800;
    cursor: pointer;
}

.professor-owl-message-action:hover {
    background: var(--professor-owl-primary);
    color: #ffffff;
}


/* =========================================================
   8. QUICK QUESTIONS
========================================================= */

.professor-owl-quick-actions-section {
    flex: 0 0 auto;
    padding: 12px 14px 13px;
    border-top: 1px solid var(--professor-owl-border);
    background: #ffffff;
}

.professor-owl-section-label {
    margin-bottom: 8px;
    color: var(--professor-owl-text-soft);
    font-size: 0.7rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.professor-owl-quick-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.professor-owl-chip {
    padding: 8px 12px;
    border: 1px solid var(--professor-owl-border);
    border-radius: 999px;
    background: #ffffff;
    color: var(--professor-owl-primary);
    font-size: 0.7rem;
    font-weight: 750;
    line-height: 1.25;
    cursor: pointer;
    transition: background 180ms ease, color 180ms ease, border-color 180ms ease;
}

.professor-owl-chip:hover {
    border-color: var(--professor-owl-primary);
    background: var(--professor-owl-primary);
    color: #ffffff;
}


/* =========================================================
   9. SUPPORT SECTION
========================================================= */

.professor-owl-support-section {
    flex: 0 0 auto;
    display: grid;
    grid-template-columns: 1fr;
    gap: 10px;
    padding: 13px 14px;
    border-top: 1px solid var(--professor-owl-border);
    background: #fbfdfc;
}

.professor-owl-support-content {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.professor-owl-support-title {
    color: var(--professor-owl-text);
    font-size: 0.77rem;
}

.professor-owl-support-text {
    color: var(--professor-owl-text-soft);
    font-size: 0.72rem;
    line-height: 1.42;
}

.professor-owl-support-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.professor-owl-support-button {
    min-height: 36px;
    padding: 8px 12px;
    border-radius: 10px;
    font-size: 0.72rem;
    font-weight: 800;
    cursor: pointer;
    transition: transform 180ms ease, background 180ms ease;
}

.professor-owl-ai-center-button {
    border: 0;
    background: var(--professor-owl-primary);
    color: #ffffff;
}

.professor-owl-human-support-button {
    border: 1px solid var(--professor-owl-border);
    background: #ffffff;
    color: var(--professor-owl-primary);
}

.professor-owl-support-button:hover {
    transform: translateY(-1px);
}


/* =========================================================
   10. COMPOSER
========================================================= */

.professor-owl-composer {
    flex: 0 0 auto;
    padding: 12px 14px 13px;
    border-top: 1px solid var(--professor-owl-border);
    background: #ffffff;
}

.professor-owl-input-wrap {
    display: flex;
    align-items: flex-end;
    gap: 9px;
}

.professor-owl-input {
    flex: 1 1 auto;
    width: 100%;
    min-height: 46px;
    max-height: 120px;
    padding: 12px 14px;
    resize: none;
    border: 1px solid var(--professor-owl-border);
    border-radius: 15px;
    background: #ffffff;
    color: var(--professor-owl-text);
    font: inherit;
    font-size: 0.86rem;
    line-height: 1.45;
    outline: none;
}

.professor-owl-input:focus {
    border-color: var(--professor-owl-accent-strong);
    box-shadow: 0 0 0 3px rgba(73, 227, 143, 0.14);
}

.professor-owl-send {
    flex: 0 0 48px;
    width: 48px;
    height: 48px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 0;
    border-radius: 50%;
    background: var(--professor-owl-primary);
    color: #ffffff;
    font-size: 1.05rem;
    cursor: pointer;
    box-shadow: 0 8px 18px rgba(18, 61, 53, 0.2);
    transition: transform 180ms ease, background 180ms ease;
}

.professor-owl-send:hover {
    background: var(--professor-owl-primary-dark);
    transform: translateY(-1px);
}

.professor-owl-send:disabled,
.professor-owl-input:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.professor-owl-composer-hint {
    margin-top: 7px;
    color: var(--professor-owl-text-soft);
    font-size: 0.66rem;
    line-height: 1.35;
}


/* =========================================================
   11. THINKING
========================================================= */

.professor-owl-thinking-dots {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    min-height: 16px;
}

.professor-owl-thinking-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--professor-owl-primary);
    animation: professorOwlThinking 1.2s infinite;
}

.professor-owl-thinking-dot:nth-child(2) {
    animation-delay: 0.18s;
}

.professor-owl-thinking-dot:nth-child(3) {
    animation-delay: 0.36s;
}


/* =========================================================
   12. SCROLLBAR
========================================================= */

.professor-owl-body::-webkit-scrollbar {
    width: 8px;
}

.professor-owl-body::-webkit-scrollbar-track {
    background: transparent;
}

.professor-owl-body::-webkit-scrollbar-thumb {
    background: rgba(18, 61, 53, 0.22);
    border-radius: 999px;
}

.professor-owl-body::-webkit-scrollbar-thumb:hover {
    background: rgba(18, 61, 53, 0.38);
}


/* =========================================================
   13. ANIMATIONS
========================================================= */

@keyframes professorOwlPulse {
    0% {
        transform: scale(1);
        opacity: 0.75;
    }

    70%,
    100% {
        transform: scale(1.18);
        opacity: 0;
    }
}

@keyframes professorOwlFadeUp {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes professorOwlThinking {

    0%,
    80%,
    100% {
        transform: translateY(0);
        opacity: 0.35;
    }

    40% {
        transform: translateY(-5px);
        opacity: 1;
    }
}


/* =========================================================
   14. MOBILE
========================================================= */

@media (max-width: 640px) {
    .professor-owl-widget {
        right: 12px;
        left: 12px;
        bottom: 12px;
    }

    .professor-owl-launcher {
        width: 74px;
        height: 74px;
    }

    .professor-owl-launcher-image-wrap {
        width: 64px;
        height: 64px;
    }

    .professor-owl-panel {
        right: 0;
        left: 0;
        width: auto;
        height: min(82vh, 640px);
        bottom: 88px;
    }

    .professor-owl-header {
        min-height: 86px;
        padding: 13px;
    }

    .professor-owl-header-avatar {
        flex-basis: 52px;
        width: 52px;
        height: 52px;
    }

    .professor-owl-header-title {
        font-size: 0.96rem;
    }

    .professor-owl-header-subtitle {
        font-size: 0.67rem;
    }

    .professor-owl-message-content {
        max-width: 84%;
    }

    .professor-owl-launcher-tooltip {
        display: none;
    }
}

@media (max-width: 420px) {
    .professor-owl-widget {
        right: 8px;
        left: 8px;
        bottom: 8px;
    }

    .professor-owl-panel {
        height: calc(100vh - 96px);
        border-radius: 18px;
    }

    .professor-owl-header-actions {
        gap: 4px;
    }

    .professor-owl-header-button {
        width: 31px;
        height: 31px;
    }

    .professor-owl-body {
        padding: 12px;
    }

    .professor-owl-quick-actions-section,
    .professor-owl-support-section,
    .professor-owl-composer {
        padding-left: 11px;
        padding-right: 11px;
    }

    .professor-owl-input {
        min-height: 44px;
        font-size: 16px;
    }

    .professor-owl-send {
        flex-basis: 46px;
        width: 46px;
        height: 46px;
    }
}


/* =========================================================
   15. REDUCED MOTION
========================================================= */

@media (prefers-reduced-motion: reduce) {

    .professor-owl-widget *,
    .professor-owl-widget *::before,
    .professor-owl-widget *::after {
        animation: none !important;
        transition: none !important;
        scroll-behavior: auto !important;
    }
}


/* =========================================================
   16. HIDDEN
========================================================= */

.professor-owl-hidden {
    display: none !important;
}

/* =========================================================
   17. COMPACT CONTROLS
   Gives more space to questions and answers
========================================================= */

/* Keep quick questions in one small horizontal row */
.professor-owl-quick-actions-section {
    padding: 7px 10px 8px;
}

.professor-owl-section-label {
    margin-bottom: 5px;
    font-size: 0.6rem;
}

.professor-owl-quick-actions {
    display: flex;
    flex-wrap: nowrap;
    gap: 6px;
    overflow-x: auto;
    padding-bottom: 2px;
    scrollbar-width: thin;
}

.professor-owl-chip {
    flex: 0 0 auto;
    max-width: 180px;
    padding: 5px 8px;
    border-radius: 8px;
    font-size: 0.62rem;
    line-height: 1.2;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Make the support area much smaller */
.professor-owl-support-section {
    grid-template-columns: 1fr auto;
    align-items: center;
    gap: 8px;
    padding: 7px 10px;
}

.professor-owl-support-content {
    min-width: 0;
}

.professor-owl-support-title {
    font-size: 0.67rem;
}

.professor-owl-support-text {
    display: none;
}

.professor-owl-support-actions {
    flex-wrap: nowrap;
    gap: 5px;
}

.professor-owl-support-button {
    min-height: 28px;
    padding: 5px 8px;
    border-radius: 7px;
    font-size: 0.61rem;
    white-space: nowrap;
}

/* Make the message input area slightly smaller */
.professor-owl-composer {
    padding: 8px 10px 9px;
}

.professor-owl-input {
    min-height: 40px;
    padding: 9px 11px;
    font-size: 0.8rem;
}

.professor-owl-send {
    flex-basis: 40px;
    width: 40px;
    height: 40px;
    font-size: 0.9rem;
}

.professor-owl-composer-hint {
    display: none;
}

/* Give the conversation more visible room */
.professor-owl-body {
    padding: 13px;
}

.professor-owl-message-content {
    max-width: 86%;
}

/* Compact mobile controls too */
@media (max-width: 640px) {
    .professor-owl-support-section {
        grid-template-columns: 1fr;
        gap: 5px;
    }

    .professor-owl-support-content {
        display: none;
    }

    .professor-owl-support-actions {
        width: 100%;
    }

    .professor-owl-support-button {
        flex: 1 1 0;
    }

    .professor-owl-chip {
        max-width: 150px;
    }
}