/* Base styles */
:root {
    --primary-color: #4a6fa5;
    --primary-light: rgba(74, 111, 165, 0.1);
    --secondary-color: #e9f0f9;
    --text-color: #333;
    --text-light: #677788;
    --light-grey: #f5f7fa;
    --border-color: #dbe4ee;
    --success-color: #28a745;
    --danger-color: #dc3545;
    --shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
    --radius: 12px;
    --transition: all 0.3s ease;
}

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

body {
    font-family: 'Inter', sans-serif;
    font-size: 0.85rem;
    line-height: 1.5;
    color: var(--text-color);
    background-color: #f8f9fa;
    padding: 12px;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.container {
    width: 100%;
    max-width: 900px;
    margin: 0 auto;
    background-color: white;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    height: 95vh;
    position: relative;
}

/* Header styles */
header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 15px;
    border-bottom: 1px solid var(--border-color);
    background-color: var(--primary-color);
    color: white;
}

.app-title {
    font-size: 0.95rem;
    font-weight: 600;
    color: white;
    margin: 0;
}

.mode-toggle {
    display: none;
}

main {
    flex: 1;
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    overflow-y: auto;
}

.voice-settings-container {
    background-color: var(--light-grey);
    border-radius: var(--radius);
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

/* Voice settings header */
.voice-settings-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    padding: 10px 14px;
}

.voice-settings-header h3 {
    font-size: 0.85rem;
    font-weight: 600;
    margin-bottom: 5px;
    color: var(--text-color);
}

.voice-settings-collapsed .voice-settings {
    max-height: 0;
    padding-top: 0;
    padding-bottom: 0;
}  

/* Voice settings styles */
.voice-settings {
    background-color: var(--light-grey);
    border-radius: var(--radius);
    padding: 8px 12px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
    overflow: hidden;
}

.voice-settings-collapsed .toggle-icon i {
    transform: rotate(-90deg);
}
  
.toggle-icon i {
    transition: transform 0.3s ease;
}

.settings-row {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}

.mt-3 {
    margin-top: 10px;
}

.setting-group {
    flex: 1;
    min-width: 210px;
}

.setting-group label {
    display: block;
    font-size: 0.75rem;
    font-weight: 600;
    margin-bottom: 4px;
    color: var(--text-light);
}

.form-select {
    width: 100%;
    padding: 8px 12px;
    padding-right: 28px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    font-size: 0.8rem;
    background-color: white;
    transition: border-color 0.2s;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 16 16'%3E%3Cpath fill='none' stroke='%23343a40' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M2 5l6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
    background-size: 14px 10px;
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
}

.form-select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px rgba(74, 111, 165, 0.2);
}

input[type="range"] {
    width: 100%;
    margin-top: 8px;
    height: 6px;
    border-radius: 5px;
    -webkit-appearance: none;
    background: #d7e3f2;
}

input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: var(--primary-color);
    cursor: pointer;
    box-shadow: 0 0 2px rgba(0, 0, 0, 0.2);
}

input[type="range"]:focus {
    outline: none;
}

/* Chat container styles */
.chat-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: 0 2px 4px rgba(0,0,0,0.03);
}

.chat-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 14px;
    background-color: var(--light-grey);
    border-bottom: 1px solid var(--border-color);
}

.chat-header h3 {
    font-size: 0.85rem;
    font-weight: 600;
    margin: 0;
}

.clear-btn {
    border: none;
    background-color: transparent;
    color: var(--text-light);
    font-size: 0.75rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 5px;
    transition: color 0.2s;
}

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

.chat-messages {
    flex: 1;
    padding: 14px;
    overflow-y: auto;
    background-color: #f9f9f9;
}

/* Message styles */
.system-message {
    background-color: #e9ecef;
    border-radius: 1rem;
    padding: 10px 14px;
    margin-bottom: 14px;
    max-width: 85%;
    margin-left: auto;
    margin-right: auto;
    text-align: center;
}

.system-message p {
    margin: 0;
    font-size: 0.78rem;
    color: var(--text-light);
}

.user-message,
.assistant-message {
    display: flex;
    margin-bottom: 14px;
}

.user-message {
    justify-content: flex-end;
}

.assistant-message {
    justify-content: flex-start;
}

.message-bubble {
    border-radius: 1rem;
    padding: 10px 14px;
    max-width: 80%;
    box-shadow: 0 1px 2px rgba(0,0,0,0.1);
}

.user-message .message-bubble {
    background-color: var(--primary-color);
    color: white;
    border-top-right-radius: 0;
}

.assistant-message .message-bubble {
    background-color: var(--secondary-color);
    color: var(--text-color);
    border-top-left-radius: 0;
}

.message-bubble p {
    margin: 0 0 2px 0;
    font-size: 0.78rem;
}

.message-bubble .audio-controls {
    margin-top: 8px;
}

.message-bubble audio {
    max-width: 100%;
    height: 20px;
}

.message-time {
    font-size: 0.7rem;
    opacity: 0.7;
    text-align: right;
    margin-top: 4px;
}

.audio-message-indicator {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 0.75rem;
    margin-bottom: 5px;
}

/* Chat input area */
.chat-input-area {
    padding: 12px;
    background-color: white;
    border-top: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.input-container {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
}

#chatTextInput {
    flex: 0.78;
    padding: 6px 10px;
    border: 1px solid var(--border-color);
    border-radius: 28px;
    resize: none;
    height: 38px;
    font-size: 0.8rem;
    font-family: inherit;
    display: block;
    transition: border-color 0.2s;
}

#chatTextInput:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px rgba(74, 111, 165, 0.1);
}

.button-group {
    display: flex;
    gap: 8px;
    align-items: center;
}

#sendTextBtn, #recordAudioBtn, #videoCallBtn, #cameraToggleBtn {
    width: 36px;
    height: 36px;
    border-radius: 55%;
    border: none;
    background-color: var(--primary-color);
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: var(--transition);
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

#sendTextBtn:hover, #recordAudioBtn:hover, #videoCallBtn:hover, #cameraToggleBtn:hover {
    background-color: #3a5b8c;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.15);
}

.record-btn {
    position: relative;
}

.bi-mic, .bi-send, .bi-camera-video, .bi-arrow-repeat {
    font-size: 1rem;
}

/* Recording status and animation */
.recording-status {
    display: none;
    align-items: center;
    gap: 10px;
    margin-top: 10px;
    color: var(--danger-color);
    font-weight: 500;
}

.recording {
    animation: pulse 1.5s infinite;
    background-color: var(--danger-color) !important;
}

@keyframes pulse {
    0% { box-shadow: 0 0 0 0 rgba(220, 53, 69, 0.5); }
    70% { box-shadow: 0 0 0 8px rgba(220, 53, 69, 0); }
    100% { box-shadow: 0 0 0 0 rgba(220, 53, 69, 0); }
}

.badge {
    background-color: var(--danger-color);
    color: white;
    padding: 5px 10px;
    border-radius: 15px;
    font-size: 0.75rem;
    display: inline-flex;
    align-items: center;
    gap: 5px;
}

.stop-btn {
    padding: 5px 10px;
    border-radius: 15px;
    border: 1px solid var(--danger-color);
    background-color: white;
    color: var(--danger-color);
    font-size: 0.75rem;
    cursor: pointer;
    transition: var(--transition);
}

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

/* Status message */
.status-message {
    display: none;
    background-color: #e9ecef;
    color: var(--text-color);
    padding: 8px 12px;
    border-radius: 8px;
    margin: 10px 0;
    font-size: 0.8rem;
    text-align: center;
    font-weight: 600;
    width: calc(100% - 142px);
    margin-right: auto;
}

/* Modal styles */
.custom-modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.4);
}

.modal-content {
    background-color: white;
    margin: 15% auto;
    padding: 20px;
    border-radius: var(--radius);
    width: 90%;
    max-width: 480px;
    box-shadow: var(--shadow);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--border-color);
}

.modal-header h5 {
    font-size: 1rem;
    font-weight: 600;
    margin: 0;
}

.close-modal {
    font-size: 1.4rem;
    font-weight: 600;
    color: var(--text-light);
    cursor: pointer;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 18px;
    padding-top: 15px;
    border-top: 1px solid var(--border-color);
}

.cancel-btn, .confirm-btn {
    padding: 8px 14px;
    border-radius: 4px;
    font-size: 0.85rem;
    cursor: pointer;
    transition: var(--transition);
}

.cancel-btn {
    background-color: var(--light-grey);
    border: 1px solid var(--border-color);
    color: var(--text-color);
}

.confirm-btn {
    background-color: var(--danger-color);
    border: 1px solid var(--danger-color);
    color: white;
}

.cancel-btn:hover {
    background-color: #e9ecef;
}

.confirm-btn:hover {
    background-color: #c82333;
}

/* Slider styling */
.slider {
    -webkit-appearance: none;
    appearance: none;
    height: 6px;
    border-radius: 4px;
    background: #d1d9e6;
    outline: none;
    transition: opacity 0.2s;
}

.slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: var(--primary-color);
    cursor: pointer;
    transition: all 0.2s;
}

.slider::-webkit-slider-thumb:hover {
    transform: scale(1.1);
    box-shadow: 0 0 0 3px rgba(74, 111, 165, 0.2);
}

.slider::-moz-range-thumb {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: var(--primary-color);
    cursor: pointer;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    body {
        padding: 8px;
    }
    
    .container {
        height: 98vh;
    }
    
    .settings-row {
        flex-direction: column;
        gap: 10px;
    }
    
    .setting-group {
        min-width: 100%;
    }
    
    .message-bubble {
        max-width: 85%;
    }

    #sendTextBtn, #recordAudioBtn, #videoCallBtn, #cameraToggleBtn {
        width: 36px;
        height: 36px;
    }

    .bi-mic, .bi-send, .bi-camera-video, .bi-arrow-repeat {
        font-size: 1rem;
    }

    #chatTextInput {
        height: 30px;
        padding: 5px 10px;
        font-size: 0.75rem;
    }
}

/* Add these styles to your CSS file */
.chat-controls {
    display: flex;
    align-items: center;
    gap: 10px;
}

.start-btn {
    border: none;
    background-color: var(--success-color);
    color: white;
    font-size: 0.75rem;
    padding: 5px 12px;
    border-radius: 18px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 5px;
    transition: background-color 0.2s;
}

.start-btn:hover {
    background-color: #218838;
}

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

.start-btn.stop:hover {
    background-color: #c82333;
}

.disabled {
    opacity: 0.5;
    cursor: not-allowed !important;
    pointer-events: none;
}

/* Status message styling */
.status-message.error {
    background-color: #f8d7da;
    color: #721c24;
    font-weight: 600;
}

.status-message.success {
    background-color: #d4edda;
    color: #155724;
    font-weight: 600;
}

.chat-controls {
    display: flex;
    align-items: center;
    gap: 10px;
}

.gemini-status-indicator {
    display: flex;
    align-items: center;
    background-color: var(--light-grey);
    border-radius: 15px;
    padding: 4px 10px;
    margin: 0;
    border: 1px solid var(--border-color);
}

.status-icon {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background-color: #aaa;
    margin-right: 6px;
}

.status-text {
    font-size: 0.7rem;
    font-weight: 500;
    color: var(--text-light);
}

/* Make sure the chat header has enough space */
.chat-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 14px;
    background-color: var(--light-grey);
    border-bottom: 1px solid var(--border-color);
}

.status-icon.gemini_speech {
    background-color: #28a745;
    animation: pulse 1.5s infinite;
}

.status-icon.user_speech {
    background-color: #007bff;
    animation: pulse 1.5s infinite;
}

.status-icon.interrupted {
    background-color: #8B0000;
    animation: pulse 1.5s infinite;
}

.status-icon.processing {
    background-color: #ffc107;
    animation: pulse 1.5s infinite;
}

.status-icon.inactive {
    background-color: #aaa;
}

/* Response modalities */
.checkbox-dropdown {
    position: relative;
    width: 150px;
    background-color: white;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    padding: 8px 12px;
    font-size: 0.8rem;
    cursor: pointer;
}

.modality-options {
    display: flex;
    flex-direction: row;
    gap: 10px;
}

.modality-option {
    display: flex;
    align-items: center;
    gap: 8px;
}

.modality-option input[type="checkbox"] {
    margin: 0;
}

.modality-option label {
    font-size: 0.75rem;
    font-weight: normal;
    margin: 0;
    cursor: pointer;
}

/* Video container styles */
.video-container {
    width: 300px;
    height: 225px;
    background-color: var(--light-grey);
    border: 1px solid var(--border-color);
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: hidden;
    position: absolute;
    bottom: 85px;
    right: 18px;
    border-radius: 8px;
    z-index: 100;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
}

#userVideo {
    width: 100%;
    height: 100%;
    object-fit: cover;
    background-color: black;
}

/* Additional mobile-specific adjustments */
@media (max-width: 480px) {
    .button-group {
        gap: 5px;
    }
    
    #sendTextBtn, #recordAudioBtn, #videoCallBtn, #cameraToggleBtn {
        width: 34px;
        height: 34px;
    }
    
    .bi-mic, .bi-send, .bi-camera-video, .bi-arrow-repeat {
        font-size: 0.95rem;
    }
    
    .video-container {
        width: 200px;
        height: 150px;
        bottom: 75px;
        right: 18px;
    }
    
    .status-message {
        width: calc(100% - 126px);
        font-size: 0.75rem;
        padding: 6px 10px;
    }
    
    /* Improve readability on small screens */
    .chat-messages {
        padding: 12px;
    }
    
    .message-bubble {
        max-width: 90%;
        padding: 8px 12px;
    }
}
