/* =========================================================
   HIRA AI CHATBOT
   Standalone stylesheet
   Hira National Education Foundation Pakistan
   ========================================================= */

/* ---------- Floating Chatbot Container ---------- */
.hira-ai-widget {
    position: fixed;
    right: 24px;
    bottom: 24px;
    z-index: 999999;
    font-family: inherit;
}

/* ---------- Floating Button ---------- */
.hira-ai-button {
    width: 60px;
    height: 60px;
    border: 0;
    border-radius: 50%;
    background: #003679;
    color: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 6px 24px rgba(0, 0, 0, 0.22);
    transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
    outline: none;
}

.hira-ai-button:hover {
    transform: translateY(-2px) scale(1.03);
    background: #002b61;
    box-shadow: 0 9px 28px rgba(0, 0, 0, 0.28);
}

.hira-ai-button:focus-visible {
    box-shadow: 0 0 0 4px rgba(255, 187, 56, 0.45),
                0 6px 24px rgba(0, 0, 0, 0.22);
}

.hira-ai-button i,
.hira-ai-button .fa,
.hira-ai-button .fas,
.hira-ai-button .far {
    font-size: 25px;
    line-height: 1;
}

/* ---------- Chat Window ---------- */
.hira-ai-window {
    position: absolute;
    right: 0;
    bottom: 76px;
    width: 380px;
    max-width: calc(100vw - 30px);
    height: 560px;
    max-height: calc(100vh - 110px);
    background: #ffffff;
    border-radius: 16px;
    overflow: hidden;
    display: none;
    flex-direction: column;
    box-shadow: 0 16px 50px rgba(0, 0, 0, 0.25);
    border: 1px solid rgba(0, 54, 121, 0.12);
}

.hira-ai-window.is-open {
    display: flex;
}

/* ---------- Header ---------- */
.hira-ai-header {
    min-height: 72px;
    padding: 14px 16px;
    background: #003679;
    color: #ffffff;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.hira-ai-header-content {
    min-width: 0;
    display: flex;
    align-items: center;
    gap: 11px;
}

.hira-ai-header-icon {
    width: 42px;
    height: 42px;
    min-width: 42px;
    border-radius: 50%;
    background: #ffbb38;
    color: #003679;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
}

.hira-ai-header-title {
    margin: 0;
    color: #ffffff;
    font-size: 17px;
    line-height: 1.25;
    font-weight: 700;
}

.hira-ai-header-subtitle {
    margin: 3px 0 0;
    color: rgba(255, 255, 255, 0.82);
    font-size: 12px;
    line-height: 1.3;
}

.hira-ai-close {
    width: 34px;
    height: 34px;
    min-width: 34px;
    border: 0;
    padding: 0;
    border-radius: 50%;
    background: transparent;
    color: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 19px;
    transition: background 0.2s ease;
}

.hira-ai-close:hover {
    background: rgba(255, 255, 255, 0.14);
}

.hira-ai-close:focus-visible {
    outline: 2px solid #ffbb38;
    outline-offset: 2px;
}

/* ---------- Messages Area ---------- */
.hira-ai-messages {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    padding: 18px 14px;
    background: #f5f7fa;
    scroll-behavior: smooth;
}

.hira-ai-messages::-webkit-scrollbar {
    width: 6px;
}

.hira-ai-messages::-webkit-scrollbar-track {
    background: transparent;
}

.hira-ai-messages::-webkit-scrollbar-thumb {
    background: rgba(0, 54, 121, 0.22);
    border-radius: 10px;
}

/* ---------- Message Rows ---------- */
.hira-ai-message {
    display: flex;
    width: 100%;
    margin-bottom: 12px;
}

.hira-ai-message:last-child {
    margin-bottom: 0;
}

.hira-ai-message.user {
    justify-content: flex-end;
}

.hira-ai-message.assistant {
    justify-content: flex-start;
}

/* ---------- Message Bubbles ---------- */
.hira-ai-bubble {
    max-width: 82%;
    padding: 10px 13px;
    border-radius: 14px;
    font-size: 14px;
    line-height: 1.55;
    word-wrap: break-word;
    overflow-wrap: anywhere;
}

.hira-ai-message.assistant .hira-ai-bubble {
    background: #ffffff;
    color: #333333;
    border: 1px solid #e7eaf0;
    border-bottom-left-radius: 5px;
}

.hira-ai-message.user .hira-ai-bubble {
    background: #003679;
    color: #ffffff;
    border-bottom-right-radius: 5px;
}

.hira-ai-bubble p {
    margin: 0 0 7px;
}

.hira-ai-bubble p:last-child {
    margin-bottom: 0;
}

.hira-ai-bubble ul,
.hira-ai-bubble ol {
    margin: 6px 0 4px 18px;
    padding: 0;
}

.hira-ai-bubble li {
    margin-bottom: 3px;
}

.hira-ai-bubble a {
    color: #003679;
    text-decoration: underline;
}

.hira-ai-message.user .hira-ai-bubble a {
    color: #ffffff;
}

/* ---------- Typing Indicator ---------- */
.hira-ai-typing {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    min-height: 18px;
}

.hira-ai-typing span {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #003679;
    animation: hira-ai-bounce 1.2s infinite ease-in-out;
}

.hira-ai-typing span:nth-child(2) {
    animation-delay: 0.15s;
}

.hira-ai-typing span:nth-child(3) {
    animation-delay: 0.3s;
}

@keyframes hira-ai-bounce {
    0%, 60%, 100% {
        transform: translateY(0);
        opacity: 0.45;
    }
    30% {
        transform: translateY(-4px);
        opacity: 1;
    }
}

/* ---------- Suggestions ---------- */
.hira-ai-suggestions {
    display: flex;
    flex-wrap: wrap;
    gap: 7px;
    margin-top: 10px;
}

.hira-ai-suggestion {
    border: 1px solid rgba(0, 54, 121, 0.22);
    background: #ffffff;
    color: #003679;
    border-radius: 20px;
    padding: 7px 10px;
    font-size: 12px;
    line-height: 1.25;
    cursor: pointer;
    transition: background 0.2s ease, border-color 0.2s ease, transform 0.2s ease;
}

.hira-ai-suggestion:hover {
    background: #fff7e6;
    border-color: #ffbb38;
    transform: translateY(-1px);
}

.hira-ai-suggestion:focus-visible {
    outline: 2px solid #ffbb38;
    outline-offset: 2px;
}

/* ---------- Input Area ---------- */
.hira-ai-input-area {
    flex: 0 0 auto;
    padding: 10px;
    background: #ffffff;
    border-top: 1px solid #e7eaf0;
}

.hira-ai-input-form {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0;
}

.hira-ai-input {
    flex: 1 1 auto;
    min-width: 0;
    height: 44px;
    border: 1px solid #d9dee7;
    border-radius: 23px;
    background: #f8f9fb;
    color: #333333;
    padding: 0 15px;
    font-family: inherit;
    font-size: 14px;
    outline: none;
    box-shadow: none;
    transition: border-color 0.2s ease, background 0.2s ease;
}

.hira-ai-input::placeholder {
    color: #8a929e;
}

.hira-ai-input:focus {
    border-color: #003679;
    background: #ffffff;
}

.hira-ai-send {
    width: 44px;
    height: 44px;
    min-width: 44px;
    border: 0;
    border-radius: 50%;
    background: #003679;
    color: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: transform 0.2s ease, background 0.2s ease;
}

.hira-ai-send:hover {
    background: #002b61;
    transform: scale(1.04);
}

.hira-ai-send:focus-visible {
    outline: 2px solid #ffbb38;
    outline-offset: 2px;
}

.hira-ai-send i,
.hira-ai-send .fa,
.hira-ai-send .fas {
    font-size: 16px;
}

/* ---------- Small Status / Error Text ---------- */
.hira-ai-status {
    padding: 5px 4px 0;
    color: #777f8c;
    font-size: 11px;
    text-align: center;
}

.hira-ai-error {
    color: #a32626;
}

/* ---------- Mobile ---------- */
@media (max-width: 575.98px) {
    .hira-ai-widget {
        right: 14px;
        bottom: 14px;
    }

    .hira-ai-button {
        width: 56px;
        height: 56px;
    }

    .hira-ai-window {
        position: fixed;
        right: 10px;
        left: 10px;
        bottom: 82px;
        width: auto;
        max-width: none;
        height: min(570px, calc(100vh - 100px));
        max-height: calc(100vh - 100px);
        border-radius: 14px;
    }

    .hira-ai-header {
        min-height: 66px;
        padding: 12px 13px;
    }

    .hira-ai-header-title {
        font-size: 16px;
    }

    .hira-ai-header-subtitle {
        font-size: 11px;
    }

    .hira-ai-messages {
        padding: 14px 11px;
    }

    .hira-ai-bubble {
        max-width: 88%;
        font-size: 13px;
    }

    .hira-ai-input-area {
        padding: 8px;
    }
}

/* ---------- Very Small Screens ---------- */
@media (max-width: 360px) {
    .hira-ai-widget {
        right: 10px;
        bottom: 10px;
    }

    .hira-ai-button {
        width: 52px;
        height: 52px;
    }

    .hira-ai-window {
        right: 6px;
        left: 6px;
        bottom: 70px;
        height: calc(100vh - 84px);
        max-height: calc(100vh - 84px);
    }

    .hira-ai-header-icon {
        width: 38px;
        height: 38px;
        min-width: 38px;
        font-size: 18px;
    }
}

/* ---------- Accessibility ---------- */
@media (prefers-reduced-motion: reduce) {
    .hira-ai-button,
    .hira-ai-close,
    .hira-ai-suggestion,
    .hira-ai-send,
    .hira-ai-input {
        transition: none;
    }

    .hira-ai-messages {
        scroll-behavior: auto;
    }

    .hira-ai-typing span {
        animation: none;
    }
}

/* ---------- Prevent accidental Bootstrap/theme interference ---------- */
.hira-ai-widget *,
.hira-ai-widget *::before,
.hira-ai-widget *::after {
    box-sizing: border-box;
}

.hira-ai-widget button,
.hira-ai-widget input {
    font-family: inherit;
}

.hira-ai-widget button {
    text-transform: none;
}

.hira-ai-widget img {
    max-width: 100%;
    height: auto;
}

/* =========================================================
   END HIRA AI CHATBOT STYLES
   ========================================================= */
