:root {
    --primary: #3b82f6;
    --primary-hover: #2563eb;
    --primary-light: #dbeafe;
    --secondary: #10b981;
    --secondary-hover: #059669;
    --danger: #ef4444;
    --danger-hover: #dc2626;
    --bg: #f8fafc;
    --surface: #ffffff;
    --surface-hover: #f1f5f9;
    --border: #e2e8f0;
    --text: #1e293b;
    --text-secondary: #64748b;
    --text-muted: #94a3b8;
    --shadow-sm: 0 1px 2px rgba(0,0,0,0.05);
    --shadow: 0 4px 6px -1px rgba(0,0,0,0.07), 0 2px 4px -2px rgba(0,0,0,0.05);
    --shadow-lg: 0 10px 25px -3px rgba(0,0,0,0.08), 0 4px 6px -4px rgba(0,0,0,0.04);
    --radius: 12px;
    --radius-lg: 16px;
}

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

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background-color: var(--bg);
    color: var(--text);
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

header {
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    padding: 1rem 0;
    text-align: center;
}

.logo-container {
    display: flex;
    align-items: center;
    justify-content: center;
}

.logo {
    max-width: 160px;
    height: auto;
}

.tagline {
    color: var(--text-muted);
    font-size: 0.8rem;
    font-weight: 400;
    letter-spacing: 0.05em;
    margin-top: 0.25rem;
}

main {
    flex: 1;
    padding: 1.5rem 0 3rem;
}

.container {
    max-width: 720px;
    margin: 0 auto;
    padding: 0 1rem;
}

section {
    background: var(--surface);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    margin-bottom: 1.5rem;
    overflow: hidden;
}

.section-title {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 1rem 1.5rem 0.5rem;
}

.chat-section {
    display: flex;
    flex-direction: column;
}

#chat-container {
    display: flex;
    flex-direction: column;
    height: 480px;
}

#chat-messages {
    flex: 1;
    padding: 1.25rem;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    scroll-behavior: smooth;
}

#chat-messages::-webkit-scrollbar {
    width: 4px;
}

#chat-messages::-webkit-scrollbar-track {
    background: transparent;
}

#chat-messages::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 4px;
}

.typing-indicator {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 0 1.25rem 0.5rem;
}

.typing-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background-color: var(--text-muted);
    animation: typing-bounce 1.4s ease-in-out infinite;
}

.typing-dot:nth-child(2) {
    animation-delay: 0.2s;
}

.typing-dot:nth-child(3) {
    animation-delay: 0.4s;
}

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

#user-input-container {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1rem;
    border-top: 1px solid var(--border);
    background: var(--surface);
}

#user-input {
    flex: 1;
    padding: 0.65rem 1rem;
    border: 1px solid var(--border);
    border-radius: 24px;
    font-family: inherit;
    font-size: 0.9rem;
    color: var(--text);
    background: var(--bg);
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s;
}

#user-input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

#user-input::placeholder {
    color: var(--text-muted);
}

#send-button {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border: none;
    border-radius: 50%;
    background: var(--primary);
    color: white;
    cursor: pointer;
    transition: background-color 0.2s, transform 0.1s;
    flex-shrink: 0;
}

#send-button:hover {
    background: var(--primary-hover);
}

#send-button:active {
    transform: scale(0.95);
}

#send-button:disabled {
    background: var(--text-muted);
    cursor: not-allowed;
}

.message {
    max-width: 80%;
    padding: 0.6rem 1rem;
    border-radius: 18px;
    font-size: 0.9rem;
    line-height: 1.5;
    word-wrap: break-word;
    animation: message-in 0.25s ease-out;
    white-space: pre-wrap;
}

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

.user-message {
    align-self: flex-end;
    background: var(--primary);
    color: white;
    border-bottom-right-radius: 6px;
}

.bot-message {
    align-self: flex-start;
    background: var(--surface-hover);
    color: var(--text);
    border-bottom-left-radius: 6px;
    border: 1px solid var(--border);
}

.system-message {
    align-self: center;
    background: var(--primary-light);
    color: var(--primary-hover);
    border-radius: var(--radius);
    font-size: 0.82rem;
    font-weight: 500;
    text-align: center;
    max-width: 90%;
    padding: 0.5rem 1rem;
}

.call-info-section {
    padding: 1.25rem 1.5rem;
}

.call-status-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.call-status-header h3 {
    font-size: 1rem;
    font-weight: 600;
    color: var(--secondary);
}

.call-pulse {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--secondary);
    animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% {
        box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.4);
    }
    50% {
        box-shadow: 0 0 0 8px rgba(16, 185, 129, 0);
    }
}

#call-info {
    font-size: 0.82rem;
    color: var(--text-secondary);
    margin-bottom: 0.75rem;
}

.live-transcript {
    max-height: 200px;
    overflow-y: auto;
    padding: 0.75rem;
    background: var(--bg);
    border-radius: var(--radius);
    font-size: 0.82rem;
    line-height: 1.6;
    margin-bottom: 1rem;
    border: 1px solid var(--border);
}

.live-transcript p {
    margin-bottom: 0.35rem;
}

.live-transcript strong {
    color: var(--primary);
}

.history-section {
    padding: 1.25rem 1.5rem;
}

.input-row {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.form-control {
    flex: 1;
    padding: 0.55rem 0.85rem;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-family: inherit;
    font-size: 0.85rem;
    color: var(--text);
    outline: none;
    transition: border-color 0.2s;
}

.form-control:focus {
    border-color: var(--primary);
}

.form-control::placeholder {
    color: var(--text-muted);
}

.btn {
    padding: 0.55rem 1rem;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-family: inherit;
    font-size: 0.82rem;
    font-weight: 500;
    transition: background-color 0.2s, transform 0.1s;
    white-space: nowrap;
}

.btn:active {
    transform: scale(0.97);
}

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

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

.btn-secondary {
    background: var(--surface-hover);
    color: var(--text);
    border: 1px solid var(--border);
}

.btn-secondary:hover {
    background: var(--border);
}

.btn-danger {
    background: var(--danger);
    color: white;
    width: 100%;
    padding: 0.65rem;
}

.btn-danger:hover {
    background: var(--danger-hover);
}

.result-box {
    margin-top: 1rem;
    padding: 1rem;
    background: var(--bg);
    border-radius: var(--radius);
    border: 1px solid var(--border);
    font-size: 0.85rem;
    line-height: 1.6;
}

.result-box h4 {
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin-bottom: 0.75rem;
}

.result-box p {
    margin-bottom: 0.35rem;
}

.result-box strong {
    color: var(--primary);
}

footer {
    text-align: center;
    padding: 1rem;
    color: var(--text-muted);
    font-size: 0.75rem;
    border-top: 1px solid var(--border);
    background: var(--surface);
}

@media (max-width: 640px) {
    .container {
        padding: 0 0.5rem;
    }

    #chat-container {
        height: 400px;
    }

    .message {
        max-width: 88%;
    }

    .input-row {
        flex-direction: column;
    }

    .input-row .form-control,
    .input-row .btn {
        width: 100%;
    }

    .history-section {
        padding: 1rem;
    }
}
