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

:root {
    --primary: #7c9885;
    --primary-dark: #5a7a63;
    --secondary: #b8c5b9;
    --bg: #f5f7f5;
    --text: #2d3e30;
    --text-light: #6b7c6e;
    --white: #ffffff;
    --shadow: rgba(45, 62, 48, 0.1);
    --danger: #e74c3c;
}

body {
    font-family: 'Poppins', sans-serif;
    background: linear-gradient(135deg, var(--bg) 0%, var(--secondary) 100%);
    min-height: 100vh;
    color: var(--text);
    overflow-x: hidden;
}

/* Background Animation */
.background-animation {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 0;
    overflow: hidden;
}

.circle {
    position: absolute;
    border-radius: 50%;
    background: linear-gradient(135deg, rgba(124, 152, 133, 0.15), rgba(184, 197, 185, 0.15));
    animation: float 25s ease-in-out infinite;
}

.c1 {
    width: 500px;
    height: 500px;
    top: -150px;
    left: -150px;
}

.c2 {
    width: 400px;
    height: 400px;
    bottom: -100px;
    right: -100px;
    animation-delay: -8s;
}

.c3 {
    width: 250px;
    height: 250px;
    top: 40%;
    left: 60%;
    animation-delay: -16s;
}

@keyframes float {
    0%, 100% { transform: translate(0, 0) scale(1); }
    25% { transform: translate(40px, -40px) scale(1.08); }
    50% { transform: translate(-30px, 30px) scale(0.95); }
    75% { transform: translate(25px, 15px) scale(1.03); }
}

/* Container */
.container {
    position: relative;
    z-index: 1;
    max-width: 550px;
    margin: 0 auto;
    padding: 16px;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Header */
header {
    text-align: center;
    padding: 16px 0;
}

header h1 {
    font-size: 1.6rem;
    font-weight: 600;
    color: var(--primary-dark);
    margin-bottom: 4px;
}

.subtitle {
    color: var(--text-light);
    font-weight: 300;
    font-size: 0.9rem;
}

.header-buttons {
    display: flex;
    gap: 8px;
    margin-top: 12px;
    justify-content: center;
}

.header-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    border: 2px solid var(--secondary);
    border-radius: 20px;
    background: var(--white);
    color: var(--text-light);
    font-family: inherit;
    font-size: 0.75rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.header-btn:hover {
    border-color: var(--primary);
    color: var(--primary);
}

.header-btn.primary {
    background: var(--primary);
    border-color: var(--primary);
    color: var(--white);
}

.header-btn.primary:hover {
    background: var(--primary-dark);
}

.header-btn svg {
    width: 14px;
    height: 14px;
    fill: currentColor;
}

/* Modal */
.modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    z-index: 100;
    justify-content: center;
    align-items: center;
}

.modal-overlay.active {
    display: flex;
}

.modal {
    background: var(--white);
    border-radius: 16px;
    width: 90%;
    max-width: 500px;
    max-height: 70vh;
    overflow: hidden;
    box-shadow: 0 10px 40px rgba(0,0,0,0.2);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    border-bottom: 1px solid var(--secondary);
}

.modal-header h2 {
    font-size: 1.1rem;
    color: var(--text);
}

.modal-close {
    background: none;
    border: none;
    font-size: 24px;
    color: var(--text-light);
    cursor: pointer;
}

.modal-body {
    padding: 16px 20px;
    overflow-y: auto;
    max-height: 50vh;
}

.session-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px;
    border-radius: 10px;
    background: var(--bg);
    margin-bottom: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.session-item:hover {
    background: var(--secondary);
}

.session-item.active {
    border: 2px solid var(--primary);
}

.session-info {
    flex: 1;
}

.session-date {
    font-size: 0.85rem;
    color: var(--text);
    font-weight: 500;
}

.session-messages {
    font-size: 0.75rem;
    color: var(--text-light);
}

.session-arrow {
    color: var(--text-light);
    font-size: 18px;
}

/* Chat Container */
.chat-container {
    flex: 1;
    background: var(--white);
    border-radius: 20px;
    padding: 18px;
    box-shadow: 0 8px 32px var(--shadow);
    overflow-y: auto;
    margin-bottom: 14px;
    max-height: 45vh;
    min-height: 180px;
}

.loading-welcome {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: var(--text-light);
    gap: 14px;
}

.typing-indicator {
    display: flex;
    gap: 5px;
}

.typing-indicator span {
    width: 8px;
    height: 8px;
    background: var(--primary);
    border-radius: 50%;
    animation: typing 1.4s infinite ease-in-out;
}

.typing-indicator span:nth-child(2) { animation-delay: 0.2s; }
.typing-indicator span:nth-child(3) { animation-delay: 0.4s; }

@keyframes typing {
    0%, 60%, 100% { transform: translateY(0); opacity: 0.4; }
    30% { transform: translateY(-6px); opacity: 1; }
}

/* Messages */
.message {
    margin-bottom: 12px;
    animation: fadeIn 0.3s ease;
}

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

.message-bubble {
    padding: 11px 15px;
    border-radius: 16px;
    max-width: 85%;
    line-height: 1.45;
    font-size: 0.92rem;
}

.message.user .message-bubble {
    background: var(--primary);
    color: var(--white);
    margin-left: auto;
    border-bottom-right-radius: 4px;
}

.message.assistant .message-bubble {
    background: var(--bg);
    color: var(--text);
    border-bottom-left-radius: 4px;
}

/* Loading bubble */
.message-bubble.loading-bubble {
    min-width: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.typing-dots {
    display: flex;
    gap: 4px;
}

.typing-dots span {
    width: 8px;
    height: 8px;
    background: var(--primary);
    border-radius: 50%;
    animation: typing 1.4s infinite ease-in-out;
}

.typing-dots span:nth-child(2) { animation-delay: 0.2s; }
.typing-dots span:nth-child(3) { animation-delay: 0.4s; }

/* Texto sincronizado com áudio */
.synced-text {
    line-height: 1.8;
}

.synced-text .word {
    opacity: 0.4;
    transition: all 0.15s ease;
}

.synced-text .word.active {
    opacity: 1;
    color: var(--primary-dark);
    font-weight: 500;
}

.synced-text .word.spoken {
    opacity: 1;
}

/* Status Indicator */
.status-indicator {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 8px;
    margin-bottom: 10px;
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--primary);
    animation: pulse 2s ease-in-out infinite;
}

.status-indicator.listening .status-dot {
    background: var(--primary);
    animation: pulse 0.6s ease-in-out infinite;
    box-shadow: 0 0 12px var(--primary);
}

.status-indicator.processing .status-dot {
    background: #f39c12;
    animation: spin 1s linear infinite;
}

.status-indicator.speaking .status-dot {
    background: var(--primary-dark);
    animation: pulse 0.4s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.4); opacity: 0.6; }
}

@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

#statusText {
    color: var(--text-light);
    font-size: 0.82rem;
    max-width: 300px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Controls */
.controls {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    padding-bottom: 16px;
}

/* Conversation Button */
.conversation-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 16px 32px;
    border-radius: 50px;
    border: none;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: var(--white);
    font-family: inherit;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    box-shadow: 0 6px 24px rgba(124, 152, 133, 0.4);
    transition: all 0.3s ease;
}

.conversation-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 30px rgba(124, 152, 133, 0.5);
}

.conversation-btn.active {
    background: linear-gradient(135deg, var(--primary-dark), #4a6a53);
    animation: glow 2s ease-in-out infinite;
}

@keyframes glow {
    0%, 100% { box-shadow: 0 6px 24px rgba(124, 152, 133, 0.4); }
    50% { box-shadow: 0 6px 35px rgba(124, 152, 133, 0.7); }
}

.conversation-btn svg {
    width: 22px;
    height: 22px;
    fill: currentColor;
}

/* Stop Button */
.stop-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 24px;
    border-radius: 50px;
    border: none;
    background: var(--danger);
    color: var(--white);
    font-family: inherit;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.stop-btn:hover {
    background: #c0392b;
}

.stop-btn svg {
    width: 16px;
    height: 16px;
    fill: currentColor;
}

/* Text Input */
.text-input-container {
    display: flex;
    width: 100%;
    gap: 8px;
}

.text-input {
    flex: 1;
    padding: 12px 16px;
    border-radius: 24px;
    border: 2px solid var(--secondary);
    background: var(--white);
    font-family: inherit;
    font-size: 0.9rem;
    color: var(--text);
    outline: none;
    transition: border-color 0.2s ease;
}

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

.text-input::placeholder {
    color: var(--text-light);
}

.send-btn {
    width: 46px;
    height: 46px;
    border-radius: 50%;
    border: none;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: var(--white);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 3px 12px rgba(124, 152, 133, 0.3);
    transition: all 0.2s ease;
}

.send-btn:hover {
    transform: scale(1.05);
}

.send-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.send-btn svg {
    width: 20px;
    height: 20px;
    fill: currentColor;
}

/* Audio Controls */
.audio-controls {
    display: flex;
    align-items: center;
    gap: 10px;
}

.control-btn {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: 2px solid var(--secondary);
    background: var(--white);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.control-btn:hover {
    border-color: var(--primary);
}

.control-btn.active {
    background: var(--primary);
    border-color: var(--primary);
}

.control-btn.active svg {
    fill: var(--white);
}

.control-btn svg {
    width: 18px;
    height: 18px;
    fill: var(--text-light);
}

.voice-select {
    padding: 9px 14px;
    border-radius: 20px;
    border: 2px solid var(--secondary);
    background: var(--white);
    font-family: inherit;
    font-size: 0.85rem;
    color: var(--text);
    cursor: pointer;
    outline: none;
    transition: border-color 0.2s ease;
}

.voice-select:focus {
    border-color: var(--primary);
}

/* Responsive */
@media (max-width: 480px) {
    .container { padding: 12px; }
    header h1 { font-size: 1.4rem; }
    .chat-container { max-height: 38vh; }
    .conversation-btn { padding: 14px 26px; font-size: 0.95rem; }
}
