/**
 * 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
 */

/* Widget Button - Floating action button */
.voice-avatar-widget-button {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: #FFFFFF;
    color: #111111;
    border: 1px solid #111111;
    cursor: pointer;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.06);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
    z-index: 999998;
}

.voice-avatar-widget-button:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.10);
}

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

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

/* 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-close {
    background: transparent;
    border: 1px solid #111111;
    color: #111111;
    width: 28px;
    height: 28px;
    min-width: 28px;
    min-height: 28px;
    border-radius: 50%;
    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:hover {
    background: #F5F5F5;
}

/* 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;
}

/* 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-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-widget-loading p {
    font-size: 0.85rem;
    color: #64748B;
}

@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 18px;
    background: #FFFFFF;
    border-top: 1px solid #111111;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
}

.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 - 40px);
        height: calc(100vh - 40px);
        bottom: 20px;
        right: 20px;
    }

    .voice-avatar-widget-button {
        bottom: 20px;
        right: 20px;
    }
}
