﻿* {
    box-sizing: border-box;
    font-family: "Open Sans", sans-serif;
}

body {
    margin: 0;
    background: #fff;
    background-size: cover;
    display: flex;
    justify-content: center;
    height: 100vh;
    height: 100dvh;
}

/* CHAT CONTAINER */
.chat-container {
    width: 100%;
    max-width: 480px;
    background: radial-gradient(61.29% 50.69% at 50% 44.07%, #005993 0%, #002D52 100%);
    background-size: cover;
    display: flex;
    flex-direction: column;
    height: 100vh;
    height: 100dvh;
    position: relative;
    margin: 0 auto;
}

/* HEADER */
.chat-header {
    padding: 20px 14px;
    color: #fff;
    font-weight: 500;
    font-size: 20px;
    /* background-blend-mode: multiply; */
}

/* CHAT BODY */
.chat-body {
    flex: 1;
    padding: 16px;
    overflow-y: auto;
    /* Hide scrollbar - Firefox */
    scrollbar-width: none;
    /* Hide scrollbar - IE / Edge legacy */
    -ms-overflow-style: none;
}

    .chat-body::-webkit-scrollbar {
        display: none;
    }

.message {
    max-width: 80%;
    padding: 12px 14px;
    border-radius: 12px;
    margin-bottom: 12px;
    font-size: 14px;
    line-height: 1.4;
    position: relative;
}

.bot {
    align-self: flex-start;
}

.user {
    background: #e9f1ff;
    align-self: flex-end;
}

/* TYPING DOTS */
.typing {
    display: inline-flex;
    gap: 4px;
    align-items: end;
}

    .typing span {
        width: 6px;
        height: 6px;
        background: #666;
        border-radius: 50%;
        animation: blink 1.4s infinite both;
        margin-bottom: 4px;
        display: block;
    }

        .typing span:nth-child(2) {
            animation-delay: 0.2s;
        }

        .typing span:nth-child(3) {
            animation-delay: 0.4s;
        }

@keyframes blink {
    0% {
        opacity: 0.2;
    }

    20% {
        opacity: 1;
    }

    100% {
        opacity: 0.2;
    }
}

/* INPUT AREA */
.chat-input {
    padding: 12px;
    display: flex !important;
    align-items: center;
    gap: 8px;
}
.form-control:focus {
    color: #fff;
    background: linear-gradient(82.23deg, #05080B 61.57%, #001B3B 95.38%);
    border: 1px solid #ccc;
    outline: 0;
    box-shadow: none;
}

    .chat-input input {
        flex: 1;
        padding: 10px 12px;
        border-radius: 20px;
        border: 1px solid #ccc;
        outline: none;
        font-size: 14px;
    }

    .chat-input button {
        background: linear-gradient(148.57deg, #0084FF -18.24%, #550276 70.29%);
        border: none;
        color: #fff;
        padding: 10px 12px;
        border-radius: 50%;
        cursor: pointer;
        font-size: 14px;
        width: 42px;
        height: 42px;
    }

.mic-btn {
    background: #0aa89e;
}

.mic-btn {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    border: none;
    background: linear-gradient(148.57deg, #0084FF -18.24%, #550276 70.29%);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    position: relative;
}

/* Inner dot */
.mic-dot {
    width: 14px;
    height: 14px;
    background: #555;
    border-radius: 50%;
    transition: all 0.3s ease;
}

/* ACTIVE RECORDING STATE */
.mic-btn.active {
    background: #ffe5e5;
}

    .mic-btn.active .mic-dot {
        background: #e53935;
        animation: pulse 1.2s infinite;
    }

/* Pulse animation */
@keyframes pulse {
    0% {
        transform: scale(1);
        opacity: 1;
    }

    50% {
        transform: scale(1.6);
        opacity: 0.5;
    }

    100% {
        transform: scale(1);
        opacity: 1;
    }
}

.chat-input textarea {
    flex: 1;
    resize: none;
    padding: 10px 14px;
    border-radius: 20px;
    background: linear-gradient(82.23deg, #05080B 61.57%, #001B3B 95.38%);
    border: 1px solid #008ABA;
    outline: none;
    box-shadow: 0px 10px 20px -8px #009BBE;
    font-size: 18px;
    line-height: 1.4;
    max-height: 40vh;
    /* ⬅️ Max 40% of screen height */
    overflow-y: auto;
    color: #CECECE;
    /* Hide scrollbar - Firefox */
    scrollbar-width: none;
    /* Hide scrollbar - IE / Edge legacy */
    -ms-overflow-style: none;
    height: 50px;
}

    /* Hide scrollbar - Chrome, Safari, Edge */
    .chat-input textarea::-webkit-scrollbar {
        display: none;
    }

/* Standard */
textarea::placeholder {
    color: #CECECE;
    opacity: 1; /* Prevents lighter color in some browsers */
}

/* Chrome, Safari, Edge */
textarea::-webkit-input-placeholder {
    color: #CECECE;
}

/* Firefox */
textarea::-moz-placeholder {
    color: #CECECE;
    opacity: 1;
}

/* Older Firefox */
textarea:-moz-placeholder {
    color: #CECECE;
    opacity: 1;
}

/* Internet Explorer 10-11 */
textarea:-ms-input-placeholder {
    color: #CECECE;
}

/* Microsoft Edge (Legacy) */
textarea::-ms-input-placeholder {
    color: #CECECE;
}

.message {
    width: fit-content;
    max-width: 85%;
    padding: 16px 18px;
    border-radius: 22px;
    margin-bottom: 16px;
    font-size: 16px;
    color: #fff;
    position: relative;
    transition: all .25s ease;
    /* ✅ Critical fixes */
    word-wrap: break-word;
    overflow-wrap: break-word;
    /* white-space: pre-wrap; */
}

    .message.user {
        background: rgba(0, 0, 0, 0.2);
        background-blend-mode: multiply;
        margin-left: auto;
        text-align: left;
    }

    .message.bot {
        margin-right: auto;
        padding-left: 0;
    }

.message {
    background-clip: padding-box;
}

.mic-btn {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    border: none;
    background: #e0e0e0;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

/* Wave container */
.wave {
    display: flex;
    gap: 3px;
    align-items: center;
    height: 18px;
}

    /* Wave bars */
    .wave span {
        width: 4px;
        height: 6px;
        background: #fff;
        border-radius: 2px;
        transition: height 0.2s ease;
    }

/* ACTIVE LISTENING STATE */
.mic-btn.active {
    background: linear-gradient(148.57deg, #0084FF -18.24%, #550276 70.29%);
}

    .mic-btn.active .wave span {
        background: #fff;
        animation: waveMove 1s infinite ease-in-out;
    }

        /* Stagger animation */
        .mic-btn.active .wave span:nth-child(1) {
            animation-delay: 0s;
        }

        .mic-btn.active .wave span:nth-child(2) {
            animation-delay: 0.15s;
        }

        .mic-btn.active .wave span:nth-child(3) {
            animation-delay: 0.3s;
        }

/* Wave animation */
@keyframes waveMove {
    0% {
        height: 6px;
    }

    50% {
        height: 16px;
    }

    100% {
        height: 6px;
    }
}

/* TTS Controls */
.tts-controls {
    position: absolute;
    left: 0;
    top: 85%;
    transform: translateY(0px);
    display: flex;
    /* flex-direction: column; */
    gap: 10px;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.message.bot:hover .tts-controls {
    opacity: 1;
}

.tts-controls button {
    background: transparent;
    border: 0.5px solid #0083FE;
    width: 25px;
    height: 25px;
    display: flex;
    justify-content: center;
    align-items: center;
}

    .tts-btn {
        width: 20px;
        height: 20px;
        border-radius: 50%;
        border: none;
        cursor: pointer;
        font-size: 12px;
        background: #0057ff;
        color: #fff;
    }

.mcq-options {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 10px;
}

.mcq-option {
    padding: 10px 14px;
    border-radius: 20px;
    border: 0.5px solid #438BB8;
    background: transparent;
    color: #FFFFFF;
    cursor: pointer;
    font-size: 14px;
    text-align: left;
}

    .mcq-option:hover {
        background: #9ACBF9;
        color: #004A8F;
    }

    .mcq-option:disabled {
        opacity: 0.6;
        cursor: not-allowed;
    }

.question-heading {
    text-transform: uppercase;
    color: #FFCF0D;
    position: relative;
}

    .question-heading::after {
        content: "";
        display: block;
        width: calc(100% - 108px);
        height: 1px;
        background: #FFCF0D;
        position: absolute;
        left: 108px;
        bottom: 8px;
    }

.system {
    background: #fff3cd;
    color: #856404;
    border: 1px solid #ffeeba;
    font-size: 14px;
    text-align: center;
}

.mic-timer {
    position: absolute;
    bottom: -18px;
    font-size: 11px;
    color: #e53935;
    font-weight: 600;
    display: none;
}

.mic-btn.active .mic-timer {
    display: block;
}

.textarea-wrapper {
    position: relative;
    flex: 1;
}

    .textarea-wrapper textarea {
        width: 100%;
        padding-right: 55px;
        /* space for timer */
    }

/* TIMER INSIDE TEXTAREA */
.voice-timer {
    position: absolute;
    right: 50px;
    bottom: 18px;
    font-size: 12px;
    font-weight: 600;
    color: #e53935;
    background: rgba(255, 255, 255, 0.85);
    padding: 2px 6px;
    border-radius: 6px;
    display: none;
}

    /* show only while recording */
    .mic-btn.active ~ .textarea-wrapper .voice-timer,
    .voice-timer.active {
        display: block;
    }

/* New */
/* mic visible by default */
.mic-icon {
    width: 20px;
    height: 20px;
    transition: .25s ease;
}

/* wave hidden initially */
.wave {
    display: none;
}

/* when recording */
.mic-btn.active .mic-icon {
    display: none;
}

.mic-btn.active .wave {
    display: flex;
}

#submit-btn {
    position: absolute;
    bottom: 5px;
    right: 0px;
    background: none;
}

/* FULL SCREEN OVERLAY */
#thinkingOverlay {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(5, 10, 25, .45);
    backdrop-filter: blur(6px);
    opacity: 0;
    pointer-events: none;
    transition: .25s;
}

    /* visible state */
    #thinkingOverlay.active {
        opacity: 1;
        pointer-events: auto;
    }


/* glass box */
.thinking-box {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 14px;
    padding: 26px 34px;
    border-radius: 22px;
    background: linear-gradient(145deg, rgba(255, 255, 255, .12), rgba(255, 255, 255, .05));
    backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, .18);
    box-shadow: inset 0 4px 10px rgba(255, 255, 255, .15), 0 25px 60px rgba(0, 0, 0, .6);
}


/* spinner */
.thinking-loader {
    width: 46px;
    height: 46px;
    border-radius: 50%;
    border: 4px solid rgba(255, 255, 255, .15);
    border-top: 4px solid #4cc9ff;
    animation: spin .9s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* text */
.thinking-text {
    color: #fff;
    font-size: 15px;
    letter-spacing: .4px;
    font-weight: 500;
}
/* Progress bar */
.progress-wrapper {
    width: 100%;
}

.progress-text {
    margin-bottom: 8px;
    font-weight: 600;
}

.progress-bar {
    width: 95%;
    height: 4px;
    background: rgba(255, 255, 255, 0.15);
    border-radius: 20px;
    overflow: hidden;
    margin: 0 auto;
    backdrop-filter: blur(21.5px)
}

.progress {
    height: 100%;
    width: 0%;
    background: #00D0FF;
    border-radius: 200px;
    transition: width .4s ease;
}
#a1{
    display: flex;
    align-items: center;
    gap: 10px;
    color: #fff;
}

#a1 input{
    margin-right: 10px;
}
.exit-btn {
    display: inline-flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    background: rgba(93, 177, 255, 1);
    color: #013E78;
    font-size: 15px;
    font-weight: 500;
    padding: 10px 18px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.2s ease, transform 0.1s ease;
}

    .exit-btn::after {
        content: "›";
        font-size: 18px;
        line-height: 1;
    }

    .exit-btn:hover {
        background: #4d95d4;
    }

    .exit-btn:active {
        transform: scale(0.97);
    }
.exit-buttons {
    display: flex;
    flex-direction: column; /* stack vertically */
    gap: 10px; /* space between buttons */
    margin-top: 10px;
}
/* CARD BASE */

.card {
    width: 100%;
    max-width: 480px;
    background: radial-gradient(61.29% 50.69% at 50% 44.07%, #005993 0%, #004575 56.17%, #002D52 100%);
    background-size: cover;
    display: flex;
    flex-direction: column;
    height: 100vh;
    position: relative;
    margin: 0 auto;
}
.header {
    text-align: center;
    padding: 20px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.15);
}

    .header a {
        font-weight: 600;
        font-size: 22px;
        text-decoration: none;
        color: #fff;
    }

.button {
    width: 342px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 20px auto;
    text-decoration: none;
    color: rgba(0, 74, 143, 1);
    background: rgba(154, 203, 249, 1);
    border-radius: 40px;
    font-weight: 700;
    font-size: 16px;
}

    .button.new {
        color: rgba(255, 255, 255, 1);
        background: rgba(2, 65, 121, 1);
    }

h1 {
    font-weight: 300;
    font-size: 14px;
    color: #fff;
    text-align: center;
    line-height: 25px;
}

    h1 span {
        font-weight: 300;
        display: block;
        font-size: 25px;
        text-align: center;
    }

        h1 span.res {
            font-weight: 600;
            line-height: 40px;
        }

.result {
    display: flex;
    justify-content: space-evenly;
    flex-direction: column;
    align-items: center;
    height: 100%;
}

    .result img {
        display: flex;
        margin: 0 auto;
    }

/* toast */
/* ===============================
   TOAST STYLES
================================ */
.toast_r {
    position: absolute;
    bottom: 100px;
    right: 20px;
    width: 280px;
    z-index: 999;
    opacity: 0;
    transform: translateY(20px) scale(.95);
    pointer-events: none;
    transition: all .3s ease;
}

    /* Visible state */
    .toast_r.active {
        opacity: 1;
        transform: translateY(0) scale(1);
        pointer-events: auto;
    }

/* Glass box */
.toast-content {
    padding: 18px;
    border-radius: 18px;
    background: linear-gradient(145deg, rgba(255, 255, 255, 0.15), rgba(0, 0, 0, .15));
    backdrop-filter: blur(18px);
    border: 1px solid rgba(255, 255, 255, .18);
    box-shadow: inset 0 4px 10px rgba(255, 255, 255, .12), 0 20px 40px rgba(0, 0, 0, .6);
    color: #fff;
    font-size: 14px;
}

.toast-text {
    margin-bottom: 14px;
    line-height: 1.4;
    color: #fff;
}

/* CTA buttons */
.toast-actions {
    display: flex;
    gap: 10px;
    justify-content: center;
}

.toast-btn {
    border: none;
    border-radius: 14px;
    padding: 10px 12px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    flex: 1;
}

    .toast-btn.primary {
        background: #024179;
        color: #FFFFFF;
    }

    .toast-btn.secondary {
        background: #9ACBF9;
        color: #004A8F;
    }