/**
 * Skylo — Blue Sky School Mascot Guide
 * A floating animated mascot that introduces the site and guides visitors
 * through each section. Colors follow the active theme variables.
 */

.skylo-widget {
    position: fixed;
    bottom: 22px;
    left: 22px;
    z-index: 9990;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
    width: 320px;
    max-width: calc(100vw - 44px);
    pointer-events: none;
    transition: transform 0.4s cubic-bezier(0.22, 1, 0.36, 1), opacity 0.4s ease;
}

.skylo-widget.pos-right {
    left: auto;
    right: 22px;
    align-items: flex-end;
}

.skylo-widget * {
    pointer-events: auto;
}

/* Hidden / minimized state */
.skylo-widget.skylo-hidden {
    transform: translateY(140%);
    opacity: 0;
    pointer-events: none;
}

/* ---- Speech bubble ---- */
.skylo-bubble {
    position: relative;
    background: #ffffff;
    border-radius: 18px;
    padding: 16px 40px 16px 18px;
    box-shadow: 0 12px 34px rgba(30, 58, 95, 0.22);
    border: 1px solid rgba(30, 58, 95, 0.08);
    border-left: 5px solid var(--bs-gold, #c9a227);
    width: 100%;
    opacity: 0;
    transform: translateY(10px) scale(0.96);
    transition: opacity 0.35s ease, transform 0.35s cubic-bezier(0.22, 1, 0.36, 1);
}

.skylo-widget.pos-right .skylo-bubble {
    border-left: 1px solid rgba(30, 58, 95, 0.08);
    border-right: 5px solid var(--bs-gold, #c9a227);
    padding: 16px 18px 16px 40px;
}

.skylo-bubble.show {
    opacity: 1;
    transform: translateY(0) scale(1);
}

.skylo-bubble-title {
    font-weight: 700;
    color: var(--bs-blue-dark, #1e3a5f);
    font-size: 15px;
    margin: 0 0 4px;
    line-height: 1.3;
}

.skylo-bubble-text {
    color: #4a5568;
    font-size: 14px;
    line-height: 1.5;
    margin: 0;
}

/* little tail pointing down toward the mascot */
.skylo-bubble::after {
    content: "";
    position: absolute;
    bottom: -9px;
    left: 28px;
    width: 18px;
    height: 18px;
    background: #ffffff;
    border-right: 1px solid rgba(30, 58, 95, 0.08);
    border-bottom: 1px solid rgba(30, 58, 95, 0.08);
    transform: rotate(45deg);
}

.skylo-widget.pos-right .skylo-bubble::after {
    left: auto;
    right: 28px;
}

.skylo-bubble-close {
    position: absolute;
    top: 8px;
    right: 10px;
    width: 24px;
    height: 24px;
    border: none;
    background: rgba(30, 58, 95, 0.08);
    color: var(--bs-blue-dark, #1e3a5f);
    border-radius: 50%;
    font-size: 15px;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}

.skylo-widget.pos-right .skylo-bubble-close {
    right: auto;
    left: 10px;
}

.skylo-bubble-close:hover {
    background: var(--bs-gold, #c9a227);
    color: #fff;
}

/* ---- Mascot ---- */
.skylo-mascot-wrap {
    display: flex;
    align-items: flex-end;
    gap: 8px;
    cursor: pointer;
}

.skylo-mascot {
    width: auto;
    height: 150px;
    max-height: 26vh;
    object-fit: contain;
    filter: drop-shadow(0 10px 14px rgba(30, 58, 95, 0.28));
    animation: skylo-bob 3.2s ease-in-out infinite;
    transition: transform 0.3s ease;
}

.skylo-mascot-wrap:hover .skylo-mascot {
    transform: scale(1.04);
}

@keyframes skylo-bob {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-8px); }
}

/* attention pulse ring on the launcher */
.skylo-launcher {
    position: fixed;
    bottom: 22px;
    left: 22px;
    z-index: 9989;
    width: 64px;
    height: 64px;
    border-radius: 50%;
    border: 3px solid var(--bs-gold, #c9a227);
    background: var(--bs-blue-dark, #1e3a5f);
    box-shadow: 0 8px 22px rgba(30, 58, 95, 0.35);
    cursor: pointer;
    overflow: hidden;
    display: none;
    padding: 0;
    transition: transform 0.25s ease;
}

.skylo-launcher.pos-right {
    left: auto;
    right: 22px;
}

.skylo-launcher.show {
    display: block;
    animation: skylo-pop 0.4s ease;
}

.skylo-launcher:hover {
    transform: scale(1.08);
}

.skylo-launcher img {
    position: absolute;
    width: 130%;
    left: 50%;
    top: 18%;
    transform: translateX(-50%);
}

.skylo-launcher::before {
    content: "";
    position: absolute;
    inset: -3px;
    border-radius: 50%;
    border: 2px solid var(--bs-gold, #c9a227);
    animation: skylo-ring 2s ease-out infinite;
}

@keyframes skylo-ring {
    0% { transform: scale(1); opacity: 0.7; }
    100% { transform: scale(1.5); opacity: 0; }
}

@keyframes skylo-pop {
    0% { transform: scale(0); }
    70% { transform: scale(1.15); }
    100% { transform: scale(1); }
}

@media only screen and (max-width: 600px) {
    .skylo-widget {
        width: 250px;
        bottom: 16px;
        left: 12px;
    }
    .skylo-widget.pos-right {
        right: 12px;
    }
    .skylo-mascot {
        height: 110px;
    }
    .skylo-bubble-text {
        font-size: 13px;
    }
    .skylo-launcher {
        width: 54px;
        height: 54px;
        bottom: 16px;
        left: 12px;
    }
    .skylo-launcher.pos-right {
        right: 12px;
    }
}

/* ---- AI Chat Panel ---- */
.skylo-chat-btn {
    display: block;
    width: 100%;
    margin-top: 10px;
    padding: 8px 12px;
    border: none;
    border-radius: 10px;
    background: var(--bs-blue, #244a7c);
    color: #fff;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
}

.skylo-chat-btn:hover {
    background: var(--bs-gold, #c9a227);
}

.skylo-chat-panel {
    position: fixed;
    bottom: 22px;
    left: 22px;
    z-index: 9995;
    width: 360px;
    max-width: calc(100vw - 44px);
    height: 480px;
    max-height: calc(100vh - 44px);
    background: #fff;
    border-radius: 20px;
    box-shadow: 0 16px 48px rgba(30, 58, 95, 0.28);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transform: translateY(120%) scale(0.95);
    opacity: 0;
    pointer-events: none;
    transition: transform 0.35s cubic-bezier(0.22, 1, 0.36, 1), opacity 0.35s ease;
}

.skylo-chat-panel.open {
    transform: translateY(0) scale(1);
    opacity: 1;
    pointer-events: auto;
}

.skylo-chat-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 16px;
    background: var(--bs-blue-dark, #1e3a5f);
    color: #fff;
}

.skylo-chat-header-info {
    display: flex;
    align-items: center;
    gap: 10px;
}

.skylo-chat-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: contain;
    background: rgba(255,255,255,0.15);
}

.skylo-chat-header-info strong {
    display: block;
    font-size: 15px;
}

.skylo-chat-header-info span {
    font-size: 12px;
    opacity: 0.85;
}

.skylo-chat-close {
    width: 32px;
    height: 32px;
    border: none;
    border-radius: 50%;
    background: rgba(255,255,255,0.15);
    color: #fff;
    font-size: 20px;
    cursor: pointer;
}

.skylo-chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    background: #f8fafc;
}

.skylo-chat-msg {
    display: flex;
    gap: 8px;
    align-items: flex-end;
    max-width: 92%;
}

.skylo-chat-user {
    align-self: flex-end;
    flex-direction: row-reverse;
}

.skylo-chat-msg-avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    object-fit: contain;
    flex-shrink: 0;
}

.skylo-chat-bubble {
    padding: 10px 14px;
    border-radius: 16px;
    font-size: 14px;
    line-height: 1.5;
    color: #334155;
}

.skylo-chat-bot .skylo-chat-bubble {
    background: #fff;
    border: 1px solid #e2e8f0;
    border-bottom-left-radius: 4px;
}

.skylo-chat-user .skylo-chat-bubble {
    background: var(--bs-blue, #244a7c);
    color: #fff;
    border-bottom-right-radius: 4px;
}

.skylo-chat-typing .skylo-chat-bubble span {
    display: inline-block;
    width: 7px;
    height: 7px;
    margin: 0 2px;
    background: #94a3b8;
    border-radius: 50%;
    animation: skylo-dot 1.2s infinite;
}

.skylo-chat-typing .skylo-chat-bubble span:nth-child(2) { animation-delay: 0.2s; }
.skylo-chat-typing .skylo-chat-bubble span:nth-child(3) { animation-delay: 0.4s; }

@keyframes skylo-dot {
    0%, 80%, 100% { opacity: 0.3; transform: scale(0.8); }
    40% { opacity: 1; transform: scale(1); }
}

.skylo-chat-form {
    display: flex;
    gap: 8px;
    padding: 12px;
    border-top: 1px solid #e2e8f0;
    background: #fff;
}

.skylo-chat-input {
    flex: 1;
    border: 1px solid #cbd5e1;
    border-radius: 12px;
    padding: 10px 14px;
    font-size: 14px;
    outline: none;
}

.skylo-chat-input:focus {
    border-color: var(--bs-blue, #244a7c);
}

.skylo-chat-send {
    width: 42px;
    height: 42px;
    border: none;
    border-radius: 12px;
    background: var(--bs-gold, #c9a227);
    color: #fff;
    cursor: pointer;
    font-size: 16px;
}

.skylo-chat-send:disabled {
    opacity: 0.6;
    cursor: wait;
}

@media only screen and (max-width: 600px) {
    .skylo-chat-panel {
        left: 0;
        right: 0;
        bottom: 0;
        width: 100%;
        max-width: 100%;
        height: 70vh;
        border-radius: 20px 20px 0 0;
    }
}
