/* =========================================
   STACKVEDA AI ASSISTANT
========================================= */

#svAssistant {
    font-family: 'Poppins', sans-serif;
    position: fixed;
    z-index: 999999;
}

/* ========================
   FAB (FLOATING BUTTON)
======================== */

.sv-chat-fab {
    position: fixed;
    right: 20px;
    bottom: 20px;
    width: 60px;
    height: 60px;
    border: none;
    border-radius: 50%;
    background: linear-gradient(135deg, #0d6efd, #6610f2);
    color: #fff;
    font-size: 24px;
    cursor: pointer;
    box-shadow: 0 10px 30px rgba(0, 0, 0, .2);
    transition: .3s;
    z-index: 99999;
}

.sv-chat-fab:hover {
    transform: translateY(-3px) scale(1.03);
}

.sv-chat-pulse {
    position: absolute;
    inset: 0;
    border-radius: 50%;
    animation: svPulse 2s infinite;
    background: rgba(13, 110, 253, .4);
    pointer-events: none;
}

@keyframes svPulse {
    0%   { transform: scale(1);   opacity: 1; }
    100% { transform: scale(1.7); opacity: 0; }
}

/* ========================
   POPUP
======================== */

.sv-chat-popup {
    position: fixed;
    right: 25px;
    bottom: 100px;
    width: 390px;
    max-width: calc(100vw - 20px);
    height: 700px;
    max-height: 80vh;
    background: #fff;
    border-radius: 22px;
    overflow: hidden;
    box-shadow: 0 20px 60px rgba(0, 0, 0, .25);
    display: flex;
    flex-direction: column;
    animation: svPopup .25s ease;
}

@keyframes svPopup {
    from { opacity: 0; transform: translateY(20px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* ========================
   HEADER
======================== */

.sv-chat-header {
    height: 72px;
    background: linear-gradient(135deg, #0d6efd, #6610f2);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 18px;
    flex-shrink: 0;
}

.sv-chat-header-left {
    display: flex;
    align-items: center;
    gap: 12px;
}

.sv-avatar {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    background: rgba(255, 255, 255, .15);
    display: flex;
    align-items: center;
    justify-content: center;
}

.sv-header-info h4 {
    color: #ffffff;
    margin: 0;
    font-size: 16px;
    font-weight: 600;
}

.sv-header-info span {
    font-size: 12px;
    opacity: .9;
}

.sv-chat-header-right {
    display: flex;
    gap: 8px;
}

.sv-header-btn {
    width: 34px;
    height: 34px;
    border: none;
    border-radius: 50%;
    background: rgba(255, 255, 255, .12);
    color: #fff;
    cursor: pointer;
    transition: background .2s;
}

.sv-header-btn:hover {
    background: rgba(255, 255, 255, .25);
}

/* ========================
   BODY
======================== */

.sv-chat-body {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    background: #f5f7fb;
    position: relative;
}

/* ========================
   STEPS (AUTH / OTP)
======================== */

.sv-step {
    padding: 24px 20px;
}

.sv-welcome-text {
    text-align: center;
    margin-bottom: 20px;
}

.sv-welcome-text h5 {
    font-size: 18px;
    font-weight: 700;
    color: #111;
    margin: 0 0 6px;
}

.sv-welcome-text p {
    font-size: 13px;
    color: #666;
    margin: 0;
    line-height: 1.5;
}

/* FORM GROUP */

.sv-form-group {
    margin-bottom: 16px;
}

.sv-form-group label {
    display: block;
    font-size: 12px;
    font-weight: 600;
    color: #333;
    margin-bottom: 6px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.sv-form-group input {
    width: 100%;
    padding: 12px 14px;
    border: 1.5px solid #dde2ea;
    border-radius: 12px;
    font-size: 14px;
    background: #fff;
    outline: none;
    transition: border-color .2s, box-shadow .2s;
    box-sizing: border-box;
}

.sv-form-group input:focus {
    border-color: #0d6efd;
    box-shadow: 0 0 0 3px rgba(13, 110, 253, .1);
}

.sv-form-group input::placeholder {
    color: #aaa;
}

/* ERROR MESSAGE */

.sv-error-msg {
    font-size: 13px;
    color: #dc3545;
    min-height: 18px;
    margin-bottom: 8px;
}

/* BUTTONS */

.sv-btn {
    width: 100%;
    padding: 13px;
    border: none;
    border-radius: 12px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all .2s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.sv-btn-primary {
    background: linear-gradient(135deg, #0d6efd, #6610f2);
    color: #fff;
    box-shadow: 0 4px 15px rgba(13, 110, 253, .3);
}

.sv-btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(13, 110, 253, .4);
}

.sv-btn-primary:active {
    transform: translateY(0);
}

.sv-btn-link {
    background: none;
    color: #0d6efd;
    font-size: 13px;
    padding: 10px;
    margin-top: 4px;
}

.sv-btn-link:hover {
    text-decoration: underline;
}

.sv-btn-loading {
    opacity: 0.65;
    pointer-events: none;
}

/* ========================
   MODE SELECT
======================== */

.sv-mode-title {
    padding: 25px 25px 0;
    font-size: 16px;
    font-weight: 600;
    color: #111;
}

.sv-mode-grid {
    padding: 25px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.sv-mode-btn {
    border: none;
    background: #fff;
    border-radius: 18px;
    padding: 18px;
    display: flex;
    gap: 18px;
    align-items: center;
    cursor: pointer;
    transition: .3s;
    text-align: left;
    box-shadow: 0 4px 15px rgba(0, 0, 0, .05);
}

.sv-mode-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, .1);
}

.sv-mode-icon {
    width: 58px;
    height: 58px;
    border-radius: 16px;
    background: #eef4ff;
    color: #0d6efd;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    flex-shrink: 0;
}

.sv-mode-icon.voice {
    background: #f3e8ff;
    color: #7c3aed;
}

.sv-mode-content h5 {
    margin: 0 0 4px;
    font-size: 15px;
    font-weight: 600;
    color: #111;
}

.sv-mode-content p {
    margin: 0;
    font-size: 13px;
    color: #666;
}

/* ========================
   CHAT BOX
======================== */

#svChatBox {
    height: 100%;
    display: flex;
    flex-direction: column;
}

#svMessages {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
}

/* ========================
   MESSAGES
======================== */

.sv-msg {
    margin-bottom: 16px;
    display: flex;
}

.sv-msg.user {
    justify-content: flex-end;
}

.sv-msg-bubble {
    max-width: 82%;
    padding: 14px 16px;
    border-radius: 18px;
    font-size: 14px;
    line-height: 1.6;
    word-break: break-word;
}

.sv-msg.user .sv-msg-bubble {
    background: #0d6efd;
    color: #fff;
    border-bottom-right-radius: 4px;
}

.sv-msg.user .sv-msg-bubble * {
    color: #fff !important;
}

.sv-msg.ai .sv-msg-bubble {
    background: #fff;
    color: #222;
    border-bottom-left-radius: 4px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, .05);
}

.sv-msg-bubble * {
    margin-bottom: 0px !important;
}

/* ========================
   INPUT
======================== */

.sv-chat-input {
    padding: 14px;
    border-top: 1px solid #eee;
    background: #fff;
    flex-shrink: 0;
}

.sv-input-wrapper {
    display: flex;
    align-items: center;
    background: #f4f6fb;
    border-radius: 14px;
    padding: 8px;
}

.sv-input-wrapper input {
    flex: 1;
    border: none;
    background: none;
    outline: none;
    padding: 10px;
    font-size: 14px;
}

.sv-input-wrapper input:disabled {
    opacity: 0.5;
}

.sv-input-wrapper button {
    width: 44px;
    height: 44px;
    border: none;
    border-radius: 12px;
    background: #0d6efd;
    color: #fff;
    cursor: pointer;
    transition: background .2s;
}

.sv-input-wrapper button:hover {
    background: #0b5ed7;
}

.sv-input-wrapper button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* ========================
   VOICE
======================== */

#svVoiceBox {
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 30px;
    text-align: center;
}

.sv-voice-visual {
    position: relative;
    margin-bottom: 24px;
}

.sv-voice-ring {
    position: absolute;
    inset: -18px;
    border-radius: 50%;
    border: 2px solid rgba(13, 110, 253, .2);
    animation: svVoicePulse 2s infinite;
}

@keyframes svVoicePulse {
    0%   { transform: scale(1);   opacity: 1; }
    100% { transform: scale(1.5); opacity: 0; }
}

.sv-voice-btn {
    width: 90px;
    height: 90px;
    border: none;
    border-radius: 50%;
    background: linear-gradient(135deg, #0d6efd, #6610f2);
    color: #fff;
    font-size: 34px;
    cursor: pointer;
    position: relative;
    z-index: 2;
    transition: transform .2s, box-shadow .2s;
}

.sv-voice-btn:hover {
    transform: scale(1.05);
}

.sv-voice-btn.sv-voice-active {
    background: linear-gradient(135deg, #dc3545, #e74c6f);
    box-shadow: 0 0 30px rgba(220, 53, 69, .4);
    animation: svVoicePulseBtn 1s infinite;
}

@keyframes svVoicePulseBtn {
    0%, 100% { transform: scale(1); }
    50%      { transform: scale(1.05); }
}

#svVoiceStatus {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 10px;
    color: #111;
}

#svVoiceHint {
    font-size: 13px;
    color: #666;
    max-width: 260px;
}

.sv-stop-voice-btn {
    margin-top: 24px;
    border: none;
    background: #dc3545;
    color: #fff;
    padding: 12px 18px;
    border-radius: 12px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    transition: background .2s;
}

.sv-stop-voice-btn:hover {
    background: #bb2d3b;
}

/* ========================
   VISIBILITY SAFETY NET
   Ensure d-none always overrides
   the display:flex on id selectors
======================== */

#svChatBox.d-none,
#svVoiceBox.d-none,
#svInputBox.d-none {
    display: none !important;
}

/* ========================
   TYPING INDICATOR
======================== */

.sv-typing {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 4px 0;
}

.sv-typing span {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #999;
    animation: svTyping 1.2s infinite;
}

.sv-typing span:nth-child(2) {
    animation-delay: .2s;
}

.sv-typing span:nth-child(3) {
    animation-delay: .4s;
}

@keyframes svTyping {
    0%, 100% { transform: translateY(0);    opacity: .4; }
    50%      { transform: translateY(-5px); opacity: 1;  }
}

/* ========================
   MOBILE RESPONSIVE
======================== */

@media (max-width: 768px) {

    .sv-chat-popup {
        right: 10px;
        left: 10px;
        bottom: 10px;
        width: auto;
        height: calc(100vh - 20px);
        max-height: none;
        border-radius: 18px;
    }

    .sv-chat-fab {
        right: 18px;
        bottom: 18px;
    }
}

/* ========================
   FEEDBACK BOX
======================== */

.sv-emoji-row {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    margin-top: 15px;
    padding: 0 10px;
}

.sv-emoji-btn {
    background: transparent;
    border: none;
    display: flex;
    flex-direction: column;
    align-items: center;
    cursor: pointer;
    transition: transform 0.2s, color 0.2s;
    color: #a0aec0;
    gap: 8px;
    padding: 10px 5px;
    border-radius: 12px;
}

.sv-emoji-btn i {
    font-size: 32px;
    transition: transform 0.2s;
}

.sv-emoji-btn span {
    font-size: 11px;
    font-weight: 600;
    opacity: 0;
    transform: translateY(5px);
    transition: opacity 0.2s, transform 0.2s;
}

.sv-emoji-btn:hover {
    color: #4a5568;
    transform: translateY(-2px);
}

.sv-emoji-btn:hover span {
    opacity: 1;
    transform: translateY(0);
}

.sv-emoji-btn.selected {
    color: #0d6efd;
    transform: scale(1.15);
}

.sv-emoji-btn.selected span {
    opacity: 1;
    transform: translateY(0);
    color: #0d6efd;
}

/* Specific Emoji Colors on Hover/Select */
.sv-emoji-btn[data-rating="1"].selected { color: #e53e3e; }
.sv-emoji-btn[data-rating="2"].selected { color: #dd6b20; }
.sv-emoji-btn[data-rating="3"].selected { color: #d69e2e; }
.sv-emoji-btn[data-rating="4"].selected { color: #38a169; }
.sv-emoji-btn[data-rating="5"].selected { color: #3182ce; }

.sv-review-textarea {
    width: 100%;
    padding: 14px;
    border: 1.5px solid #dde2ea;
    border-radius: 12px;
    font-size: 14px;
    background: #fff;
    outline: none;
    transition: border-color .2s, box-shadow .2s;
    box-sizing: border-box;
    height: 80px;
    resize: none;
    font-family: inherit;
}

.sv-review-textarea:focus {
    border-color: #0d6efd;
    box-shadow: 0 0 0 3px rgba(13, 110, 253, .1);
}

.sv-feedback-actions {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 15px;
}

/* Shake animation for missing rating */
@keyframes shakeEmoji {
    0%, 100% { transform: translateX(0); }
    20%, 60% { transform: translateX(-5px); }
    40%, 80% { transform: translateX(5px); }
}

.shake-emoji {
    animation: shakeEmoji 0.4s ease-in-out;
}

/* ========================
   THANK YOU BOX
======================== */

#svThankYouBox {
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.sv-thankyou-content {
    animation: svPopup 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.sv-thankyou-icon {
    font-size: 64px;
    color: #198754;
    margin-bottom: 20px;
    animation: svVoicePulseBtn 2s infinite;
}

.sv-thankyou-title {
    font-size: 24px;
    font-weight: 700;
    color: #111;
    margin-bottom: 8px;
}

.sv-thankyou-sub {
    font-size: 15px;
    color: #666;
}

/* ========================
   UTILITY SPACING
======================== */
.mt-20 {
    margin-top: 20px;
}
.text-center {
    text-align: center;
}
