/**
 * Voice Avatar Widget Styles
 * KIMS USHALAKSHMI Centre - Dr. Raghu Ram AI Avatar
 *
 * This file contains all CSS required for the floating widget
 * Include this file before initializing the widget
 *
 * @version 1.2.0
 */

/* Widget Button - Floating action button */
.voice-avatar-widget-button {
    position: fixed;
    bottom: 75px;
    right: 20px;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: #111111;
    color: #FFFFFF;
    border: none;
    cursor: pointer;
    box-shadow: 0 4px 18px rgba(0, 0, 0, 0.18);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 999998;
    animation: vaw-idle-pulse 2.8s ease-in-out infinite;
    transition: background 0.2s ease, transform 0.15s ease, box-shadow 0.15s ease;
}

.voice-avatar-widget-button::before {
    content: '';
    position: absolute;
    inset: -4px;
    border-radius: 50%;
    border: 2px solid rgba(218, 14, 142, 0.25);
    animation: vaw-ring-ripple 2.8s ease-in-out infinite;
    pointer-events: none;
}

.voice-avatar-widget-button::after {
    content: '';
    position: absolute;
    inset: -10px;
    border-radius: 50%;
    border: 1.5px solid rgba(218, 14, 142, 0.10);
    animation: vaw-ring-ripple 2.8s ease-in-out infinite 0.4s;
    pointer-events: none;
}

@keyframes vaw-idle-pulse {
    0%, 100% { transform: scale(1);      box-shadow: 0 4px 18px rgba(0,0,0,0.18); }
    50%       { transform: scale(1.045); box-shadow: 0 6px 24px rgba(0,0,0,0.26); }
}

@keyframes vaw-ring-ripple {
    0%   { opacity: 0.7; transform: scale(1);    }
    70%  { opacity: 0;   transform: scale(1.55); }
    100% { opacity: 0;   transform: scale(1.55); }
}

.voice-avatar-widget-button:hover {
    background: #DA0E8E !important;
    transform: scale(1.08) !important;
    box-shadow: 0 8px 28px rgba(218, 14, 142, 0.45) !important;
    animation: none !important;
}

.voice-avatar-widget-button:hover::before,
.voice-avatar-widget-button:hover::after { animation: none; opacity: 0; }

.voice-avatar-widget-button:active { transform: scale(0.95) !important; }

.voice-avatar-btn-icon {
    width: 28px;
    height: 28px;
    display: block;
    flex-shrink: 0;
}

.voice-avatar-widget-button:hover .voice-avatar-btn-wave { animation: vaw-wave-fade 1.2s ease-in-out infinite; }
.voice-avatar-widget-button:hover .wave-1 { animation-delay: 0s;    }
.voice-avatar-widget-button:hover .wave-2 { animation-delay: 0.25s; }

@keyframes vaw-wave-fade {
    0%,100% { opacity: 0;   }
    40%,60% { opacity: 0.7; }
}

.voice-avatar-widget-button.active {
    display: none;
}

/* Material Icons - included via CDN in widget */
.voice-avatar-widget-button .material-icons {
    font-size: 22px;
}

/* Prevent body scrolling when dialog is open */
body.voice-avatar-open {
    overflow: hidden !important;
}

/* Widget Dialog - Main container */
.voice-avatar-widget-dialog {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 420px;
    height: 600px;
    background: #FFFFFF;
    border-radius: 16px;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.12);
    border: 1px solid #111111;
    display: none;
    flex-direction: column;
    z-index: 999999;
    overflow: hidden;
}

.voice-avatar-widget-dialog.active {
    display: flex;
    animation: voiceAvatarSlideIn 0.3s ease-out;
}

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

/* Widget Header */
.voice-avatar-widget-header {
    background: #FFFFFF;
    color: #111111;
    padding: 16px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    min-height: 56px;
    border-bottom: 1px solid #111111;
}

.voice-avatar-widget-header h2 {
    font-size: 0.9rem;
    margin: 0;
    padding: 0;
    flex: 1;
    min-width: 0;
    font-weight: 500;
    line-height: 1.3;
    color: #111111;
    letter-spacing: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.voice-avatar-widget-info,
.voice-avatar-widget-close {
    background: transparent;
    color: #111111;
    width: 28px;
    height: 28px;
    min-width: 28px;
    min-height: 28px;
    cursor: pointer;
    font-size: 18px;
    font-weight: 300;
    font-family: Arial, sans-serif;
    line-height: 1;
    text-align: center;
    transition: background 0.15s;
    flex-shrink: 0;
    padding: 0;
    margin: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.voice-avatar-widget-close {
    border: 1px solid #111111;
    border-radius: 50%;
}

.voice-avatar-widget-info {
    margin-right: -12px;
    color: #6B7280;
}

.voice-avatar-widget-info .material-icons {
    font-size: 30px;
    line-height: 1;
    font-weight: 300;
}

.voice-avatar-widget-close .material-icons {
    font-size: 16px;
    line-height: 1;
}

.voice-avatar-widget-info:hover {
    background: transparent;
    color: #DA0E8E !important;
    opacity: 1;
}

.voice-avatar-widget-close:hover {
    background: #DA0E8E;
    color: #FFFFFF;
    border-color: #DA0E8E;
}

/* Widget Content Area */
.voice-avatar-widget-content {
    display: flex;
    flex-direction: column;
    flex: 1 1 auto;
    overflow: hidden;
    min-height: 0;
    height: 100%;
}

/* Avatar Video Section */
.voice-avatar-widget-video-section {
    position: relative;
    background: #FAFAFA;
    overflow: hidden;
    flex: 1;
    display: flex;
    justify-content: center;
    align-items: center;
}

.voice-avatar-widget-video {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center 20%;
    transform: translate(10px, -20px) scale(1.12);
    transform-origin: center 25%;
}

/* Loading State */
.voice-avatar-widget-loading {
    position: absolute;
    text-align: center;
    color: #666;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 2em;
    width: 100%;
}

.voice-avatar-widget-loading .spinner {
    border: 1px solid #E5E5E5;
    border-top: 1px solid #111111;
    border-radius: 50%;
    width: 32px;
    height: 32px;
    animation: voiceAvatarSpin 0.9s linear infinite;
    margin: 0 auto 15px;
}

.voice-avatar-widget-loading.idle .spinner {
    display: none;
}

.voice-avatar-widget-loading.idle .loading-message {
    display: none;
}

.voice-avatar-widget-loading .idle-content {
    display: none;
    text-align: center;
    max-width: 350px;
}

.voice-avatar-widget-loading.idle .idle-content {
    display: block;
    animation: voiceAvatarFadeIn 0.5s ease-in;
}

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

.voice-avatar-idle-icon {
    width: 80px;
    height: 80px;
    margin: 0 auto 22px;
    background: #FFFFFF;
    border: 1px solid #111111;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #111111;
    font-size: 1.4rem;
    font-weight: 500;
    letter-spacing: 0.06em;
    box-shadow: none;
}

.voice-avatar-idle-banner {
    display: block;
    width: 100%;
    max-width: 280px;
    height: auto;
    margin: 0 auto 18px;
    border-radius: 12px;
}

.voice-avatar-idle-title {
    font-size: 1rem;
    font-weight: 500;
    color: #111111;
    margin-bottom: 10px;
    line-height: 1.4;
    letter-spacing: 0;
}

.voice-avatar-idle-description {
    font-size: 0.825rem;
    color: #6B7280;
    line-height: 1.6;
    margin-bottom: 0;
    max-width: 280px;
}

.voice-avatar-idle-cta {
    display: none;
}

.voice-avatar-widget-loading p {
    font-size: 0.85rem;
    color: #64748B;
}

/* Primary CTA in idle body (subtle pink brand accent) */
.voice-avatar-cta-talk-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    margin-top: 22px;
    padding: 10px 22px;
    background: #FFFFFF;
    border: 1px solid #E91E8C;
    color: #E91E8C;
    font-size: 0.85rem;
    font-weight: 500;
    border-radius: 999px;
    cursor: pointer;
    transition: background 0.15s;
    font-family: inherit;
    line-height: 1.3;
    text-align: center;
}

.voice-avatar-cta-talk-button:hover:not(:disabled) {
    background: #DA0E8E;
    color: #FFFFFF;
    border-color: #DA0E8E;
}

.voice-avatar-cta-talk-button:disabled {
    border-color: #D4D4D4;
    color: #D4D4D4;
    cursor: not-allowed;
    background: #FFFFFF;
}

/* Disclaimer / connecting state: medical disclaimer */
.voice-avatar-connecting-content {
    display: none;
    text-align: left;
    max-width: 320px;
    padding: 0 4px;
}

.voice-avatar-widget-loading.disclaimer .voice-avatar-connecting-content,
.voice-avatar-widget-loading.connecting .voice-avatar-connecting-content {
    display: block;
    animation: voiceAvatarFadeIn 0.4s ease-in;
}

.voice-avatar-widget-loading.disclaimer .spinner,
.voice-avatar-widget-loading.disclaimer > .loading-message,
.voice-avatar-widget-loading.connecting .spinner,
.voice-avatar-widget-loading.connecting > .loading-message {
    display: none;
}

.voice-avatar-widget-loading .voice-avatar-connecting-content .disclaimer-title {
    font-size: 0.92rem;
    font-weight: 600;
    color: #111111;
    margin-bottom: 12px;
    letter-spacing: 0;
    display: flex;
    align-items: center;
    gap: 6px;
}

.voice-avatar-widget-loading .voice-avatar-connecting-content .disclaimer-mark {
    color: #E91E8C;
    font-size: 1.05rem;
    line-height: 1;
}

.voice-avatar-widget-loading .voice-avatar-connecting-content p {
    font-size: 0.78rem;
    color: #6B7280;
    line-height: 1.55;
    margin: 0 0 10px;
}

.voice-avatar-widget-loading .voice-avatar-connecting-content p.urgent {
    color: #111111;
    font-weight: 500;
}

.voice-avatar-disclaimer-actions {
    display: none;
    align-items: center;
    justify-content: center;
    gap: 10px;
    margin-top: 16px;
    padding-top: 14px;
    border-top: 1px solid #E5E5E5;
}

.voice-avatar-widget-loading.disclaimer .voice-avatar-disclaimer-actions {
    display: flex;
}

.voice-avatar-widget-loading.connecting .voice-avatar-disclaimer-actions,
.voice-avatar-widget-loading.disclaimer .voice-avatar-connecting-status {
    display: none;
}

.voice-avatar-disclaimer-agree,
.voice-avatar-disclaimer-exit {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 38px;
    padding: 9px 16px;
    border-radius: 999px;
    font-family: inherit;
    font-size: 0.8rem;
    font-weight: 500;
    line-height: 1.25;
    cursor: pointer;
    transition: background 0.15s, color 0.15s, border-color 0.15s;
}

.voice-avatar-disclaimer-agree {
    background: #DA0E8E;
    border: 1px solid #DA0E8E;
    color: #FFFFFF;
}

.voice-avatar-disclaimer-agree:hover:not(:disabled) {
    background: #B80C78;
    border-color: #B80C78;
}

.voice-avatar-disclaimer-exit {
    background: #FFFFFF;
    border: 1px solid #D4D4D4;
    color: #111111;
}

.voice-avatar-disclaimer-exit:hover:not(:disabled) {
    border-color: #111111;
}

.voice-avatar-disclaimer-agree:disabled,
.voice-avatar-disclaimer-exit:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.voice-avatar-connecting-status {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    margin-top: 14px;
    padding-top: 12px;
    border-top: 1px solid #E5E5E5;
    font-size: 0.68rem;
    color: #6B7280;
    text-transform: uppercase;
    letter-spacing: 0.1em;
}

.voice-avatar-connecting-status .spinner-inline {
    width: 12px;
    height: 12px;
    border: 1px solid #E5E5E5;
    border-top: 1px solid #111111;
    border-radius: 50%;
    animation: voiceAvatarSpin 0.9s linear infinite;
}

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

/* Control Section - Bottom controls */
.voice-avatar-widget-controls {
    flex: 0 0 auto;
    padding: 14px 20px 14px;
    background: #FFFFFF;
    border-top: 1px solid #111111;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

.voice-avatar-ai-disclaimer-note {
    font-size: 0.7rem;
    color: #94A3B8;
    margin-top: 2px;
    letter-spacing: 0.01em;
    text-align: center;
}

.voice-avatar-state-display {
    display: none;
    align-items: center;
    gap: 6px;
    padding: 0;
    background: transparent;
    font-size: 0.7rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: #6B7280;
    transition: color 0.2s ease;
}

.voice-avatar-state-display .material-icons {
    font-size: 14px;
}

.voice-avatar-state-display.idle {
    display: none;
}

.voice-avatar-state-display.connected,
.voice-avatar-state-display.listening,
.voice-avatar-state-display.speaking {
    display: flex;
    color: #111111;
}

.voice-avatar-control-buttons {
    display: inline-flex;
    gap: 10px;
    align-items: center;
    padding: 6px;
    background: transparent;
    border-radius: 999px;
}

.voice-avatar-control-buttons button {
    border: none;
    cursor: pointer;
    transition: all 0.15s ease;
}

.voice-avatar-control-buttons button:disabled {
    cursor: not-allowed;
}

.voice-avatar-btn-mic,
.voice-avatar-btn-connect,
.voice-avatar-btn-disconnect {
    width: 42px;
    height: 42px;
    min-width: 42px;
    min-height: 42px;
    border-radius: 50%;
    background: #FFFFFF;
    border: 1px solid #111111;
    color: #111111;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s;
    flex-shrink: 0;
    padding: 0;
    box-shadow: none;
}

.voice-avatar-btn-mic .material-icons,
.voice-avatar-btn-connect .material-icons,
.voice-avatar-btn-disconnect .material-icons {
    font-size: 20px;
    line-height: 1;
    display: block;
}

.voice-avatar-btn-connect:hover:not(:disabled),
.voice-avatar-btn-disconnect:hover:not(:disabled),
.voice-avatar-btn-mic:hover:not(:disabled) {
    background: #F5F5F5;
}

.voice-avatar-btn-mic.muted {
    background: #111111;
    color: #FFFFFF;
}

.voice-avatar-btn-mic.muted:hover:not(:disabled) {
    background: #000000;
}

.voice-avatar-btn-mic:disabled {
    border-color: #D4D4D4;
    color: #D4D4D4;
    cursor: not-allowed;
}

.voice-avatar-btn-mic:disabled:hover {
    background: #FFFFFF;
}

/* Toast Notifications */
.voice-avatar-toast {
    position: fixed;
    bottom: 100px;
    right: 50%;
    transform: translateX(50%);
    background: rgba(0, 0, 0, 0.85);
    color: white;
    padding: 12px 24px;
    border-radius: 8px;
    font-size: 0.85rem;
    z-index: 999999;
    animation: voiceAvatarSlideInToast 0.3s ease-out;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

@keyframes voiceAvatarSlideInToast {
    from { opacity: 0; transform: translate(50%, 20px); }
    to { opacity: 1; transform: translate(50%, 0); }
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .voice-avatar-widget-dialog {
        width: calc(100vw - 24px);
        max-height: calc(100vh - 24px);
        max-height: calc(100dvh - 24px);
        bottom: max(12px, env(safe-area-inset-bottom));
        right: 12px;
        border-radius: 14px;
    }

    .voice-avatar-widget-button {
        bottom: 16px;
        right: 16px;
        width: 54px;
        height: 54px;
    }

    .voice-avatar-btn-icon {
        width: 26px;
        height: 26px;
    }

    .voice-avatar-widget-header {
        padding: 14px 16px;
        min-height: 52px;
    }

    .voice-avatar-widget-header h2 {
        font-size: 0.88rem;
    }

    .voice-avatar-widget-info,
    .voice-avatar-widget-close {
        width: 30px;
        height: 30px;
        min-width: 30px;
        min-height: 30px;
    }

    .voice-avatar-widget-loading {
        padding: 1.5em 1em;
    }

    .voice-avatar-idle-icon {
        width: 72px;
        height: 72px;
        font-size: 1.25rem;
        margin-bottom: 18px;
    }

    .voice-avatar-idle-title {
        font-size: 0.98rem;
    }

    .voice-avatar-idle-description {
        font-size: 0.82rem;
        max-width: 100%;
        padding: 0 4px;
    }

    .voice-avatar-cta-talk-button {
        margin-top: 18px;
        padding: 12px 22px;
        font-size: 0.88rem;
        max-width: calc(100% - 16px);
    }

    .voice-avatar-widget-loading .voice-avatar-connecting-content {
        max-width: 100%;
        padding: 0 6px;
    }

    .voice-avatar-widget-loading .voice-avatar-connecting-content .disclaimer-title {
        font-size: 0.9rem;
    }

    .voice-avatar-widget-loading .voice-avatar-connecting-content p {
        font-size: 0.78rem;
    }

    .voice-avatar-disclaimer-actions {
        flex-direction: column;
        align-items: stretch;
    }

    .voice-avatar-disclaimer-agree,
    .voice-avatar-disclaimer-exit {
        width: 100%;
    }

    .voice-avatar-widget-controls {
        padding: 12px 16px 16px;
    }

    .voice-avatar-control-buttons {
        gap: 12px;
    }

    .voice-avatar-btn-mic,
    .voice-avatar-btn-connect,
    .voice-avatar-btn-disconnect {
        width: 46px;
        height: 46px;
        min-width: 46px;
        min-height: 46px;
    }

    .voice-avatar-btn-mic .material-icons,
    .voice-avatar-btn-connect .material-icons,
    .voice-avatar-btn-disconnect .material-icons {
        font-size: 22px;
    }

    .voice-avatar-widget-video {
        transform: translate(8px, -20px) scale(1.2);
        transform-origin: center 28%;
    }
}

@media (max-width: 380px) {
    .voice-avatar-widget-dialog {
        width: calc(100vw - 16px);
        max-height: calc(100vh - 16px);
        max-height: calc(100dvh - 16px);
        bottom: max(8px, env(safe-area-inset-bottom));
        right: 8px;
    }

    .voice-avatar-idle-icon {
        width: 64px;
        height: 64px;
        font-size: 1.15rem;
    }
}
/* intentionally added to hide the text temporary */
.voice-avatar-idle-description {
    display: none;
}