/* =================================================================
   PalAI Chat Screen Styles
   ================================================================= */

.chat-screen {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    background: #0b0c14;
}

[data-theme="light"] .chat-screen {
    background: #f8fafc;
}

/* Chat Navigation */
.chat-nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 20px;
    background: rgba(11, 12, 20, 0.95);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    position: sticky;
    top: 0;
    z-index: 100;
}

[data-theme="light"] .chat-nav {
    background: rgba(255, 255, 255, 0.95);
    border-color: #e5e7eb;
}

.nav-left {
    flex: 1;
    display: flex;
    align-items: center;
}

.nav-center {
    display: flex;
    align-items: center;
    justify-content: center;
}

.nav-right {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: flex-end;
}

/* Voice Selector in Nav */
.voice-selector {
    position: relative;
}

.voice-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: #e5e7eb;
    padding: 8px 14px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: all 0.2s ease;
}

.voice-btn:hover {
    background: rgba(255, 255, 255, 0.15);
    border-color: rgba(255, 255, 255, 0.3);
}

[data-theme="light"] .voice-btn {
    background: rgba(0, 0, 0, 0.05);
    border-color: rgba(0, 0, 0, 0.1);
    color: #171717;
}

[data-theme="light"] .voice-btn:hover {
    background: rgba(0, 0, 0, 0.08);
}

.voice-dropdown {
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    background: rgba(26, 26, 26, 0.98);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 12px;
    min-width: 250px;
    max-height: 400px;
    overflow-y: auto;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-8px);
    transition: all 0.2s ease;
    z-index: 1000;
}

.voice-dropdown.show {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

[data-theme="light"] .voice-dropdown {
    background: rgba(255, 255, 255, 0.98);
    border-color: #e5e7eb;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.15);
}

.voice-dropdown-header {
    padding: 12px 16px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    font-weight: 600;
    color: #9ca3af;
    font-size: 0.85rem;
}

[data-theme="light"] .voice-dropdown-header {
    border-color: #e5e7eb;
    color: #6b7280;
}

.voice-list {
    padding: 8px;
}

/* Profile Button */
.profile-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: #e5e7eb;
    padding: 8px 14px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: all 0.2s ease;
}

.profile-btn:hover {
    background: rgba(255, 255, 255, 0.15);
    border-color: rgba(255, 255, 255, 0.3);
}

[data-theme="light"] .profile-btn {
    background: rgba(0, 0, 0, 0.05);
    border-color: rgba(0, 0, 0, 0.1);
    color: #171717;
}

[data-theme="light"] .profile-btn:hover {
    background: rgba(0, 0, 0, 0.08);
}

/* Chat Main Area */
.chat-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background: #0b0c14;
}

[data-theme="light"] .chat-main {
    background: #f8fafc;
}

.chat-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    max-width: 800px;
    margin: 0 auto;
    width: 100%;
    padding: 20px;
    overflow-y: auto;
}

/* Empty State */
.empty-state {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
}

.empty-text {
    font-size: 1.2rem;
    color: #6b7280;
}

.empty-text .highlight {
    color: #6366f1;
}

[data-theme="light"] .empty-text {
    color: #9ca3af;
}

/* Chat Messages - Messenger Style */
.chat-messages {
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 20px;
    max-width: 100%;
}

.chat-msg {
    display: flex;
    flex-direction: column;
    max-width: 70%;
    padding: 12px 16px;
    border-radius: 18px;
    word-wrap: break-word;
    position: relative;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* User messages - Right side (blue) */
.chat-msg.user {
    align-self: flex-end;
    background: #6366f1;
    color: white;
    border-bottom-right-radius: 4px;
    margin-left: auto;
}

[data-theme="light"] .chat-msg.user {
    background: #6366f1;
    color: white;
}

/* Assistant messages - Left side (gray) */
.chat-msg.assistant {
    align-self: flex-start;
    background: rgba(255, 255, 255, 0.1);
    color: #e5e7eb;
    border-bottom-left-radius: 4px;
    margin-right: auto;
}

[data-theme="light"] .chat-msg.assistant {
    background: #f3f4f6;
    color: #171717;
    border: 1px solid #e5e7eb;
}

.chat-msg .role {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    opacity: 0.8;
    margin-bottom: 4px;
}

.chat-msg.user .role {
    text-align: right;
}

.chat-msg.assistant .role {
    text-align: left;
}

.chat-msg .text {
    font-size: 15px;
    line-height: 1.5;
    white-space: pre-wrap;
    word-break: break-word;
}

/* Emotion indicator - below user messages (very small, minimal) */
.chat-msg.user .emotion-indicator {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 3px;
    margin-top: 4px;
    font-size: 10px;
    opacity: 0.6;
}

.chat-msg.user .emotion-indicator.show {
    display: flex;
    animation: fadeInSlide 0.3s ease forwards;
}

@keyframes fadeInSlide {
    from {
        opacity: 0;
        transform: translateY(-4px);
    }
    to {
        opacity: 0.6;
        transform: translateY(0);
    }
}

/* Emotion badge - very compact styling */
.emotion-badge {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    padding: 2px 6px;
    background: rgba(99, 102, 241, 0.08);
    border: 1px solid rgba(99, 102, 241, 0.15);
}

.emotion-contradiction-warning {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    color: #f59e0b;
    margin-left: 4px;
    cursor: help;
    animation: pulse-warning 2s ease-in-out infinite;
}

@keyframes pulse-warning {
    0%, 100% {
        opacity: 0.6;
    }
    50% {
        opacity: 1;
    }
    border-radius: 10px;
    font-size: 10px;
    line-height: 1.1;
}

.emotion-badge-icon {
    display: flex;
    align-items: center;
    width: 10px;
    height: 10px;
    flex-shrink: 0;
}

.emotion-badge-icon svg {
    width: 100%;
    height: 100%;
}

.emotion-badge-text {
    color: var(--emotion-color, #6366f1);
    font-weight: 500;
    font-size: 10px;
}

.emotion-badge-confidence {
    color: #9ca3af;
    font-size: 9px;
    opacity: 0.7;
}

[data-theme="light"] .emotion-badge {
    background: rgba(99, 102, 241, 0.08);
    border-color: rgba(99, 102, 241, 0.15);
}

[data-theme="light"] .emotion-badge-confidence {
    color: #6b7280;
}

/* Chat Footer */
.chat-footer {
    padding: 20px;
    background: rgba(11, 12, 20, 0.95);
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

[data-theme="light"] .chat-footer {
    background: rgba(255, 255, 255, 0.95);
    border-color: #e5e7eb;
}

.input-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    max-width: 800px;
    margin: 0 auto;
}

/* Status Indicator */
.status-indicator {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.85rem;
    color: #9ca3af;
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #10b981;
}

.status-dot.processing {
    background: #f59e0b;
    animation: pulse 1.5s infinite;
}

@keyframes pulse {

    0%,
    100% {
        opacity: 1;
        transform: scale(1);
    }

    50% {
        opacity: 0.6;
        transform: scale(1.1);
    }
}

/* Push to Talk Button */
.push-to-talk-btn {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    background: linear-gradient(135deg, #6366f1, #8b5cf6);
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    box-shadow: 0 4px 20px rgba(99, 102, 241, 0.4);
}

.push-to-talk-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 6px 25px rgba(99, 102, 241, 0.5);
}

.push-to-talk-btn:active,
.push-to-talk-btn.recording {
    transform: scale(0.95);
    background: linear-gradient(135deg, #ef4444, #dc2626);
    box-shadow: 0 4px 20px rgba(239, 68, 68, 0.4);
}

.mic-icon-container {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
}

.mic-icon {
    color: white;
}

.ripple-effect {
    position: absolute;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    border: 2px solid rgba(255, 255, 255, 0.5);
    opacity: 0;
}

.push-to-talk-btn.recording .ripple-effect {
    animation: ripple 1.5s infinite;
}

@keyframes ripple {
    0% {
        transform: scale(1);
        opacity: 0.8;
    }

    100% {
        transform: scale(2);
        opacity: 0;
    }
}

.input-hint {
    font-size: 0.85rem;
    color: #6b7280;
}

/* Emotion Toast */
.emotion-toast {
    position: fixed;
    top: 80px;
    right: 20px;
    background: rgba(26, 26, 26, 0.95);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 8px;
    padding: 8px 12px;
    display: flex;
    align-items: center;
    gap: 8px;
    opacity: 0;
    visibility: hidden;
    transform: translateX(20px);
    transition: all 0.3s ease;
    z-index: 1000;
    max-width: 280px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.emotion-toast.show {
    opacity: 1;
    visibility: visible;
    transform: translateX(0);
}

[data-theme="light"] .emotion-toast {
    background: rgba(255, 255, 255, 0.95);
    border-color: #e5e7eb;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.emotion-toast-content {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
}

.emotion-toast .emotion-icon {
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.emotion-toast .emotion-icon svg {
    width: 18px;
    height: 18px;
    color: var(--emotion-color, #6366f1);
}

.emotion-toast .emotion-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
    flex: 1;
    min-width: 0;
}

.emotion-toast .emotion-label {
    font-weight: 600;
    font-size: 0.85rem;
    color: #e5e7eb;
    line-height: 1.2;
}

.emotion-toast .emotion-meta {
    font-size: 0.75rem;
    color: #9ca3af;
    line-height: 1.2;
}

[data-theme="light"] .emotion-toast .emotion-label {
    color: #171717;
}

[data-theme="light"] .emotion-toast .emotion-meta {
    color: #6b7280;
}
/* =================================================================
   Modals - Hidden by default
   ================================================================= */

.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    z-index: 10000 !important;
    justify-content: center;
    align-items: center;
    backdrop-filter: blur(4px);
}

.emotion-logs-modal {
    z-index: 10000 !important;
}

.modal.show {
    display: flex;
}

.modal-content {
    background: #1a1a1a;
    border-radius: 12px;
    max-width: 500px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}

.modal-large {
    max-width: 700px;
}

.assistant-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 24px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.assistant-modal-header h2 {
    font-size: 1.5rem;
    font-weight: 600;
    color: #e5e7eb;
    margin: 0;
}

.voice-options {
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 8px 0;
}

.voice-options .voice-btn {
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    padding: 16px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: left;
}

.voice-options .voice-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.2);
    transform: translateY(-2px);
}

.voice-options .voice-btn.active {
    background: rgba(99, 102, 241, 0.2);
    border-color: #6366f1;
}

.voice-options .voice-name {
    font-weight: 600;
    font-size: 1rem;
    color: #e5e7eb;
    margin-bottom: 4px;
}

.voice-options .voice-description {
    font-size: 0.875rem;
    color: #9ca3af;
    line-height: 1.4;
}

.test-voice-btn-modal {
    margin-top: 8px;
    padding: 8px 16px;
    background: rgba(99, 102, 241, 0.2);
    border: 1px solid #6366f1;
    border-radius: 6px;
    color: #818cf8;
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.test-voice-btn-modal:hover {
    background: rgba(99, 102, 241, 0.3);
    border-color: #818cf8;
}

.refresh-voices-btn {
    padding: 6px 12px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 6px;
    color: #e5e7eb;
    font-size: 0.875rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.refresh-voices-btn:hover {
    background: rgba(255, 255, 255, 0.15);
}

[data-theme="light"] .modal-content {
    background: #ffffff;
}

[data-theme="light"] .assistant-modal-header {
    border-color: #e5e7eb;
}

[data-theme="light"] .assistant-modal-header h2 {
    color: #171717;
}

[data-theme="light"] .voice-options .voice-btn {
    background: #f3f4f6;
    border-color: #e5e7eb;
}

[data-theme="light"] .voice-options .voice-btn:hover {
    background: #e5e7eb;
}

[data-theme="light"] .voice-options .voice-name {
    color: #171717;
}

[data-theme="light"] .voice-options .voice-description {
    color: #6b7280;
}

/* =================================================================
   Emotion Logs Modal
   ================================================================= */

.emotion-logs-content {
    padding: 24px;
    max-height: 70vh;
    overflow-y: auto;
}

.current-emotion-section {
    margin-bottom: 32px;
    padding-bottom: 24px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

[data-theme="light"] .current-emotion-section {
    border-bottom-color: #e5e7eb;
}

.current-emotion-section h3 {
    font-size: 1.1rem;
    font-weight: 600;
    color: #e5e7eb;
    margin: 0 0 16px 0;
}

[data-theme="light"] .current-emotion-section h3 {
    color: #171717;
}

.current-emotion-card {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 16px 20px;
    background: rgba(255, 255, 255, 0.05);
    border: 2px solid var(--emotion-color, #6366f1);
    border-radius: 12px;
    transition: all 0.2s ease;
}

.current-emotion-card:hover {
    background: rgba(255, 255, 255, 0.08);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.current-emotion-icon {
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: color-mix(in srgb, var(--emotion-color, #6366f1) 15%, transparent);
    border-radius: 12px;
    flex-shrink: 0;
}

.current-emotion-icon svg {
    width: 28px;
    height: 28px;
    color: var(--emotion-color, #6366f1);
}

.current-emotion-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.current-emotion-label {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--emotion-color, #6366f1);
}

.current-emotion-meta {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 0.875rem;
    color: #9ca3af;
}

.current-emotion-confidence {
    font-weight: 500;
}

.current-emotion-time {
    opacity: 0.7;
}

.no-emotion-text {
    color: #9ca3af;
    font-style: italic;
    text-align: center;
    padding: 20px;
}

[data-theme="light"] .current-emotion-card {
    background: #f3f4f6;
    border-color: var(--emotion-color, #6366f1);
}

[data-theme="light"] .current-emotion-card:hover {
    background: #e5e7eb;
}

[data-theme="light"] .no-emotion-text {
    color: #6b7280;
}

/* Emotion Logs Empty State */
.emotion-logs-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 48px 24px;
    text-align: center;
}

.emotion-logs-empty .empty-icon {
    width: 64px;
    height: 64px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 16px;
    color: #9ca3af;
    opacity: 0.5;
}

.emotion-logs-empty h3 {
    font-size: 1.25rem;
    font-weight: 600;
    color: #e5e7eb;
    margin: 0 0 12px 0;
}

.emotion-logs-empty p {
    font-size: 0.9rem;
    color: #9ca3af;
    line-height: 1.6;
    max-width: 400px;
    margin: 0;
}

[data-theme="light"] .emotion-logs-empty h3 {
    color: #171717;
}

[data-theme="light"] .emotion-logs-empty p {
    color: #6b7280;
}

[data-theme="light"] .emotion-logs-empty .empty-icon {
    color: #9ca3af;
}

/* Emotion Chart Styles */
.emotion-chart-wrapper {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.emotion-chart-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    padding: 12px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.chart-legend-item {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.8rem;
    color: #e5e7eb;
}

.legend-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    display: inline-block;
}

.emotion-chart-container {
    width: 100%;
    height: 300px;
    background: rgba(255, 255, 255, 0.03);
    border-radius: 12px;
    padding: 16px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    overflow: hidden;
}

.emotion-chart-svg {
    width: 100%;
    height: 100%;
}

.emotion-chart-days {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.emotion-day-summary {
    padding: 12px;
    background: rgba(255, 255, 255, 0.03);
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    transition: all 0.2s ease;
}

.emotion-day-summary:hover {
    background: rgba(255, 255, 255, 0.05);
    border-color: rgba(255, 255, 255, 0.2);
}

.emotion-day-summary.today {
    border-color: #10b981;
    background: rgba(16, 185, 129, 0.1);
}

.emotion-day-summary-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
    padding-bottom: 8px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.emotion-day-summary-header h4 {
    font-size: 0.9rem;
    font-weight: 600;
    color: #e5e7eb;
    margin: 0;
}

.emotion-day-summary-header span {
    font-size: 0.75rem;
    color: #9ca3af;
}

.emotion-day-breakdown {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.emotion-breakdown-item {
    display: flex;
    align-items: center;
    gap: 10px;
}

.breakdown-label {
    font-size: 0.75rem;
    font-weight: 600;
    color: #9ca3af;
    min-width: 70px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.breakdown-bars {
    flex: 1;
    display: flex;
    height: 16px;
    border-radius: 4px;
    overflow: hidden;
    background: rgba(255, 255, 255, 0.05);
}

.mini-bar {
    height: 100%;
    transition: width 0.3s ease;
}

.no-data-text {
    font-size: 0.7rem;
    color: #9ca3af;
    font-style: italic;
    padding: 4px 0;
}

[data-theme="light"] .emotion-chart-legend {
    background: #f3f4f6;
    border-color: #e5e7eb;
}

[data-theme="light"] .chart-legend-item {
    color: #171717;
}

[data-theme="light"] .emotion-chart-container {
    background: #f9fafb;
    border-color: #e5e7eb;
}

[data-theme="light"] .emotion-day-summary {
    background: #f3f4f6;
    border-color: #e5e7eb;
}

[data-theme="light"] .emotion-day-summary:hover {
    background: #e5e7eb;
}

[data-theme="light"] .emotion-day-summary-header {
    border-color: #e5e7eb;
}

[data-theme="light"] .emotion-day-summary-header h4 {
    color: #171717;
}

[data-theme="light"] .emotion-day-summary-header span {
    color: #6b7280;
}

[data-theme="light"] .breakdown-label {
    color: #6b7280;
}

[data-theme="light"] .breakdown-bars {
    background: #e5e7eb;
}

[data-theme="light"] .no-data-text {
    color: #9ca3af;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.modal-header h2 {
    font-size: 1.25rem;
    font-weight: 600;
    color: #e5e7eb;
    margin: 0;
}

.modal-header .close {
    font-size: 1.5rem;
    color: #9ca3af;
    cursor: pointer;
    padding: 4px 8px;
    transition: color 0.2s;
}

.modal-header .close:hover {
    color: #e5e7eb;
}

.modal-body {
    padding: 20px;
}

.form-group {
    margin-bottom: 16px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    color: #9ca3af;
    font-size: 0.9rem;
}

.form-input,
.form-slider {
    width: 100%;
    padding: 10px 12px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 6px;
    color: #e5e7eb;
    font-size: 0.95rem;
}

.form-input:focus {
    outline: none;
    border-color: #6366f1;
}

.preview-controls {
    display: flex;
    gap: 12px;
    margin-top: 16px;
}

.preview-play-btn,
.preview-select-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    border-radius: 6px;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.preview-play-btn {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: #e5e7eb;
}

.preview-play-btn:hover {
    background: rgba(255, 255, 255, 0.15);
}

.preview-select-btn {
    background: #6366f1;
    border: none;
    color: white;
}

.preview-select-btn:hover {
    background: #5558e3;
}

/* Light theme modals */
[data-theme="light"] .modal-content {
    background: #ffffff;
}

[data-theme="light"] .modal-header {
    border-color: #e5e7eb;
}

[data-theme="light"] .modal-header h2 {
    color: #171717;
}

[data-theme="light"] .form-group label {
    color: #6b7280;
}

[data-theme="light"] .form-input {
    background: #f3f4f6;
    border-color: #e5e7eb;
    color: #171717;
}

[data-theme="light"] .preview-play-btn {
    background: #f3f4f6;
    border-color: #e5e7eb;
    color: #171717;
}

/* =================================================================
   Screen Visibility - Chat Active State
   ================================================================= */

/* By default, chat screen is hidden */
.chat-screen {
    display: none !important;
}

/* When user is authenticated and chat is active, show chat and hide home */
body.chat-active .chat-screen {
    display: flex !important;
}

body.chat-active .home-screen {
    display: none !important;
}

/* Theme Toggle Button in Nav */
.nav-theme-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 8px;
    cursor: pointer;
    color: #e5e7eb;
    transition: all 0.2s ease;
}

.nav-theme-btn:hover {
    background: rgba(255, 255, 255, 0.15);
    border-color: rgba(255, 255, 255, 0.3);
}

[data-theme="light"] .nav-theme-btn {
    background: rgba(0, 0, 0, 0.05);
    border-color: rgba(0, 0, 0, 0.1);
    color: #171717;
}

[data-theme="light"] .nav-theme-btn:hover {
    background: rgba(0, 0, 0, 0.1);
}

/* Voice Dropdown Options */
.voice-option {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    padding: 10px 12px;
    background: none;
    border: none;
    color: #e5e7eb;
    cursor: pointer;
    text-align: left;
    font-size: 0.9rem;
    border-radius: 6px;
    transition: background 0.2s;
}

.voice-option:hover {
    background: rgba(255, 255, 255, 0.1);
}

.voice-option.active {
    background: rgba(99, 102, 241, 0.2);
    color: #818cf8;
    font-weight: 500;
}

.voice-option .check {
    color: #818cf8;
    font-weight: bold;
}

[data-theme="light"] .voice-option {
    color: #171717;
}

[data-theme="light"] .voice-option:hover {
    background: rgba(0, 0, 0, 0.05);
}

[data-theme="light"] .voice-option.active {
    background: rgba(99, 102, 241, 0.1);
    color: #4f46e5;
}

[data-theme="light"] .voice-option .check {
    color: #4f46e5;
}

/* Profile Actions */
.profile-actions {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

[data-theme="light"] .profile-actions {
    border-top-color: #e5e7eb;
}

.logs-btn-dropdown {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    padding: 10px 14px;
    font-size: 0.9rem;
    font-weight: 500;
    color: #e5e7eb;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 6px;
    cursor: pointer;
    text-align: left;
    transition: all 0.2s ease;
}

.logs-btn-dropdown:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.2);
}

.logs-btn-dropdown svg {
    width: 16px;
    height: 16px;
    stroke: currentColor;
    flex-shrink: 0;
}

[data-theme="light"] .logs-btn-dropdown {
    background: rgba(0, 0, 0, 0.03);
    border-color: #e5e7eb;
    color: #171717;
}

[data-theme="light"] .logs-btn-dropdown:hover {
    background: rgba(0, 0, 0, 0.06);
    border-color: #d1d5db;
}

/* =================================================================
   Continuous Voice Mode UI
   ================================================================= */

/* Voice Start Wrapper */
.voice-start-wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

.voice-start-btn {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    border: none;
    background: #6366f1;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
}

.voice-start-btn:hover:not(:disabled) {
    transform: scale(1.05);
    box-shadow: 0 6px 16px rgba(99, 102, 241, 0.4);
    background: #5558e3;
}

.voice-start-btn:disabled {
    background: #6b7280;
    cursor: not-allowed;
    opacity: 0.6;
}

.waveform-icon {
    width: 24px;
    height: 24px;
}

.voice-hint {
    font-size: 13px;
    color: #9ca3af;
    text-align: center;
    margin: 0;
}

[data-theme="light"] .voice-hint {
    color: #6b7280;
}

/* Voice Active Wrapper */
.voice-active-wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
}

.voice-active-container {
    display: flex;
    align-items: center;
    gap: 24px;
    padding: 16px 32px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 9999px;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

[data-theme="light"] .voice-active-container {
    background: rgba(0, 0, 0, 0.02);
    border-color: rgba(0, 0, 0, 0.1);
}

/* Voice Waveform */
.voice-waveform {
    display: flex;
    align-items: center;
    gap: 4px;
    height: 40px;
    padding: 0 8px;
}

.waveform-bar {
    width: 4px;
    background: #6366f1;
    border-radius: 2px;
    transition: height 0.1s ease;
}

/* Idle animation */
.voice-waveform .waveform-bar {
    animation: waveform-idle 1.2s ease-in-out infinite;
}

.waveform-bar:nth-child(1) { height: 12px; animation-delay: 0s; }
.waveform-bar:nth-child(2) { height: 20px; animation-delay: 0.1s; }
.waveform-bar:nth-child(3) { height: 28px; animation-delay: 0.2s; }
.waveform-bar:nth-child(4) { height: 20px; animation-delay: 0.3s; }
.waveform-bar:nth-child(5) { height: 12px; animation-delay: 0.4s; }

@keyframes waveform-idle {
    0%, 100% { transform: scaleY(1); }
    50% { transform: scaleY(0.6); }
}

/* Listening state - green animated bars */
.voice-active-wrapper.listening .waveform-bar {
    background: #10b981;
    animation: waveform-listening 0.4s ease-in-out infinite alternate;
}

@keyframes waveform-listening {
    0% { transform: scaleY(0.5); }
    100% { transform: scaleY(1.5); }
}

/* Speaking state - active animation */
.voice-active-wrapper.speaking .waveform-bar {
    background: #6366f1;
    animation: waveform-speaking 0.2s ease-in-out infinite alternate;
}

@keyframes waveform-speaking {
    0% { transform: scaleY(0.3); }
    100% { transform: scaleY(1.8); }
}

/* Processing state - yellow pulsing */
.voice-active-wrapper.processing .waveform-bar {
    background: #f59e0b;
    animation: waveform-processing 0.6s ease-in-out infinite;
}

@keyframes waveform-processing {
    0%, 100% { transform: scaleY(1); opacity: 0.5; }
    50% { transform: scaleY(1.2); opacity: 1; }
}

/* Assistant speaking state - purple */
.voice-active-wrapper.assistant-speaking .waveform-bar {
    background: #8b5cf6;
    animation: waveform-assistant 0.5s ease-in-out infinite alternate;
}

@keyframes waveform-assistant {
    0% { transform: scaleY(0.7); }
    100% { transform: scaleY(1.3); }
}

/* Voice End Button */
.voice-end-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    background: #6366f1;
    color: white;
    border: none;
    border-radius: 9999px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.voice-end-btn:hover {
    background: #5558e3;
    transform: scale(1.02);
}

.end-dot {
    width: 8px;
    height: 8px;
    background: white;
    border-radius: 50%;
    animation: end-dot-pulse 1s ease-in-out infinite;
}

@keyframes end-dot-pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.4; }
}

/* Voice Status */
.voice-status {
    font-size: 14px;
    font-weight: 500;
    color: #9ca3af;
    text-align: center;
}

.voice-status.listening { color: #10b981; }
.voice-status.processing { color: #f59e0b; }
.voice-status.assistant-speaking { color: #8b5cf6; }

[data-theme="light"] .voice-status {
    color: #6b7280;
}

[data-theme="light"] .voice-status.listening { color: #10b981; }
[data-theme="light"] .voice-status.processing { color: #f59e0b; }
[data-theme="light"] .voice-status.assistant-speaking { color: #8b5cf6; }