/* Base Styles */
body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    line-height: 1.5;
    margin: 0;
    padding: 0;
    background: #f0f2f5;
}

.app-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem;
}

/* Welcome Section */
.welcome-section {
    text-align: center;
    padding: 4rem 2rem;
}

.welcome-section h1 {
    font-size: 2.5rem;
    margin-bottom: 1rem;
}

.primary-btn {
    background: #4299e1;
    color: white;
    border: none;
    padding: 1rem 2rem;
    border-radius: 8px;
    font-size: 1.1rem;
    cursor: pointer;
    transition: background 0.3s ease;
}

.primary-btn:hover {
    background: #3182ce;
}

/* Survey Section */
.survey-section {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    height: calc(100vh - 4rem);
}

/* Survey Layout */
.survey-layout {
    display: flex;
    gap: 2rem;
    height: 100%;
}

/* Survey Data Panel */
.survey-data-panel {
    width: 300px;
    background: white;
    border-radius: 12px;
    padding: 1.5rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    height: fit-content;
}

.survey-data-panel h3 {
    margin: 0 0 1rem 0;
    color: #2d3748;
    font-size: 1.2rem;
}

.survey-data-content {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.data-item {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    padding: 0.75rem;
    border-radius: 8px;
    background: #f8fafc;
}

.data-item-label {
    color: #64748b;
    font-size: 0.9rem;
    font-weight: 500;
}

.data-item-value {
    color: #1a202c;
    font-size: 1rem;
    min-height: 1.5rem;
}

.data-item-value.empty {
    color: #a0aec0;
    font-style: italic;
}

.data-item-value.updated {
    animation: highlight 1.5s ease-out;
}

@keyframes highlight {
    0% { background-color: #ebf8ff; }
    100% { background-color: transparent; }
}

/* Chat Interface */
.chat-interface {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    min-width: 0;
}

/* Chat styles */
.chat-container {
    flex: 1;
    background: white;
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 20px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    display: flex;
    flex-direction: column;
    position: relative; /* Enable absolute positioning for speech indicator */
}

.chat-messages {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.message {
    padding: 1rem;
    border-radius: 12px;
    max-width: 80%;
}

.message.user {
    background: #e9ecef;
    color: #2d3748;
    align-self: flex-end;
}

.message.sam {
    background: #4299e1;
    color: white;
    align-self: flex-start;
}

/* Buffering message style - shows text being accumulated */
.message.user.buffering {
    opacity: 0.7;
    font-style: italic;
    background: #f1f5f9;
    border: 2px dashed #cbd5e0;
    color: #64748b;
    position: relative;
}

.message.user.buffering::after {
    content: ' ●●●';
    animation: ellipsis 1.5s infinite;
    color: #4299e1;
}

@keyframes ellipsis {
    0%, 20% { content: ' ●'; }
    40% { content: ' ●●'; }
    60%, 100% { content: ' ●●●'; }
}

/* Input Controls */
.input-controls {
    padding: 1rem;
    background: white;
    border-radius: 12px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.input-mode-controls {
    display: flex;
    justify-content: center;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.mode-btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    border: 2px solid #4a5568;
    background: transparent;
    color: #a0aec0;
    border-radius: 25px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: 600;
}

.mode-btn.active {
    border-color: #4299e1;
    background: #4299e1;
    color: white;
}

.mode-btn:hover:not(.active) {
    border-color: #4299e1;
    color: #4299e1;
}

.input-area {
    display: flex;
    gap: 1rem;
    align-items: center;
}

.text-input-container {
    display: flex;
    gap: 0.5rem;
    flex: 1;
}

.text-input-container input {
    flex: 1;
    padding: 0.75rem 1rem;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    font-size: 1rem;
    transition: border-color 0.3s ease;
}

.text-input-container input:focus {
    outline: none;
    border-color: #4299e1;
}

.text-input-container button {
    padding: 0.75rem 1.5rem;
    background: #4299e1;
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.3s ease;
}

.text-input-container button:hover {
    background: #3182ce;
}

.voice-status {
    padding: 0.75rem 1rem;
    color: #4a5568;
    font-weight: 500;
}

/* Utility Classes */
.hidden {
    display: none !important;
}

/* Completion Section */
.completion-section {
    text-align: center;
    padding: 4rem 2rem;
}

.completion-section h2 {
    font-size: 2rem;
    margin-bottom: 1rem;
    color: #2d3748;
}

.completion-actions {
    display: flex;
    gap: 1rem;
    justify-content: center;
    margin-top: 2rem;
}

.export-csv-btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 1rem 2rem;
    background: #38a169;
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 1.1rem;
    cursor: pointer;
    transition: background 0.3s ease;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.export-csv-btn:hover {
    background: #2f855a;
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

.restart-btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 1rem 2rem;
    background: #4299e1;
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 1.1rem;
    cursor: pointer;
    transition: background 0.3s ease;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.restart-btn:hover {
    background: #3182ce;
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

/* Responsive Design */
@media (max-width: 1024px) {
    .survey-layout {
        flex-direction: column;
    }

    .survey-data-panel {
        width: auto;
    }
}

@media (max-width: 768px) {
    .app-container {
        padding: 1rem;
    }

    .message {
        max-width: 90%;
    }
    
    .completion-actions {
        flex-direction: column;
        align-items: center;
    }
    
    .export-csv-btn,
    .restart-btn {
        width: 100%;
        max-width: 300px;
    }
}

/* Settings Panel Styles */
.settings-btn {
    position: fixed;
    top: 20px;
    right: 20px;
    background: #4299e1;
    color: white;
    border: none;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    font-size: 1.5rem;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    z-index: 1000;
    transition: all 0.3s ease;
}

.settings-btn:hover {
    background: #3182ce;
    transform: scale(1.1);
}

.settings-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1001;
    display: none;
}

.settings-overlay.active {
    display: block;
}

.settings-panel {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0.8);
    background: white;
    border-radius: 12px;
    width: 500px;
    max-width: 90vw;
    max-height: 90vh;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    z-index: 1002;
    opacity: 0;
    pointer-events: none;
    transition: all 0.3s ease;
}

.settings-panel.open {
    opacity: 1;
    pointer-events: auto;
    transform: translate(-50%, -50%) scale(1);
}

.settings-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem 2rem;
    border-bottom: 1px solid #e2e8f0;
}

.settings-header h3 {
    margin: 0;
    color: #2d3748;
    font-size: 1.3rem;
}

.close-btn {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: #a0aec0;
    padding: 0.5rem;
    border-radius: 50%;
    transition: all 0.3s ease;
}

.close-btn:hover {
    background: #f7fafc;
    color: #2d3748;
}

.settings-content {
    padding: 2rem;
    max-height: 60vh;
    overflow-y: auto;
}

.settings-section {
    margin-bottom: 2rem;
}

.settings-section:last-child {
    margin-bottom: 0;
}

.settings-section h4 {
    margin: 0 0 1rem 0;
    color: #2d3748;
    font-size: 1.1rem;
    font-weight: 600;
}

/* API Status */
.api-status {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.api-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem;
    background: #f8fafc;
    border-radius: 8px;
}

.api-label {
    font-weight: 500;
    color: #4a5568;
    min-width: 100px;
}

.status-indicator {
    font-size: 1.2rem;
}

.status-text {
    color: #64748b;
    font-size: 0.9rem;
    flex: 1;
}

.status-text.status-green {
    color: #22c55e;
}

.status-text.status-red {
    color: #ef4444;
}

.test-btn {
    background: #4299e1;
    color: white;
    border: none;
    padding: 0.75rem 1.5rem;
    border-radius: 8px;
    font-size: 0.9rem;
    cursor: pointer;
    transition: background 0.3s ease;
    width: 100%;
}

.test-btn:hover {
    background: #3182ce;
}

.test-btn:disabled {
    background: #a0aec0;
    cursor: not-allowed;
}

/* Parameter Controls */
.parameter-group {
    margin-bottom: 1.5rem;
}

.parameter-group label {
    display: block;
    margin-bottom: 0.5rem;
    color: #4a5568;
    font-weight: 500;
}

.parameter-slider {
    width: 100%;
    height: 8px;
    background: #e2e8f0;
    border-radius: 4px;
    outline: none;
    transition: background 0.3s ease;
}

.parameter-slider::-webkit-slider-thumb {
    appearance: none;
    width: 20px;
    height: 20px;
    background: #4299e1;
    border-radius: 50%;
    cursor: pointer;
    transition: background 0.3s ease;
}

.parameter-slider::-webkit-slider-thumb:hover {
    background: #3182ce;
}

.parameter-slider::-moz-range-thumb {
    width: 20px;
    height: 20px;
    background: #4299e1;
    border-radius: 50%;
    cursor: pointer;
    border: none;
    transition: background 0.3s ease;
}

.parameter-select {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    background: white;
    color: #4a5568;
    font-size: 0.9rem;
    transition: border-color 0.3s ease;
}

.parameter-select:focus {
    outline: none;
    border-color: #4299e1;
}

/* Demo Controls */
.demo-controls {
    display: flex;
    gap: 1rem;
}

.control-btn {
    flex: 1;
    padding: 0.75rem 1rem;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    background: white;
    color: #4a5568;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.3s ease;
}

.control-btn:hover {
    background: #f8fafc;
    border-color: #cbd5e0;
}

.reset-btn:hover {
    background: #fef2f2;
    border-color: #fecaca;
    color: #dc2626;
}

.export-btn:hover {
    background: #f0f9ff;
    border-color: #bfdbfe;
    color: #1d4ed8;
}

/* Settings Panel Responsiveness */
@media (max-width: 600px) {
    .settings-panel {
        width: 95vw;
        max-height: 95vh;
    }
    
    .settings-header {
        padding: 1rem 1.5rem;
    }
    
    .settings-content {
        padding: 1.5rem;
    }
    
    .demo-controls {
        flex-direction: column;
    }
    
    .settings-btn {
        width: 45px;
        height: 45px;
        font-size: 1.3rem;
    }
} 

/* Data Panel styles */
.data-panel {
    background: white;
    border-radius: 8px;
    padding: 20px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    margin-top: 20px;
}

.data-panel h3 {
    margin: 0 0 15px 0;
    color: #333;
    font-size: 18px;
}

.data-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 0;
    border-bottom: 1px solid #eee;
}

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

.data-item-label {
    font-weight: 500;
    color: #555;
}

.data-item-value {
    color: #333;
    font-family: monospace;
    background: #f8f9fa;
    padding: 4px 8px;
    border-radius: 4px;
    min-width: 100px;
    text-align: right;
}

.data-item-value.empty {
    color: #999;
    font-style: italic;
}

.data-item-value.updated {
    background: #d4edda;
    color: #155724;
    animation: highlight 1.5s ease-out;
}

@keyframes highlight {
    0% { background: #28a745; color: white; }
    100% { background: #d4edda; color: #155724; }
}

/* Speech Status Indicator */
.speech-indicator {
    position: absolute;
    bottom: 15px;
    right: 15px;
    display: flex;
    align-items: center;
    gap: 8px;
    background: rgba(255, 255, 255, 0.95);
    padding: 8px 12px;
    border-radius: 20px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    font-size: 12px;
    font-weight: 500;
    color: #555;
    z-index: 10;
    transition: all 0.3s ease;
}

.indicator-light {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #28a745;
    transition: background-color 0.3s ease;
    box-shadow: 0 0 4px rgba(40, 167, 69, 0.5);
}

/* Red state: Sam speaking OR grace period - user should NOT speak */
.speech-indicator.speaking .indicator-light,
.speech-indicator.grace-period .indicator-light {
    background: #dc3545;
    box-shadow: 0 0 4px rgba(220, 53, 69, 0.5);
}

.speech-indicator.speaking .indicator-text::after,
.speech-indicator.grace-period .indicator-text::after {
    content: "Busy";
}

/* Green state: Ready for user input */
.speech-indicator.listening .indicator-text::after {
    content: "Ready";
}

/* Hide default text, use ::after for state-specific text */
.indicator-text {
    font-size: 0;
}

.indicator-text::after {
    font-size: 12px;
} 