/* ChristinAI Shared Styles */

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

:root {
    --primary: #2563eb;
    --primary-dark: #1d4ed8;
    --secondary: #64748b;
    --secondary-dark: #475569;
    --danger: #dc2626;
    --danger-dark: #b91c1c;
    --success: #059669;
    --success-dark: #047857;

    --gray-50: #f8fafc;
    --gray-100: #f1f5f9;
    --gray-200: #e2e8f0;
    --gray-300: #cbd5e1;
    --gray-400: #94a3b8;
    --gray-500: #64748b;
    --gray-600: #475569;
    --gray-700: #334155;
    --gray-800: #1e293b;
    --gray-900: #0f172a;

    --border-radius: 8px;
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.15);
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', sans-serif;
    background: var(--gray-50);
    color: var(--gray-700);
    line-height: 1.6;
}

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

/* Typography */
h1, h2, h3, h4, h5, h6 {
    color: var(--gray-800);
    font-weight: 600;
    line-height: 1.2;
}

h1 { font-size: 2rem; }
h2 { font-size: 1.5rem; }
h3 { font-size: 1.25rem; }

/* Buttons */
.btn {
    background: var(--primary);
    color: white;
    border: none;
    padding: 0.75rem 1.5rem;
    border-radius: var(--border-radius);
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
    display: inline-block;
    text-align: center;
    border: 1px solid transparent;
}

.btn:hover:not(:disabled) {
    background: var(--primary-dark);
    transform: translateY(-1px);
    box-shadow: var(--shadow);
}

.btn:disabled {
    background: var(--gray-400);
    cursor: not-allowed;
    transform: none;
    color: var(--gray-700);
    border-color: var(--gray-400);
}

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

.btn-secondary:hover:not(:disabled) {
    background: var(--secondary-dark);
}

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

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

.btn-small {
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
}

.btn-outline {
    background: transparent;
    color: var(--primary);
    border: 1px solid var(--primary);
}

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

.btn-success {
    background: var(--success);
}

.btn-success:hover:not(:disabled) {
    background: var(--success-dark);
}

.name-modal input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.1);
}

/* Admin Dashboard Styles */
.admin-header {
    background: var(--primary);
    color: white;
    padding: 1rem 2rem;
    box-shadow: var(--shadow);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.admin-header h1 {
    font-size: 1.5rem;
    font-weight: 600;
    color: white;
}

/* Document List Styles */
#documentItems {
    max-height: 300px;
    overflow-y: auto;
}

#documentItems::-webkit-scrollbar {
    width: 8px;
}

#documentItems::-webkit-scrollbar-track {
    background: var(--gray-100);
    border-radius: 4px;
}

#documentItems::-webkit-scrollbar-thumb {
    background: var(--gray-300);
    border-radius: 4px;
}

#documentItems::-webkit-scrollbar-thumb:hover {
    background: var(--gray-400);
}

.login-form {
    max-width: 400px;
    margin: 4rem auto;
    background: white;
    padding: 2rem;
    border-radius: 12px;
    box-shadow: var(--shadow-lg);
}

.login-form h1 {
    text-align: center;
    margin-bottom: 2rem;
    color: var(--gray-800);
}

.error-message {
    background: #fef2f2;
    color: var(--danger);
    padding: 0.75rem;
    border-radius: var(--border-radius);
    margin-bottom: 1rem;
    border: 1px solid #fecaca;
    font-size: 0.875rem;
}

.stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin-bottom: 2rem;
}

.stat-card {
    background: white;
    padding: 1.5rem;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    text-align: center;
}

.stat-number {
    font-size: 2rem;
    font-weight: 700;
    color: var(--primary);
    margin-bottom: 0.5rem;
}

.stat-label {
    color: var(--gray-500);
    font-size: 0.875rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.project-list {
    display: grid;
    gap: 1rem;
}

.project-item {
    border: 1px solid var(--gray-200);
    border-radius: var(--border-radius);
    padding: 1.5rem;
    background: var(--gray-50);
    transition: all 0.2s ease;
}

.project-item:hover {
    box-shadow: var(--shadow);
    transform: translateY(-1px);
}

.project-item h3 {
    margin-bottom: 0.5rem;
    color: var(--gray-800);
}

.project-item .client-name {
    color: var(--primary);
    font-weight: 500;
    margin-bottom: 0.5rem;
    font-size: 0.9rem;
}

.project-item .scenario {
    color: var(--gray-600);
    font-size: 0.9rem;
    line-height: 1.4;
    margin-bottom: 1rem;
}

.project-actions {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.share-link {
    background: var(--gray-100);
    border: 1px solid var(--gray-200);
    padding: 0.5rem;
    border-radius: var(--border-radius);
    font-family: 'Monaco', 'Menlo', monospace;
    font-size: 0.875rem;
    margin-top: 0.5rem;
    word-break: break-all;
    color: var(--gray-700);
}

.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.5);
    z-index: 1000;
    align-items: center;
    justify-content: center;
}

.modal-content {
    background: white;
    border-radius: 12px;
    padding: 2rem;
    max-width: 600px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: var(--shadow-lg);
}

.modal h2 {
    margin-bottom: 1.5rem;
    color: var(--gray-800);
}

/* Responsive Design */
@media (max-width: 768px) {
    .hero h1 {
        font-size: 2rem;
    }
    
    .hero {
        padding: 2rem 0;
    }
    
    .feature-grid {
        grid-template-columns: 1fr;
    }
    
    .cta-buttons,
    .demo-form {
        flex-direction: column;
        align-items: stretch;
    }
    
    .demo-form input {
        min-width: auto;
    }
    
    .chat-container {
        margin: 0.5rem;
        height: calc(100vh - 180px);
    }
    
    .session-controls {
        padding: 0.75rem 1rem;
        flex-direction: column;
        align-items: stretch;
        gap: 0.75rem;
    }
    
    .session-controls > div {
        justify-content: center;
        flex-wrap: wrap;
    }
    
    .audio-controls {
        justify-content: center;
    }
    
    .project-actions {
        flex-direction: column;
    }
    
    .admin-header {
        flex-direction: column;
        gap: 1rem;
        text-align: center;
    }
    
    .stats {
        grid-template-columns: 1fr;
    }
    
    .video-preview {
        width: 150px;
        height: 112px;
    }
    
    /* Mobile-specific audio controls */
    .audio-controls {
        flex-direction: column;
        gap: 0.75rem;
        padding: 0.75rem;
    }
    
    .audio-status {
        justify-content: center;
    }
}

@media (max-width: 480px) {
    .container {
        padding: 0 0.5rem;
    }
    
    .card-header,
    .card-body {
        padding: 1rem;
    }
    
    .chat-container {
        margin: 0.25rem;
    }
    
    .name-modal-content {
        padding: 1.5rem;
    }
    
    .login-form {
        margin: 2rem auto;
        padding: 1.5rem;
    }
}

/* Forms */
.form-group {
    margin-bottom: 1rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: var(--gray-700);
}

.form-group input,
.form-group textarea,
.form-group select {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid var(--gray-300);
    border-radius: var(--border-radius);
    font-size: 1rem;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.form-group textarea {
    min-height: 120px;
    resize: vertical;
    font-family: inherit;
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.1);
}

/* Cards */
.card {
    background: white;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    margin-bottom: 2rem;
    overflow: hidden;
}

.card-header {
    padding: 1.5rem;
    border-bottom: 1px solid var(--gray-200);
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--gray-50);
}

.card-body {
    padding: 1.5rem;
}

/* Landing Page Styles */
.landing-page {
    min-height: 100vh;
}

.hero {
    background: linear-gradient(135deg, var(--primary) 0%, #3b82f6 100%);
    color: white;
    padding: 4rem 0;
    text-align: center;
}

.hero h1 {
    font-size: 3rem;
    margin-bottom: 1rem;
    color: white;
}

.tagline {
    font-size: 1.25rem;
    margin-bottom: 1rem;
    opacity: 0.9;
}

.description {
    font-size: 1rem;
    margin-bottom: 2rem;
    opacity: 0.8;
    max-width: 600px;
    margin-left: auto;
    margin-right: auto;
}

.cta-buttons {
    display: flex;
    gap: 1rem;
    justify-content: center;
    flex-wrap: wrap;
}

.features {
    padding: 4rem 0;
    background: white;
}

.features h2 {
    text-align: center;
    margin-bottom: 3rem;
    font-size: 2rem;
}

.feature-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 2rem;
}

.feature {
    text-align: center;
    padding: 1.5rem;
    transition: all 0.2s ease;
}

.feature:hover {
    box-shadow: var(--shadow-lg);
    transform: translateY(-2px);
}

.feature-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
}

.feature h3 {
    margin-bottom: 1rem;
    color: var(--gray-800);
}

.demo-section {
    padding: 4rem 0;
    background: var(--gray-50);
    text-align: center;
}

.demo-section h2 {
    margin-bottom: 1rem;
}

.demo-form {
    display: flex;
    gap: 1rem;
    justify-content: center;
    align-items: center;
    flex-wrap: wrap;
    margin-top: 2rem;
}

.demo-form input {
    padding: 0.75rem;
    border: 1px solid var(--gray-300);
    border-radius: var(--border-radius);
    font-size: 1rem;
    min-width: 250px;
}

footer {
    background: var(--gray-800);
    color: var(--gray-300);
    text-align: center;
    padding: 2rem 0;
}

/* Session Page Styles */
.session-header {
    background: var(--primary);
    color: white;
    padding: 1rem 2rem;
    box-shadow: var(--shadow);
}

.session-header h1 {
    font-size: 1.5rem;
    font-weight: 600;
    margin-bottom: 0.25rem;
}

.session-header p {
    opacity: 0.9;
    font-size: 0.9rem;
}

.session-controls {
    background: white;
    padding: 1rem 2rem;
    border-bottom: 1px solid var(--gray-200);
    display: flex;
    gap: 1rem;
    align-items: center;
    flex-wrap: wrap;
}

/* Audio Controls */
.audio-controls {
    display: flex;
    gap: 0.5rem;
    align-items: center;
    padding: 0.5rem;
    background: var(--gray-50);
    border-radius: var(--border-radius);
    border: 1px solid var(--gray-200);
}

/* Audio status indicators */
.listening-indicator,
.speaking-indicator {
    display: none;
    align-items: center;
    gap: 0.5rem;
    font-weight: 500;
    font-size: 0.875rem;
}

.listening-indicator {
    color: var(--primary);
}

.speaking-indicator {
    color: var(--success);
}

.listening-dot,
.speaking-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    animation: pulse 1s infinite;
}

.listening-dot {
    background: var(--primary);
}

.speaking-dot {
    background: var(--success);
}

/* Interim speech styling for live transcription */
.chat-input textarea.interim-speech {
    background: linear-gradient(135deg, #f0f8ff, #e6f3ff);
    border-color: var(--primary);
    box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.1);
    transition: all 0.3s ease;
}

/* Audio feature status */
.audio-status {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.875rem;
    color: var(--gray-600);
}

.audio-status.enabled {
    color: var(--success);
}

.audio-status.listening {
    color: var(--primary);
    font-weight: 500;
}

.audio-status.speaking {
    color: var(--success);
    font-weight: 500;
}

.chat-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: white;
    margin: 1rem 2rem;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    overflow: hidden;
    height: calc(100vh - 200px);
}

.chat-messages {
    flex: 1;
    padding: 1rem;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.message {
    display: flex;
    gap: 0.75rem;
    max-width: 80%;
    animation: fade-in 0.2s ease;
}

.message.user {
    align-self: flex-end;
    flex-direction: row-reverse;
}

.message.ai {
    align-self: flex-start;
}

.message.system {
    align-self: center;
    max-width: 90%;
}

.message.system.error {
    background: #fef2f2;
    border: 1px solid #fecaca;
    border-radius: var(--border-radius);
    padding: 1rem;
}

.message-content {
    padding: 0.75rem 1rem;
    border-radius: 12px;
    line-height: 1.4;
    word-wrap: break-word;
    transition: background-color 0.3s ease;
}

.message.user .message-content {
    background: var(--primary);
    color: white;
}

.message.ai .message-content {
    background: var(--gray-100);
    color: var(--gray-700);
}

.message.system .message-content {
    background: var(--gray-50);
    color: var(--gray-600);
    text-align: center;
    font-style: italic;
}

.message-sender {
    font-size: 0.75rem;
    color: var(--gray-500);
    font-weight: 500;
    align-self: flex-end;
    margin-bottom: 0.25rem;
}

.chat-input {
    border-top: 1px solid var(--gray-200);
    padding: 1rem;
    display: flex;
    gap: 0.75rem;
    align-items: flex-end;
}

.chat-input textarea {
    flex: 1;
    border: 1px solid var(--gray-300);
    border-radius: var(--border-radius);
    padding: 0.75rem;
    resize: none;
    font-family: inherit;
    line-height: 1.4;
    max-height: 100px;
    transition: border-color 0.2s ease;
}

/* Recording & Audio Indicators */
.recording-indicator,
.listening-indicator,
.speaking-indicator {
    display: none;
    align-items: center;
    gap: 0.5rem;
    font-weight: 500;
}

.recording-indicator {
    color: var(--danger);
}

.listening-indicator {
    color: var(--primary);
}

.speaking-indicator {
    color: var(--success);
}

.recording-dot,
.listening-dot,
.speaking-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    animation: pulse 1s infinite;
}

.recording-dot {
    background: var(--danger);
}

.listening-dot {
    background: var(--primary);
}

.speaking-dot {
    background: var(--success);
}

/* Interim speech styling */
.chat-input textarea.interim-speech {
    background-color: #f0f8ff;
    border-color: var(--primary);
}

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

.loading {
    display: none;
    align-items: center;
    gap: 0.5rem;
    color: var(--gray-500);
}

.spinner {
    width: 16px;
    height: 16px;
    border: 2px solid var(--gray-200);
    border-top: 2px solid var(--primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

.video-preview {
    width: 200px;
    height: 150px;
    border-radius: var(--border-radius);
    background: #000;
    display: none;
}

/* Modals */
.name-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.name-modal-content {
    background: white;
    padding: 2rem;
    border-radius: 12px;
    box-shadow: var(--shadow-lg);
    max-width: 400px;
    width: 90%;
    animation: fade-in 0.3s ease;
}

.name-modal h2 {
    margin-bottom: 1rem;
    color: var(--gray-800);
}

.name-modal p {
    margin-bottom: 1rem;
    color: var(--gray-600);
}

.name-modal input {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid var(--gray-300);
    border-radius: var(--border-radius);
    font-size: 1rem;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.name-modal input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.2);
    outline: none;
}

/* Animations */
@keyframes fade-in {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Optional: Smooth scrolling */
html {
    scroll-behavior: smooth;
}

/* Optional: Custom Scrollbar */
.chat-messages::-webkit-scrollbar {
    width: 6px;
}

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

.chat-messages::-webkit-scrollbar-thumb:hover {
    background: var(--gray-400);
}
