@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@300;400;600;700&display=swap');

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Poppins', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: black;
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    position: relative;
    overflow: hidden;
}

.orb {
    position: absolute;
    border-radius: 50%;
    filter: blur(80px);
    z-index: 0;
    pointer-events: none;
    animation: orbPulse 0.3s ease-in-out infinite;
}

@keyframes orbPulse {
    0%, 100% {
        transform: scale(3);
        opacity: 0;
    }
    50% {
        transform: scale(2);
        opacity: 1;
    }
}

.container {
    border-radius: 24px;
    padding: 48px;
    max-width: 600px;
    width: 100%;
    text-align: center;
    position: relative;
    z-index: 10;
}

.logo {
    width: 120px;
    height: 120px;
    background: linear-gradient(135deg, #ffd700 0%, #ffed4e 50%, #ffd700 100%);
    background-size: 200% 200%;
    animation: logoShine 4s ease-in-out infinite;
    border-radius: 50%;
    margin: 0 auto 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 48px;
    box-shadow: 0 4px 20px rgba(255, 215, 0, 0.6), 0 0 60px rgba(255, 215, 0, 0.3);
}

@keyframes logoShine {
    0%, 100% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
}

h1 {
    font-size: 32px;
    background: linear-gradient(135deg, #ffd700 0%, #ffed4e 50%, #ffd700 100%);
    background-size: 200% 200%;
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    animation: titleShine 5s ease-in-out infinite;
    margin-bottom: 8px;
    text-shadow: 0 2px 4px rgba(0,0,0,0.3);
    filter: drop-shadow(0 0 10px rgba(255, 215, 0, 0.4));
}

@keyframes titleShine {
    0%, 100% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
}

.subtitle {
    font-size: 14px;
    color: #94a3b8;
    font-weight: 500;
    letter-spacing: 0.025em;
}

.status {
    padding: 12px 24px;
    border-radius: 12px;
    font-weight: 600;
    margin-bottom: 24px;
    display: inline-block;
}

.status.idle {
    background: #4a4a4a;
    color: #e0e0e0;
    border: 1px solid #666;
}

.status.connecting {
    background: #ffd700;
    color: #1a1a1a;
    border: 1px solid #ffed4e;
}

.status.connected {
    background: #4caf50;
    color: white;
    border: 1px solid #66bb6a;
}

.voice-orb {
    width: 150px;
    height: 150px;
    margin: 40px auto;
    position: relative;
    cursor: pointer;
    transition: transform 0.3s ease;
}

.voice-orb:hover {
    transform: scale(1.05);
}

.orb-inner {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    background: linear-gradient(135deg, #ffd700 0%, #ffed4e 50%, #ffd700 100%);
    background-size: 200% 200%;
    animation: orbShine 3s ease-in-out infinite;
    position: relative;
    z-index: 2;
    box-shadow: 0 8px 32px rgba(255, 215, 0, 0.4);
}

.orb-glow {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 100%;
    height: 100%;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(255, 215, 0, 0.3) 0%, transparent 70%);
    animation: orbPulseGlow 2s ease-in-out infinite;
    z-index: 1;
}

@keyframes orbShine {
    0%, 100% {
        background-position: 0% 50%;
    }
    50% {
        background-position: 100% 50%;
    }
}

@keyframes orbPulseGlow {
    0%, 100% {
        transform: translate(-50%, -50%) scale(1);
        opacity: 0.6;
    }
    50% {
        transform: translate(-50%, -50%) scale(1.3);
        opacity: 1;
    }
}

.orb-label {
    text-align: center;
    color: #cbd5e1;
    font-size: 14px;
    font-weight: 500;
    margin-top: -10px;
    transition: all 0.3s ease;
}

.orb-label.listening {
    color: #ffd700;
    font-weight: 600;
}

.orb-label.speaking {
    color: #4caf50;
    font-weight: 600;
}

.voice-orb.orb-connecting .orb-inner {
    animation: orbShine 1s ease-in-out infinite, orbPulseScale 1s ease-in-out infinite;
}

.voice-orb.orb-active .orb-inner {
    background: linear-gradient(135deg, #ffd700 0%, #ffed4e 50%, #ffd700 100%);
    box-shadow: 0 8px 32px rgba(255, 215, 0, 0.6);
}

@keyframes orbPulseScale {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.1);
    }
}

.info {
    margin-top: 32px;
    padding-top: 32px;
    border-top: 2px solid #555;
    display: none;
}

.info-item {
    display: flex;
    justify-content: space-between;
    padding: 12px 0;
    color: #b0b0b0;
}

.info-label {
    font-weight: 600;
    color: #ffd700;
}

.error {
    background: #4a2020;
    color: #ff6b6b;
    padding: 16px;
    border-radius: 12px;
    margin-top: 24px;
    border: 1px solid #ff6b6b;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.6; }
}

.connecting-animation {
    animation: pulse 1.5s ease-in-out infinite;
    box-shadow: 0 0 20px rgba(255, 215, 0, 0.5);
}

.header {
    display: inline-flex;
    align-items: center;
    gap: 20px;
    margin-bottom: 40px;
}

.dealershop-logo {
    width: 80px;
    height: auto;
    flex-shrink: 0;
}

.header-text {
    text-align: left;
}

.powered-by {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-top: 40px;
    padding-top: 20px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.powered-text {
    font-size: 12px;
    color: #64748b;
    font-weight: 400;
}

.acessefy-logo {
    width: 20px;
    height: auto;
}

.acessefy-text {
    font-size: 14px;
    font-weight: 600;
    color: #cbd5e1;
}

.fy-gradient {
    background: linear-gradient(135deg, #00FCA8 0%, #1CDAFF 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

/* Transcrição */
.transcription {
    margin-top: 24px;
    min-height: 60px;
    max-height: 200px;
    overflow-y: auto;
    padding-right: 8px;
}

.transcription::-webkit-scrollbar {
    width: 6px;
}

.transcription::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 3px;
}

.transcription::-webkit-scrollbar-thumb {
    background: rgba(255, 215, 0, 0.3);
    border-radius: 3px;
}

.transcription::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 215, 0, 0.5);
}

.transcript-item {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 12px;
    padding: 12px 16px;
    margin-bottom: 8px;
    text-align: left;
    animation: fadeIn 0.3s ease;
}

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

.transcript-label {
    font-weight: 600;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-right: 8px;
}

.user-transcript .transcript-label {
    color: #ffd700;
}

.agent-transcript .transcript-label {
    color: #4caf50;
}

.transcript-text {
    color: #e2e8f0;
    font-size: 14px;
    line-height: 1.5;
}

.transcript-item.interim {
    opacity: 0.7;
    font-style: italic;
}

/* Debug Console */
.debug-console {
    margin-top: 24px;
    border-radius: 12px;
    padding: 16px;
    max-height: 300px;
    overflow-y: auto;
}

.debug-header {
    font-weight: 600;
    color: #ffd700;
    margin-bottom: 12px;
    font-size: 14px;
}

.debug-content {
    font-size: 12px;
    color: #cbd5e1;
}

.debug-log {
    padding: 8px;
    margin-bottom: 4px;
    border-radius: 4px;
    background: rgba(255, 255, 255, 0.05);
    border-left: 3px solid #ffd700;
    animation: slideInLog 0.3s ease-out;
}

@keyframes slideInLog {
    from {
        opacity: 0;
        transform: translateX(-10px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.debug-log.error {
    border-left-color: #ff6b6b;
    background: rgba(255, 107, 107, 0.1);
}

.debug-log.success {
    border-left-color: #4caf50;
    background: rgba(76, 175, 80, 0.1);
}

.debug-log .timestamp {
    color: #64748b;
    font-size: 10px;
    margin-right: 8px;
}

/* Avatar Container */
.avatar-container {
    width: 150px;
    height: 150px;
    margin: 32px auto 0;
    border-radius: 50%;
    overflow: hidden;
    box-shadow: 0 8px 32px rgba(255, 215, 0, 0.4);
    border: none;
    background: transparent;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.6s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

.avatar-container:hover {
    transform: scale(1.05);
}

/* Estado expandido */
.avatar-container.expanded {
    width: 350px;
    height: 350px;
    box-shadow: 0 8px 32px rgba(255, 215, 0, 0.3), 0 0 60px rgba(255, 215, 0, 0.2);
    background: linear-gradient(135deg, #1e293b 0%, #0f172a 100%);
}

.avatar-container.expanded:hover {
    transform: scale(1);
}

/* Orbe amarela pulsante (estado inicial) */
.avatar-orb {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2;
    transition: opacity 0.3s ease;
}

.avatar-container.expanded .avatar-orb {
    opacity: 0;
    pointer-events: none;
}

/* Vídeo do avatar (escondido inicialmente) */
.avatar-video {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    z-index: 1;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.avatar-container.expanded .avatar-video {
    opacity: 1;
}

/* Animação de pulso quando avatar está ativo */
.avatar-container.active {
    animation: avatarPulse 2s ease-in-out infinite;
}

/* Estado: Conectando - Loading circular */
.avatar-container.orb-connecting {
    border: 4px solid rgba(255, 215, 0, 0.3) !important;
    position: relative;
    overflow: visible !important;
}

.avatar-container.orb-connecting::after {
    content: '';
    position: absolute;
    top: -10px;
    left: -10px;
    right: -10px;
    bottom: -10px;
    border-radius: 50%;
    border: 4px solid transparent;
    border-top-color: #ffd700;
    border-right-color: #ffd700;
    animation: spinBorderLoader 2s linear infinite;
    pointer-events: none;
    z-index: 999;
}

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

.avatar-container.orb-connecting .orb-inner {
    animation: orbShine 1s ease-in-out infinite, orbPulseScale 1s ease-in-out infinite;
}

/* Texto de carregamento */
.loading-text {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-family: 'Poppins', sans-serif;
    font-size: 16px;
    font-weight: 600;
    color: #ffd700;
    letter-spacing: 1px;
    opacity: 0;
    pointer-events: none;
    z-index: 1000;
    text-shadow: 0 0 15px rgba(255, 215, 0, 0.4);
    transition: opacity 0.3s ease;
}

/* Animação dos três pontinhos */
.loading-text::after {
    content: '';
    animation: loadingDots 1.5s steps(4, end) infinite;
}

@keyframes loadingDots {
    0% { content: ''; }
    25% { content: '.'; }
    50% { content: '..'; }
    75% { content: '...'; }
    100% { content: ''; }
}

.avatar-container.orb-connecting .loading-text {
    opacity: 1;
}

/* Estado: Escutando (listening) */
.avatar-container.orb-listening {
    border-color: #4caf50;
    box-shadow: 0 8px 32px rgba(76, 175, 80, 0.4), 0 0 60px rgba(76, 175, 80, 0.3);
}

.avatar-container.orb-listening .orb-glow {
    background: radial-gradient(circle, rgba(76, 175, 80, 0.4) 0%, transparent 70%);
}

/* Estado: Falando (speaking) */
.avatar-container.orb-speaking {
    border: 4px solid #2196f3 !important;
    box-shadow: 0 8px 32px rgba(33, 150, 243, 0.4), 0 0 60px rgba(33, 150, 243, 0.3);
}

.avatar-container.orb-speaking .orb-glow {
    background: radial-gradient(circle, rgba(33, 150, 243, 0.4) 0%, transparent 70%);
    animation: orbPulseGlow 1s ease-in-out infinite;
}

@keyframes avatarPulse {
    0%, 100% {
        box-shadow: 0 8px 32px rgba(255, 215, 0, 0.3), 0 0 60px rgba(255, 215, 0, 0.2);
    }
    50% {
        box-shadow: 0 8px 32px rgba(255, 215, 0, 0.5), 0 0 80px rgba(255, 215, 0, 0.4);
    }
}

/* Avatar controles (se necessário) */
.avatar-controls {
    position: absolute;
    bottom: 40px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 16px;
    z-index: 1001;
}

.avatar-control-btn {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: white;
    padding: 12px 24px;
    border-radius: 8px;
    cursor: pointer;
    font-family: 'Poppins', sans-serif;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
}

.avatar-control-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: scale(1.05);
}

.avatar-control-btn.danger {
    background: rgba(255, 107, 107, 0.2);
    border-color: #ff6b6b;
}

.avatar-control-btn.danger:hover {
    background: rgba(255, 107, 107, 0.3);
}

/* ====================================== */
/* ÁREA DE CONTROLES E BOTÃO DE SAIR */
/* ====================================== */

.controls-area {
    display: flex;
    justify-content: center;
    align-items: center;
    margin-top: 24px;
    gap: 16px;
}

.exit-button {
    padding: 8px 16px;
    background: transparent;
    border: 1px solid rgba(148, 163, 184, 0.3);
    border-radius: 6px;
    color: #94a3b8;
    font-family: 'Poppins', sans-serif;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 6px;
}

.exit-button::before {
    content: '✕';
    font-size: 16px;
    font-weight: 600;
}

.exit-button:hover {
    background: rgba(148, 163, 184, 0.1);
    border-color: rgba(148, 163, 184, 0.5);
    color: #cbd5e1;
}

.avatar-selection {
    display: flex;
    gap: 12px;
    justify-content: center;
}

.avatar-select-button {
    padding: 8px 20px;
    background: transparent;
    border: 1px solid rgba(148, 163, 184, 0.3);
    border-radius: 6px;
    color: #94a3b8;
    font-family: 'Poppins', sans-serif;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 6px;
}

.hudson-button {
    border-color: rgba(148, 163, 184, 0.3);
    color: #94a3b8;
}

.hudson-button:hover:not(:disabled) {
    background: rgba(148, 163, 184, 0.1);
    border-color: rgba(148, 163, 184, 0.5);
    color: #cbd5e1;
}

.alex-button {
    border-color: rgba(148, 163, 184, 0.3);
    color: #94a3b8;
}

.alex-button:hover:not(:disabled) {
    background: rgba(148, 163, 184, 0.1);
    border-color: rgba(148, 163, 184, 0.5);
    color: #cbd5e1;
}

.avatar-select-button:disabled {
    cursor: not-allowed;
    opacity: 0.5;
}

/* ====================================== */
/* RESPONSIVIDADE - Mobile First */
/* ====================================== */

/* Tablets e telas menores */
@media (max-width: 768px) {
    .container {
        padding: 32px 24px;
        max-width: 100%;
    }

    /* Avatar menor em mobile */
    .avatar-container {
        width: 120px;
        height: 120px;
    }

    .avatar-container.expanded {
        width: 280px;
        height: 280px;
    }

    /* Header menor */
    .header {
        flex-direction: column;
        gap: 12px;
        margin-bottom: 24px;
    }

    .dealershop-logo {
        width: 60px;
    }

    .header-text {
        text-align: center;
    }

    h1 {
        font-size: 24px;
    }

    .subtitle {
        font-size: 12px;
    }

    /* Debug console menor */
    .debug-console {
        max-height: 200px;
        font-size: 11px;
    }

    .transcription {
        max-height: 150px;
    }
}

/* Mobile pequeno */
@media (max-width: 480px) {
    .container {
        padding: 24px 16px;
    }

    .avatar-container {
        width: 100px;
        height: 100px;
    }

    .avatar-container.expanded {
        width: 240px;
        height: 240px;
    }

    h1 {
        font-size: 20px;
    }

    .debug-console {
        max-height: 150px;
    }

    .transcription {
        max-height: 120px;
    }
}

