#ai-widget {
    position: fixed;
    bottom: 24px;
    right: 24px;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    z-index: 9999;
}

#toggle {
    border-radius: 30px;
    font-size: 16px;
    box-shadow: var(--shadow);
    cursor: pointer;
    margin-top: 10px;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 20px;
}

#ai-chat-window {
    width: 350px;
    height: 500px;
    border: 1px solid var(--border);
    border-radius: 16px;
    display: flex;
    flex-direction: column;
    background: var(--surface);
    box-shadow: var(--shadow-strong);
    overflow: hidden;
    transition: all 0.3s ease;
    transform-origin: bottom right;
}

.ai-chat-hidden {
    display: none !important;
}

/* Setup View */
#setup-view {
    padding: 24px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 15px;
    height: 100%;
    box-sizing: border-box;
    text-align: center;
}

#setup-view h3 {
    margin: 0 0 10px 0;
    font-size: 20px;
    color: var(--text);
}

#setup-view p {
    font-size: 14px;
    color: var(--muted);
    margin-bottom: 20px;
}

#setup-view button {
    width: 100%;
}

#setup-view button:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* Chat View */
#chat-view {
    display: none;
    flex-direction: column;
    height: 100%;
}

#chat-header {
    background: var(--surface-soft);
    border-bottom: 1px solid var(--border);
    color: var(--text);
    padding: 12px 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-weight: bold;
}

#messages {
    flex: 1;
    padding: 16px;
    overflow-y: auto;
    background: var(--bg);
    display: flex;
    flex-direction: column;
}

.msg {
    margin: 8px 0;
    font-size: 14px;
    padding: 10px 14px;
    border-radius: 18px;
    max-width: 85%;
    line-height: 1.4;
    word-wrap: break-word;
}

.user { 
    background: var(--primary); 
    color: #08111a; 
    align-self: flex-end; 
    border-bottom-right-radius: 4px;
}

.agent { 
    background: var(--surface-soft); 
    color: var(--text); 
    align-self: flex-start; 
    border-bottom-left-radius: 4px;
    border: 1px solid var(--border);
}

.system { 
    color: var(--muted); 
    font-size: 12px; 
    text-align: center; 
    margin: 5px auto; 
    background: none;
    padding: 0;
}

#controls {
    display: flex;
    gap: 8px;
    padding: 12px;
    border-top: 1px solid var(--border);
    background: var(--surface);
    align-items: center;
}

#mic {
    background: var(--surface-soft);
    color: var(--text);
    border: 1px solid var(--border);
    border-radius: 50%;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: var(--transition);
    font-size: 16px;
}

#mic:hover {
    background: var(--border);
}

#mic.active {
    background: #ef4444;
    color: white;
    border-color: #ef4444;
}

#text {
    flex: 1;
    padding: 10px 15px;
    border: 1px solid var(--border);
    background: var(--surface-soft);
    color: var(--text);
    border-radius: 20px;
    outline: none;
    font-size: 14px;
    transition: var(--transition);
}

#text:focus {
    border-color: var(--primary);
}

#send {
    background: var(--primary);
    color: #08111a;
    border: none;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
}

#send:hover {
    transform: scale(1.05);
}

@media (max-width: 480px) {
    #ai-chat-window {
        width: calc(100vw - 48px);
        height: 60vh;
    }
}
