/**
 * Nepal Vivah AI Support Assistant Stylesheet
 *
 * @package NepalVivah\Theme
 */

/* ==========================================================================
   1. FLOATING LAUNCHER BUTTON
   ========================================================================== */

.nv-ai-launcher {
    position: fixed;
    bottom: 14px;
    right: 14px;
    z-index: 99990;
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
    transition: transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.nv-ai-launcher:hover {
    transform: scale(1.06) translateY(-2px);
}

.nv-ai-launcher:active {
    transform: scale(0.96);
}

/* Floating Tooltip Pill - Hidden by default, smoothly shows on hover */
.nv-ai-launcher-pill {
    background: #FFFFFF;
    color: var(--nv-dark, #1E1B18);
    font-size: 13px;
    font-weight: 700;
    padding: 8px 14px;
    border-radius: 20px;
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.14);
    border: 1px solid #E2E8F0;
    white-space: nowrap;
    display: flex;
    align-items: center;
    gap: 6px;
    opacity: 0;
    visibility: hidden;
    transform: translateX(10px);
    pointer-events: none;
    transition: opacity 0.25s ease, transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1), visibility 0.25s;
}

.nv-ai-launcher:hover .nv-ai-launcher-pill {
    opacity: 1;
    visibility: visible;
    transform: translateX(0);
}

.nv-ai-launcher-pill span.sparkle {
    font-size: 14px;
    display: inline-block;
    animation: nvSparkleSpin 3s infinite linear;
}

/* Launcher Circle Button */
.nv-ai-launcher-btn {
    width: 54px;
    height: 54px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--nv-primary, #8B1E3F) 0%, #5E0D22 100%);
    border: 2.5px solid var(--nv-secondary, #C9A227);
    color: #FFFFFF;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 6px 20px rgba(139, 30, 63, 0.35);
    position: relative;
    transition: all 0.3s ease;
}

.nv-ai-launcher-btn svg.icon-robot {
    width: 28px;
    height: 28px;
    fill: #FFFFFF;
    transition: transform 0.3s ease;
}

.nv-ai-launcher:hover .nv-ai-launcher-btn svg.icon-robot {
    transform: rotate(10deg) scale(1.08);
}

/* Pulsing Online Radar Dot */
.nv-ai-online-pulse {
    position: absolute;
    top: 2px;
    right: 2px;
    width: 12px;
    height: 12px;
    background: #10B981;
    border: 2px solid #FFFFFF;
    border-radius: 50%;
    box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7);
    animation: nvPulseGreen 2s infinite;
}

/* ==========================================================================
   2. CHAT MODAL CONTAINER
   ========================================================================== */

.nv-ai-widget {
    position: fixed;
    bottom: 74px;
    right: 14px;
    width: 385px;
    max-width: calc(100vw - 28px);
    height: 570px;
    max-height: calc(100vh - 95px);
    background: #FFFFFF;
    border-radius: 20px;
    box-shadow: 0 16px 40px rgba(0, 0, 0, 0.22), 0 0 0 1px rgba(0, 0, 0, 0.06);
    display: flex;
    flex-direction: column;
    z-index: 99999;
    overflow: hidden;
    opacity: 0;
    visibility: hidden;
    transform: translateY(24px) scale(0.94);
    transform-origin: bottom right;
    transition: opacity 0.3s ease, transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1), visibility 0.3s;
}

.nv-ai-widget.is-open {
    opacity: 1;
    visibility: visible;
    transform: translateY(0) scale(1);
}

/* ==========================================================================
   3. CHAT HEADER
   ========================================================================== */

.nv-ai-header {
    background: linear-gradient(135deg, var(--nv-primary, #8B1E3F) 0%, #5E0D22 100%);
    color: #FFFFFF;
    padding: 14px 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: relative;
    border-bottom: 2px solid var(--nv-secondary, #C9A227);
    flex-shrink: 0;
}

.nv-ai-header-left {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
}

.nv-ai-avatar {
    width: 38px;
    height: 38px;
    background: rgba(255, 255, 255, 0.15);
    border: 1.5px solid var(--nv-secondary, #C9A227);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    flex-shrink: 0;
}

.nv-ai-header-title-wrap {
    min-width: 0;
}

.nv-ai-header-title {
    margin: 0;
    font-size: 15px;
    font-weight: 700;
    color: #FFFFFF;
    line-height: 1.2;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.nv-ai-header-status {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 11.5px;
    color: rgba(255, 255, 255, 0.85);
    margin-top: 2px;
}

.nv-ai-status-dot {
    width: 7px;
    height: 7px;
    background: #10B981;
    border-radius: 50%;
    box-shadow: 0 0 5px #10B981;
}

/* Header Controls */
.nv-ai-header-controls {
    display: flex;
    align-items: center;
    gap: 6px;
}

/* Language Toggle Button */
.nv-ai-lang-toggle {
    background: rgba(255, 255, 255, 0.15);
    border: 1px solid rgba(255, 255, 255, 0.3);
    color: #FFFFFF;
    font-size: 11px;
    font-weight: 700;
    padding: 3px 8px;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
    user-select: none;
}

.nv-ai-lang-toggle:hover {
    background: rgba(255, 255, 255, 0.28);
}

.nv-ai-btn-ctrl {
    background: transparent;
    border: none;
    color: #FFFFFF;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 16px;
    transition: background 0.2s ease;
}

.nv-ai-btn-ctrl:hover {
    background: rgba(255, 255, 255, 0.2);
}

/* ==========================================================================
   4. CHAT BODY & MESSAGES STREAM
   ========================================================================== */

.nv-ai-body {
    flex: 1;
    overflow-y: auto;
    padding: 16px 14px;
    background: #FAF8F5;
    display: flex;
    flex-direction: column;
    gap: 12px;
    scroll-behavior: smooth;
}

/* Custom Scrollbar */
.nv-ai-body::-webkit-scrollbar {
    width: 5px;
}
.nv-ai-body::-webkit-scrollbar-thumb {
    background: #CBD5E1;
    border-radius: 4px;
}

/* Welcome Card */
.nv-ai-welcome-card {
    background: #FFFFFF;
    border: 1px solid #E2E8F0;
    border-radius: 16px;
    padding: 14px 16px;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.04);
    margin-bottom: 4px;
}

.nv-ai-welcome-card h4 {
    margin: 0 0 6px 0;
    font-size: 14px;
    font-weight: 700;
    color: var(--nv-primary, #8B1E3F);
    display: flex;
    align-items: center;
    gap: 6px;
}

.nv-ai-welcome-card p {
    margin: 0;
    font-size: 12.5px;
    line-height: 1.5;
    color: #475569;
}

/* Quick Question Suggestions */
.nv-ai-suggestions-wrap {
    margin-top: 10px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.nv-ai-suggestions-label {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #94A3B8;
}

.nv-ai-chips-list {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.nv-ai-chip {
    background: #FFFFFF;
    border: 1px solid #E2E8F0;
    color: #334155;
    font-size: 12px;
    padding: 6px 11px;
    border-radius: 14px;
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: left;
    line-height: 1.3;
}

.nv-ai-chip:hover {
    background: #FFF5F7;
    border-color: var(--nv-primary, #8B1E3F);
    color: var(--nv-primary, #8B1E3F);
    transform: translateY(-1px);
    box-shadow: 0 2px 6px rgba(139, 30, 63, 0.1);
}

/* Chat Message Rows */
.nv-ai-msg-row {
    display: flex;
    gap: 8px;
    max-width: 92%;
    animation: nvMsgFadeIn 0.25s ease-out;
}

.nv-ai-msg-row.user {
    align-self: flex-end;
    flex-direction: row-reverse;
}

.nv-ai-msg-row.assistant {
    align-self: flex-start;
}

.nv-ai-msg-avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: #FFFFFF;
    border: 1px solid var(--nv-secondary, #C9A227);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    flex-shrink: 0;
}

.nv-ai-msg-bubble {
    padding: 10px 14px;
    border-radius: 16px;
    font-size: 13px;
    line-height: 1.5;
    word-break: break-word;
    position: relative;
}

.nv-ai-msg-row.user .nv-ai-msg-bubble {
    background: linear-gradient(135deg, var(--nv-primary, #8B1E3F) 0%, #6F132E 100%);
    color: #FFFFFF;
    border-bottom-right-radius: 4px;
    box-shadow: 0 2px 6px rgba(139, 30, 63, 0.2);
}

.nv-ai-msg-row.assistant .nv-ai-msg-bubble {
    background: #FFFFFF;
    color: #1E293B;
    border: 1px solid #E2E8F0;
    border-bottom-left-radius: 4px;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.04);
}

.nv-ai-msg-bubble a {
    color: var(--nv-primary, #8B1E3F);
    font-weight: 700;
    text-decoration: underline;
}

.nv-ai-msg-bubble a:hover {
    color: #5E0D22;
}

.nv-ai-msg-row.user .nv-ai-msg-bubble a {
    color: #FDE68A;
}

.nv-ai-msg-time {
    font-size: 10px;
    color: #94A3B8;
    margin-top: 4px;
    text-align: right;
}

.nv-ai-msg-row.user .nv-ai-msg-time {
    color: rgba(255, 255, 255, 0.7);
}

/* Typing Dots Animation */
.nv-ai-typing {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 8px 12px;
}

.nv-ai-typing-dot {
    width: 6px;
    height: 6px;
    background: #94A3B8;
    border-radius: 50%;
    animation: nvTypingBounce 1.4s infinite ease-in-out both;
}

.nv-ai-typing-dot:nth-child(1) { animation-delay: -0.32s; }
.nv-ai-typing-dot:nth-child(2) { animation-delay: -0.16s; }

/* ==========================================================================
   5. CHAT FOOTER & INPUT AREA
   ========================================================================== */

.nv-ai-footer {
    padding: 10px 14px 12px;
    background: #FFFFFF;
    border-top: 1px solid #E2E8F0;
    flex-shrink: 0;
}

.nv-ai-input-form {
    display: flex;
    align-items: center;
    gap: 8px;
    background: #F8FAFC;
    border: 1.5px solid #E2E8F0;
    border-radius: 24px;
    padding: 4px 6px 4px 14px;
    transition: all 0.2s ease;
}

.nv-ai-input-form:focus-within {
    border-color: var(--nv-primary, #8B1E3F);
    background: #FFFFFF;
    box-shadow: 0 0 0 3px rgba(139, 30, 63, 0.1);
}

.nv-ai-input {
    flex: 1;
    border: none;
    background: transparent;
    font-size: 13.5px;
    color: #0F172A;
    outline: none;
    padding: 6px 0;
}

.nv-ai-input::placeholder {
    color: #94A3B8;
}

.nv-ai-send-btn {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--nv-primary, #8B1E3F);
    border: none;
    color: #FFFFFF;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.nv-ai-send-btn:hover:not(:disabled) {
    background: #731732;
    transform: scale(1.06);
}

.nv-ai-send-btn:disabled {
    background: #CBD5E1;
    cursor: not-allowed;
}

.nv-ai-send-btn svg {
    width: 16px;
    height: 16px;
    fill: currentColor;
}

.nv-ai-disclaimer {
    margin: 6px 0 0 0;
    font-size: 10px;
    color: #94A3B8;
    text-align: center;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
}

/* ==========================================================================
   6. ANIMATIONS & RESPONSIVE
   ========================================================================== */

@keyframes nvPulseGreen {
    0% { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7); }
    70% { box-shadow: 0 0 0 7px rgba(16, 185, 129, 0); }
    100% { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0); }
}

@keyframes nvPillBounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-4px); }
}

@keyframes nvSparkleSpin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

@keyframes nvMsgFadeIn {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes nvTypingBounce {
    0%, 80%, 100% { transform: scale(0); }
    40% { transform: scale(1.0); }
}

/* Mobile Screen Adaptation */
@media (max-width: 640px) {
    .nv-ai-launcher {
        bottom: 16px;
        right: 16px;
    }

    body.has-sticky-action-bar .nv-ai-launcher,
    .nv-single-profile-page ~ .nv-ai-launcher {
        bottom: 76px;
    }

    .nv-ai-launcher-pill {
        display: none;
    }

    .nv-ai-launcher-btn {
        width: 50px;
        height: 50px;
    }

    .nv-ai-widget {
        bottom: 0;
        right: 0;
        left: 0;
        width: 100vw;
        max-width: 100vw;
        height: 92dvh;
        height: 92vh;
        max-height: 92vh;
        border-bottom-left-radius: 0;
        border-bottom-right-radius: 0;
        border-top-left-radius: 20px;
        border-top-right-radius: 20px;
        transform: translateY(100%);
    }

    .nv-ai-widget.is-open {
        transform: translateY(0);
    }
}

