/* ============================================
   Voice Flow Tester - Light Theme
   ============================================ */

:root {
    /* Color Palette - Clean Light Theme */
    --bg-primary: #f5f7fa;
    --bg-secondary: #ffffff;
    --bg-tertiary: #eef1f5;
    --bg-elevated: #ffffff;
    --bg-hover: #e8ecf2;
    
    --accent-primary: #0891b2;
    --accent-secondary: #0e7490;
    --accent-tertiary: #7c3aed;
    --accent-warning: #f59e0b;
    --accent-danger: #ef4444;
    --accent-success: #10b981;
    
    --text-primary: #1e293b;
    --text-secondary: #64748b;
    --text-muted: #94a3b8;
    
    --border-color: #e2e8f0;
    --border-accent: #0891b240;
    
    --user-bubble-bg: linear-gradient(135deg, #0891b2, #0e7490);
    --user-bubble-text: #ffffff;
    --agent-bubble-bg: #ffffff;
    --agent-bubble-text: #1e293b;
    --agent-bubble-border: #e2e8f0;
    
    --audio-invert: 0;
    
    /* Shadows */
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.08);
    --shadow-md: 0 4px 20px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 8px 40px rgba(0, 0, 0, 0.15);
    --shadow-glow: 0 0 20px rgba(8, 145, 178, 0.2);
    
    /* Typography */
    --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    --font-mono: 'JetBrains Mono', 'Fira Code', monospace;
    
    /* Sizing */
    --sidebar-width: 320px;
    --header-height: 60px;
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 16px;
}

/* Reset & Base */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html, body {
    height: 100%;
    overflow: hidden;
}

body {
    font-family: var(--font-sans);
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.5;
    font-size: 14px;
}

/* App Container */
.app-container {
    display: flex;
    height: 100vh;
    overflow: hidden;
}

/* ============================================
   SIDEBAR
   ============================================ */
.sidebar {
    width: var(--sidebar-width);
    background: var(--bg-secondary);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    overflow-x: hidden;
    flex-shrink: 0;
}

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

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

.logo-icon {
    font-size: 24px;
}

.logo-text {
    font-weight: 700;
    font-size: 18px;
    background: linear-gradient(135deg, var(--accent-primary), var(--accent-tertiary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.version {
    font-size: 11px;
    color: var(--text-muted);
    padding: 4px 8px;
    background: var(--bg-tertiary);
    border-radius: var(--radius-sm);
    font-family: var(--font-mono);
}

/* Sidebar Sections */
.sidebar-section {
    border-bottom: 1px solid var(--border-color);
}

.section-header {
    padding: 14px 20px;
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: default;
}

.toggle-section {
    cursor: pointer;
    transition: background 0.2s;
}

.toggle-section:hover {
    background: var(--bg-hover);
}

.section-icon {
    font-size: 16px;
}

.section-title {
    flex: 1;
    font-weight: 600;
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-secondary);
}

.chevron {
    font-size: 10px;
    color: var(--text-muted);
    transition: transform 0.3s;
}

.section-content {
    padding: 0 20px 20px;
}

.section-content.collapsed {
    display: none;
}

.connection-indicator {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--accent-danger);
    box-shadow: 0 0 8px var(--accent-danger);
}

.connection-indicator.connected {
    background: var(--accent-success);
    box-shadow: 0 0 8px var(--accent-success);
}

/* Inputs */
.input-group {
    margin-bottom: 12px;
}

.input-group label {
    display: block;
    font-size: 12px;
    color: var(--text-muted);
    margin-bottom: 6px;
}

input[type="text"] {
    width: 100%;
    padding: 10px 12px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 13px;
    transition: all 0.2s;
}

input[type="text"]:focus {
    outline: none;
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 3px var(--border-accent);
}

input[type="text"]:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Tel input - same styling as text */
input[type="tel"] {
    width: 100%;
    padding: 10px 12px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 13px;
    transition: all 0.2s;
}

input[type="tel"]:focus {
    outline: none;
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 3px var(--border-accent);
}

input[type="tel"]:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Input hint text */
.input-hint {
    display: block;
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 4px;
}

.mono-input {
    font-family: var(--font-mono);
    font-size: 12px;
}

.input-sm {
    padding: 6px 10px;
    font-size: 12px;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 16px;
    border: none;
    border-radius: var(--radius-sm);
    font-family: var(--font-sans);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
}

.btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
    transform: none !important;
}

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

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

.btn-success {
    background: var(--accent-success);
    color: var(--bg-primary);
}

.btn-success:hover:not(:disabled) {
    filter: brightness(1.1);
    transform: translateY(-1px);
}

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

.btn-danger:hover:not(:disabled) {
    filter: brightness(1.1);
    transform: translateY(-1px);
}

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

.btn-outline:hover:not(:disabled) {
    background: var(--bg-hover);
    border-color: var(--text-muted);
    color: var(--text-primary);
}

.btn-ghost {
    background: transparent;
    color: var(--text-muted);
}

.btn-ghost:hover:not(:disabled) {
    color: var(--text-secondary);
    background: var(--bg-hover);
}

.btn-sm {
    padding: 6px 12px;
    font-size: 12px;
}

.btn-large {
    padding: 14px 20px;
    font-size: 14px;
    width: 100%;
}

.btn-group {
    display: flex;
    gap: 8px;
}

.btn-icon {
    font-size: 12px;
}

/* Call Controls */
.call-action-buttons {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 12px;
}

.call-status-bar {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 12px;
    background: var(--bg-tertiary);
    border-radius: var(--radius-sm);
    font-size: 13px;
}

.status-label {
    color: var(--text-muted);
}

.status-value {
    color: var(--text-primary);
    font-weight: 500;
}

/* Audio Meters */
.audio-meters {
    display: flex;
    gap: 12px;
}

.meter {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 12px;
    background: var(--bg-tertiary);
    border-radius: var(--radius-sm);
}

.meter-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--text-muted);
    transition: all 0.2s;
}

.meter.active .meter-dot {
    background: var(--accent-success);
    box-shadow: 0 0 8px var(--accent-success);
    animation: pulse 1s infinite;
}

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

.meter-label {
    font-size: 12px;
    color: var(--text-secondary);
}

/* Mic Test */
.mic-test-controls {
    display: flex;
    gap: 6px;
    margin-bottom: 12px;
}

.mic-visualizer {
    background: var(--bg-primary);
    border-radius: var(--radius-sm);
    margin-bottom: 10px;
    overflow: hidden;
}

#micTestCanvas {
    width: 100%;
    display: block;
}

.mic-test-player {
    display: flex;
    align-items: center;
    gap: 10px;
}

.mic-test-player audio {
    flex: 1;
    height: 32px;
}

.status-badge {
    display: inline-block;
    padding: 4px 10px;
    background: var(--bg-tertiary);
    border-radius: 20px;
    font-size: 11px;
    color: var(--text-muted);
}

.status-badge.recording {
    background: rgba(255, 107, 107, 0.2);
    color: var(--accent-danger);
}

.status-badge.playing {
    background: rgba(0, 212, 170, 0.2);
    color: var(--accent-success);
}

/* Saved Calls Container (Main Tab) */
.saved-calls-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding: 24px;
    overflow: hidden;
    min-height: 0;
}

.saved-calls-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
    flex-shrink: 0;
    gap: 16px;
}

.saved-calls-toolbar h2 {
    font-size: 18px;
    font-weight: 600;
    margin: 0;
}

.toolbar-left {
    display: flex;
    align-items: center;
    gap: 12px;
}

.toolbar-right {
    display: flex;
    align-items: center;
    gap: 10px;
}

.toolbar-right .input-sm {
    width: 200px;
}

.limit-input {
    width: 70px !important;
    text-align: center;
}

input[type="number"] {
    -moz-appearance: textfield;
}

input[type="number"]::-webkit-outer-spin-button,
input[type="number"]::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.manual-fetch-bar {
    display: flex;
    gap: 12px;
    margin-bottom: 16px;
    flex-shrink: 0;
}

.manual-fetch-bar input {
    flex: 1;
}

/* Saved Calls Grid */
.saved-calls-grid {
    flex: 1;
    overflow-y: auto;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    min-height: 0;
}

.saved-calls-grid .empty-state {
    padding: 60px 20px;
    text-align: center;
    color: var(--text-muted);
}

.saved-calls-grid .empty-icon {
    font-size: 48px;
    margin-bottom: 16px;
    opacity: 0.3;
}

.saved-calls-grid .empty-hint {
    font-size: 13px;
    opacity: 0.6;
    margin-top: 6px;
}

.saved-call-item {
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-color);
    cursor: pointer;
    transition: background 0.2s;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

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

.saved-call-item:hover {
    background: var(--bg-hover);
}

.saved-call-info {
    flex: 1;
}

.saved-call-id {
    font-family: var(--font-mono);
    font-size: 13px;
    color: var(--text-primary);
    font-weight: 500;
    margin-bottom: 4px;
}

.saved-call-meta {
    font-size: 12px;
    color: var(--text-muted);
}

.saved-call-duration {
    font-family: var(--font-mono);
    font-size: 12px;
    color: var(--accent-primary);
    padding: 6px 12px;
    background: rgba(8, 145, 178, 0.1);
    border-radius: 20px;
    font-weight: 500;
}

/* Sidebar Footer */
.sidebar-footer {
    margin-top: auto;
    padding: 15px 20px;
    border-top: 1px solid var(--border-color);
    display: flex;
    gap: 8px;
}

/* ============================================
   MAIN CONTENT
   ============================================ */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background: var(--bg-primary);
    min-width: 0; /* Prevent flex item from overflowing */
    min-height: 0; /* Critical for nested flex scroll */
}

/* Live Call Banner */
.live-call-banner {
    background: linear-gradient(135deg, rgba(0, 212, 170, 0.15), rgba(108, 92, 231, 0.15));
    border-bottom: 1px solid var(--accent-primary);
    padding: 12px 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    animation: slideDown 0.3s ease-out;
}

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

.banner-status {
    display: flex;
    align-items: center;
    gap: 10px;
}

.pulse-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: var(--accent-success);
    animation: pulseDot 1.5s infinite;
}

@keyframes pulseDot {
    0%, 100% { box-shadow: 0 0 0 0 rgba(0, 212, 170, 0.6); }
    50% { box-shadow: 0 0 0 10px rgba(0, 212, 170, 0); }
}

.banner-text {
    font-weight: 700;
    font-size: 12px;
    letter-spacing: 1px;
    color: var(--accent-success);
}

.banner-info {
    display: flex;
    gap: 30px;
}

.info-item {
    display: flex;
    align-items: center;
    gap: 8px;
}

.info-label {
    font-size: 11px;
    color: var(--text-muted);
    text-transform: uppercase;
}

.info-value {
    font-size: 13px;
    color: var(--text-primary);
    font-weight: 500;
}

.info-value.mono {
    font-family: var(--font-mono);
    font-size: 12px;
}

.copy-btn {
    background: transparent;
    border: none;
    cursor: pointer;
    font-size: 12px;
    opacity: 0.6;
    transition: opacity 0.2s;
}

.copy-btn:hover {
    opacity: 1;
}

/* Tabs Container */
.tabs-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    min-height: 0;
}

.tabs-header {
    display: flex;
    gap: 0;
    padding: 0 24px;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
    flex-shrink: 0;
}

.tab-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 14px 24px;
    background: transparent;
    border: none;
    border-bottom: 3px solid transparent;
    font-family: var(--font-sans);
    font-size: 14px;
    font-weight: 600;
    color: var(--text-muted);
    cursor: pointer;
    transition: all 0.2s;
}

.tab-btn:hover {
    color: var(--text-primary);
    background: var(--bg-hover);
}

.tab-btn.active {
    color: var(--accent-primary);
    border-bottom-color: var(--accent-primary);
}

.tab-icon {
    font-size: 16px;
}

.tab-content {
    display: none;
    flex: 1;
    overflow: hidden;
    min-height: 0;
}

.tab-content.active {
    display: flex;
    flex-direction: column;
}

/* Conversation Area */
.conversation-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    padding: 24px;
    min-height: 0; /* Critical for flexbox scroll to work */
}

.conversation-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
    flex-shrink: 0;
}

.conversation-header h2 {
    font-size: 18px;
    font-weight: 600;
}

.chat-display {
    flex: 1;
    overflow-y: auto;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    min-height: 0; /* Critical for flexbox scroll to work */
}

.chat-empty {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    text-align: center;
}

.empty-icon {
    font-size: 48px;
    margin-bottom: 16px;
    opacity: 0.3;
}

.empty-hint {
    font-size: 13px;
    opacity: 0.6;
    margin-top: 6px;
}

/* Chat Bubbles */
.chat-bubble {
    max-width: 80%;
    padding: 0;
    border-radius: var(--radius-lg);
    animation: fadeIn 0.3s ease-out;
    position: relative;
    overflow: hidden;
    flex-shrink: 0; /* Prevent squishing - allow scroll instead */
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.chat-bubble.user {
    background: var(--user-bubble-bg);
    color: var(--user-bubble-text);
    align-self: flex-end;
    border-bottom-right-radius: 4px;
}

.chat-bubble.agent {
    background: var(--agent-bubble-bg);
    color: var(--agent-bubble-text);
    align-self: flex-start;
    border-bottom-left-radius: 4px;
    border: 1px solid var(--agent-bubble-border);
}

.chat-bubble-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px 8px;
    font-size: 11px;
}

.chat-bubble.user .chat-bubble-header {
    opacity: 0.85;
}

.chat-bubble.agent .chat-bubble-header {
    color: var(--text-muted);
}

.chat-bubble-speaker {
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.chat-bubble-time {
    font-size: 10px;
    font-family: var(--font-mono);
}

/* Message Content */
.chat-bubble-content {
    padding: 0 16px 14px;
}

.chat-bubble-text {
    font-size: 15px;
    line-height: 1.6;
    word-wrap: break-word;
}

.chat-bubble.user .chat-bubble-text {
    color: var(--user-bubble-text);
}

.chat-bubble.agent .chat-bubble-text {
    color: var(--agent-bubble-text);
}

/* Logs Container */
.logs-container {
    height: 200px;
    border-top: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    transition: height 0.3s;
}

.logs-container.collapsed {
    height: 40px;
}

.logs-container.collapsed .logs-display {
    display: none;
}

.logs-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 24px;
    background: var(--bg-secondary);
    cursor: pointer;
}

.logs-title {
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
}

.logs-toggle {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 10px;
    transition: transform 0.3s;
}

.logs-container.collapsed .logs-toggle {
    transform: rotate(180deg);
}

.logs-display {
    flex: 1;
    overflow-y: auto;
    background: var(--bg-primary);
    padding: 12px 24px;
    font-family: var(--font-mono);
    font-size: 11px;
    line-height: 1.8;
}

.log-entry {
    display: flex;
    gap: 12px;
    padding: 4px 0;
    border-bottom: 1px solid var(--border-color);
}

.log-time {
    color: var(--text-muted);
    flex-shrink: 0;
}

.log-level {
    font-weight: 600;
    width: 60px;
    flex-shrink: 0;
}

.log-level.info { color: var(--accent-primary); }
.log-level.warn { color: var(--accent-warning); }
.log-level.error { color: var(--accent-danger); }
.log-level.success { color: var(--accent-success); }

.log-message {
    color: var(--text-secondary);
    word-break: break-word;
}

/* Modal */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    animation: fadeIn 0.2s;
}

.modal-content {
    background: var(--bg-secondary);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-color);
    max-width: 800px;
    width: 90%;
    max-height: 80vh;
    display: flex;
    flex-direction: column;
    box-shadow: var(--shadow-lg);
}

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

.modal-header h3 {
    font-family: var(--font-mono);
    font-size: 14px;
    color: var(--text-primary);
}

.modal-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

.modal-actions .btn {
    white-space: nowrap;
}

.modal-close {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--bg-tertiary);
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 16px;
    transition: all 0.2s;
}

.modal-close:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.modal-body {
    flex: 1;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.player-audio {
    padding: 20px 24px;
    background: var(--bg-tertiary);
    border-bottom: 1px solid var(--border-color);
}

.player-audio audio {
    width: 100%;
    height: 40px;
}

.player-transcript {
    flex: 1;
    overflow-y: auto;
    padding: 20px 24px;
}

.player-transcript-entry {
    padding: 12px 16px;
    margin-bottom: 12px;
    border-radius: var(--radius-md);
    animation: fadeIn 0.3s;
}

.player-transcript-entry.user {
    background: rgba(0, 212, 170, 0.1);
    border-left: 3px solid var(--accent-primary);
    margin-left: 15%;
}

.player-transcript-entry.agent {
    background: var(--bg-tertiary);
    border-left: 3px solid var(--accent-tertiary);
    margin-right: 15%;
}

.player-transcript-header {
    display: flex;
    justify-content: space-between;
    font-size: 11px;
    color: var(--text-muted);
    margin-bottom: 6px;
}

.player-transcript-speaker {
    font-weight: 600;
    text-transform: uppercase;
}

.player-transcript-time {
    font-family: var(--font-mono);
}

.player-transcript-text {
    font-size: 14px;
    line-height: 1.5;
}

/* Scrollbar Styling */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bg-primary);
}

::-webkit-scrollbar-thumb {
    background: var(--bg-hover);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}

/* Audio element styling */
audio {
    filter: invert(var(--audio-invert));
}

audio::-webkit-media-controls-panel {
    background: var(--bg-tertiary);
}

/* Hide audio elements in chat bubbles (we use custom controls) */
.chat-bubble audio {
    display: none;
}

/* ============================================
   RESPONSIVE STYLES
   ============================================ */

/* Large tablets and small desktops */
@media (max-width: 1200px) {
    :root {
        --sidebar-width: 280px;
    }
    
    .banner-info {
        gap: 20px;
    }
}

/* Tablets */
@media (max-width: 1024px) {
    :root {
        --sidebar-width: 260px;
    }
    
    .conversation-container {
        padding: 16px;
    }
    
    .chat-display {
        padding: 16px;
    }
    
    .logs-container {
        height: 150px;
    }
    
    .logs-header {
        padding: 10px 16px;
    }
    
    .logs-display {
        padding: 12px 16px;
    }
}

/* Small tablets and large phones */
@media (max-width: 768px) {
    .app-container {
        flex-direction: column;
    }
    
    .sidebar {
        width: 100%;
        max-height: 40vh;
        overflow-y: auto;
        border-right: none;
        border-bottom: 1px solid var(--border-color);
    }
    
    .sidebar-section:last-child {
        border-bottom: none;
    }
    
    .main-content {
        min-height: 60vh;
    }
    
    .tabs-header {
        padding: 0 12px;
    }
    
    .tab-btn {
        padding: 12px 16px;
        font-size: 13px;
    }
    
    .live-call-banner {
        padding: 10px 16px;
        flex-wrap: wrap;
    gap: 10px;
    }
    
    .banner-info {
        gap: 15px;
    flex-wrap: wrap;
    }
    
    .info-item {
        font-size: 11px;
    }
    
    .conversation-container,
    .saved-calls-container {
        padding: 12px;
    }
    
    .conversation-header,
    .saved-calls-toolbar {
        flex-wrap: wrap;
        gap: 10px;
    }
    
    .toolbar-right {
        width: 100%;
        flex-wrap: wrap;
    }
    
    .toolbar-right .input-sm {
        flex: 1;
        min-width: 120px;
    }
    
    .manual-fetch-bar {
        flex-wrap: wrap;
    }
    
    .chat-display,
    .saved-calls-grid {
        padding: 12px;
        gap: 12px;
        border-radius: var(--radius-md);
    }
    
    .chat-bubble {
        max-width: 90%;
    }
    
    .chat-bubble-header {
        padding: 10px 12px 6px;
    }
    
    .chat-bubble-content {
        padding: 0 12px 12px;
    }
    
    .chat-bubble-text {
    font-size: 14px;
}

    .saved-call-item {
        padding: 12px;
        flex-wrap: wrap;
        gap: 10px;
    }
    
    .logs-container {
        height: 120px;
    }
    
    .modal-content {
        width: 95%;
        max-height: 85vh;
    }
}

/* Phones */
@media (max-width: 480px) {
    .sidebar-header {
        padding: 15px;
    }
    
    .logo-text {
        font-size: 16px;
    }
    
    .section-content {
        padding: 0 15px 15px;
    }
    
    .call-action-buttons {
        flex-direction: column;
    }
    
    .btn-large {
        padding: 12px 16px;
    }
    
    .audio-meters {
        flex-direction: column;
        gap: 8px;
    }
    
    .tabs-header {
        padding: 0 8px;
    }
    
    .tab-btn {
        padding: 10px 12px;
        font-size: 12px;
        flex: 1;
        justify-content: center;
    }
    
    .tab-icon {
        font-size: 14px;
    }
    
    .conversation-header h2,
    .saved-calls-toolbar h2 {
        font-size: 16px;
    }
    
    .saved-calls-container {
    padding: 10px;
    }
    
    .manual-fetch-bar {
        flex-direction: column;
    }
    
    .chat-bubble {
        max-width: 95%;
    }
    
    .chat-bubble-speaker {
        font-size: 10px;
    }
    
    .chat-bubble-time {
        font-size: 9px;
    }
    
    .chat-bubble-text {
    font-size: 13px;
        line-height: 1.5;
    }
    
    .saved-call-id {
        font-size: 11px;
    }
    
    .saved-call-meta {
        font-size: 10px;
    }
    
    .logs-container {
        height: 100px;
    }
    
    .logs-display {
        font-size: 10px;
    }
    
    .log-entry {
        flex-wrap: wrap;
        gap: 4px;
    }
    
    .log-level {
        width: auto;
    }
}

/* ============================================
   DTMF KEYPAD
   ============================================ */
.dtmf-keypad {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    margin-bottom: 12px;
}

.dtmf-key {
    aspect-ratio: 1;
    background: var(--bg-elevated);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    cursor: pointer;
    font-family: var(--font-sans);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    padding: 12px 8px;
    transition: all 0.15s ease;
    box-shadow: var(--shadow-sm);
    position: relative;
    overflow: hidden;
}

.dtmf-key:hover {
    background: var(--bg-hover);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
    border-color: var(--accent-primary);
}

.dtmf-key:active {
    transform: translateY(0);
    box-shadow: var(--shadow-sm);
    background: var(--accent-primary);
}

.dtmf-key:active .digit {
    color: white;
}

.dtmf-key:active .letters {
    color: rgba(255, 255, 255, 0.8);
}

.dtmf-key:disabled {
    opacity: 0.4;
    cursor: not-allowed;
    pointer-events: none;
}

.dtmf-key .digit {
    font-size: 24px;
    font-weight: 600;
    color: var(--text-primary);
    line-height: 1;
}

.dtmf-key .letters {
    font-size: 9px;
    font-weight: 500;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    line-height: 1;
}

.dtmf-display {
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 10px 12px;
    font-family: var(--font-mono);
    font-size: 16px;
    font-weight: 500;
    color: var(--text-primary);
    text-align: center;
    min-height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    letter-spacing: 4px;
}

.dtmf-display:empty::before {
    content: '—';
    color: var(--text-muted);
    letter-spacing: normal;
}

/* DTMF Animation on press */
@keyframes dtmf-pulse {
    0% {
        box-shadow: 0 0 0 0 rgba(8, 145, 178, 0.4);
    }
    70% {
        box-shadow: 0 0 0 10px rgba(8, 145, 178, 0);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(8, 145, 178, 0);
    }
}

.dtmf-key.pressed {
    animation: dtmf-pulse 0.3s ease-out;
}

/* DTMF Test Mode Toggle */
.dtmf-test-mode {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 0;
    margin-bottom: 12px;
    border-bottom: 1px solid var(--border-color);
}

.toggle-switch {
    position: relative;
    display: inline-block;
    width: 44px;
    height: 24px;
    flex-shrink: 0;
}

.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    transition: 0.3s;
    border-radius: 24px;
}

.toggle-slider:before {
    position: absolute;
    content: "";
    height: 16px;
    width: 16px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: 0.3s;
    border-radius: 50%;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.toggle-switch input:checked + .toggle-slider {
    background-color: var(--accent-primary);
    border-color: var(--accent-primary);
}

.toggle-switch input:checked + .toggle-slider:before {
    transform: translateX(20px);
}

.toggle-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
    flex: 1;
}

.toggle-label {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
}

.toggle-desc {
    font-size: 11px;
    color: var(--text-secondary);
}

.dtmf-test-settings {
    padding: 10px 0;
    margin-bottom: 12px;
    border-bottom: 1px solid var(--border-color);
}

.input-label {
    display: block;
    font-size: 12px;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 6px;
}

.dtmf-test-settings .input-sm {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    font-family: var(--font-mono);
    font-size: 14px;
    background: var(--bg-elevated);
    color: var(--text-primary);
}

.dtmf-test-settings .input-sm:focus {
    outline: none;
    border-color: var(--accent-primary);
}

/* DTMF Status Indicator */
.dtmf-status {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    margin-top: 8px;
    background: var(--bg-elevated);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    font-size: 12px;
    font-weight: 500;
}

.dtmf-status .status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--accent-primary);
    animation: pulse 2s infinite;
}

.dtmf-status .status-text {
    color: var(--text-primary);
    font-family: var(--font-mono);
}

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

.dtmf-status.completed .status-dot {
    background: var(--success);
    animation: none;
}

.dtmf-status.timeout .status-dot {
    background: var(--warning);
    animation: none;
}
