/* Vietnamese Restaurant Voice Agent - Styles */

:root {
    --primary-color: #2563eb;
    --primary-hover: #1d4ed8;
    --secondary-color: #64748b;
    --danger-color: #dc2626;
    --danger-hover: #b91c1c;
    --success-color: #16a34a;
    --warning-color: #ca8a04;
    --background: #f8fafc;
    --card-bg: #ffffff;
    --text-primary: #1e293b;
    --text-secondary: #64748b;
    --border-color: #e2e8f0;
    --radius: 8px;
    --shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    background-color: var(--background);
    color: var(--text-primary);
    line-height: 1.6;
}

.container {
    max-width: 900px;
    margin: 0 auto;
    padding: 20px;
}

/* Header */
header {
    text-align: center;
    margin-bottom: 30px;
    padding: 20px;
}

header h1 {
    font-size: 2rem;
    color: var(--primary-color);
    margin-bottom: 5px;
}

.subtitle {
    color: var(--text-secondary);
    font-size: 1rem;
}

/* Cards */
.card {
    background: var(--card-bg);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 20px;
    margin-bottom: 20px;
    border: 1px solid var(--border-color);
}

.card h2 {
    font-size: 1.25rem;
    margin-bottom: 15px;
    color: var(--text-primary);
    border-bottom: 2px solid var(--primary-color);
    padding-bottom: 10px;
}

/* Configuration Grid */
.config-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
    align-items: end;
}

.config-item {
    display: flex;
    flex-direction: column;
}

.config-item label {
    font-size: 0.875rem;
    font-weight: 500;
    margin-bottom: 5px;
    color: var(--text-secondary);
}

/* Form Elements */
.form-group {
    margin-bottom: 15px;
}

.form-group label {
    display: block;
    font-size: 0.875rem;
    font-weight: 500;
    margin-bottom: 5px;
    color: var(--text-secondary);
}

input[type="text"],
select,
textarea {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    font-size: 1rem;
    transition: border-color 0.2s, box-shadow 0.2s;
}

input[type="text"]:focus,
select:focus,
textarea:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

textarea {
    resize: vertical;
    min-height: 80px;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 20px;
    border: none;
    border-radius: var(--radius);
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: background-color 0.2s, transform 0.1s;
}

.btn:hover {
    transform: translateY(-1px);
}

.btn:active {
    transform: translateY(0);
}

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

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

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

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

.btn-secondary:hover:not(:disabled) {
    background-color: #475569;
}

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

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

/* Call Controls */
.call-controls {
    display: flex;
    gap: 10px;
    margin: 20px 0;
}

.icon {
    font-size: 1.1rem;
}

/* Status Indicator */
.status-indicator {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 15px;
    background: var(--background);
    border-radius: var(--radius);
}

.status-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background-color: var(--secondary-color);
}

.status-dot.ready {
    background-color: var(--success-color);
}

.status-dot.connecting {
    background-color: var(--warning-color);
    animation: pulse 1s infinite;
}

.status-dot.active {
    background-color: var(--success-color);
    animation: pulse 1s infinite;
}

.status-dot.error {
    background-color: var(--danger-color);
}

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

.status-text {
    font-size: 0.875rem;
    color: var(--text-secondary);
}

/* Transcript */
.transcript {
    background: var(--background);
    border-radius: var(--radius);
    padding: 15px;
    min-height: 200px;
    max-height: 400px;
    overflow-y: auto;
}

.transcript-placeholder {
    color: var(--text-secondary);
    font-style: italic;
    text-align: center;
    padding: 40px;
}

.transcript-entry {
    margin-bottom: 12px;
    padding: 10px;
    border-radius: var(--radius);
}

.transcript-entry.agent {
    background: #dbeafe;
    margin-right: 20%;
}

.transcript-entry.user {
    background: #dcfce7;
    margin-left: 20%;
}

.transcript-entry .speaker {
    font-weight: 600;
    font-size: 0.75rem;
    text-transform: uppercase;
    margin-bottom: 4px;
    color: var(--text-secondary);
}

.transcript-entry .message {
    font-size: 0.95rem;
}

/* Call History */
#call-history {
    max-height: 300px;
    overflow-y: auto;
}

.history-placeholder {
    color: var(--text-secondary);
    font-style: italic;
    text-align: center;
    padding: 20px;
}

.history-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px;
    border-bottom: 1px solid var(--border-color);
}

.history-item:last-child {
    border-bottom: none;
}

.history-info {
    flex: 1;
}

.history-restaurant {
    font-weight: 600;
    margin-bottom: 4px;
}

.history-meta {
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.history-outcome {
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 500;
    text-transform: uppercase;
}

.history-outcome.callback_scheduled,
.history-outcome.interested {
    background: #dcfce7;
    color: #166534;
}

.history-outcome.needs_followup {
    background: #fef9c3;
    color: #854d0e;
}

.history-outcome.not_interested,
.history-outcome.wrong_number {
    background: #fee2e2;
    color: #991b1b;
}

/* Footer */
footer {
    text-align: center;
    padding: 20px;
    color: var(--text-secondary);
    font-size: 0.875rem;
}

/* Responsive */
@media (max-width: 600px) {
    .container {
        padding: 10px;
    }

    header h1 {
        font-size: 1.5rem;
    }

    .config-grid {
        grid-template-columns: 1fr;
    }

    .call-controls {
        flex-direction: column;
    }

    .btn {
        width: 100%;
    }

    .transcript-entry.agent,
    .transcript-entry.user {
        margin-left: 0;
        margin-right: 0;
    }
}

/* Loading States */
.loading {
    position: relative;
    pointer-events: none;
}

.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    margin: -10px 0 0 -10px;
    border: 2px solid transparent;
    border-top-color: currentColor;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

/* Toast Notifications */
.toast {
    position: fixed;
    bottom: 20px;
    right: 20px;
    padding: 12px 20px;
    background: var(--text-primary);
    color: white;
    border-radius: var(--radius);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    animation: slideIn 0.3s ease;
    z-index: 1000;
}

.toast.success {
    background: var(--success-color);
}

.toast.error {
    background: var(--danger-color);
}

@keyframes slideIn {
    from {
        transform: translateY(100%);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

/* Prompt Editor */
#prompt-section h2 {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.btn-small {
    padding: 5px 12px;
    font-size: 0.8rem;
}

#agent-prompt {
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
    font-size: 0.85rem;
    line-height: 1.5;
    min-height: 300px;
}

#first-message {
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
    font-size: 0.85rem;
}

.help-text {
    display: block;
    margin-top: 5px;
    font-size: 0.75rem;
    color: var(--text-secondary);
}

.button-group {
    display: flex;
    gap: 10px;
    margin-top: 15px;
}

#prompt-editor {
    margin-top: 15px;
}

/* Login Page */
.login-container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    background: linear-gradient(135deg, var(--primary-color) 0%, #1e40af 100%);
}

.login-card {
    background: var(--card-bg);
    padding: 40px;
    border-radius: var(--radius);
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    width: 100%;
    max-width: 400px;
    text-align: center;
}

.login-card h1 {
    color: var(--primary-color);
    margin-bottom: 5px;
}

.login-card .subtitle {
    margin-bottom: 30px;
}

.login-card .form-group {
    text-align: left;
}

.btn-full {
    width: 100%;
    margin-top: 10px;
}

.error-text {
    color: var(--danger-color);
    font-size: 0.875rem;
    margin-top: 10px;
}

/* Header with logout button */
header {
    position: relative;
}

#logout-btn {
    position: absolute;
    right: 0;
    top: 50%;
    transform: translateY(-50%);
}

/* Call Sections */
.call-section {
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid var(--border-color);
}

.call-section h3 {
    font-size: 1rem;
    color: var(--text-secondary);
    margin-bottom: 15px;
}

.call-section:first-of-type {
    margin-top: 15px;
    padding-top: 0;
    border-top: none;
}

#phone-number {
    font-size: 1.1rem;
    letter-spacing: 1px;
}
