/* PRISM Call Coach - Dark theme, professional, minimal */

:root {
    --bg-primary: #0b0b1a;
    --bg-secondary: #0f0f22;
    --bg-panel: #11112a;
    --bg-elevated: #18183a;
    --bg-hover: #1f1f44;
    --border: #1e1e3a;
    --border-light: #2a2a50;
    --text-primary: #e8e8e8;
    --text-secondary: #888888;
    --text-muted: #555555;
    --accent: #8d54e3;
    --accent-hover: #7a42d0;
    --accent-glow: rgba(141, 84, 227, 0.2);
    --red: #FF3B3B;
    --red-glow: rgba(255, 59, 59, 0.2);
    --green: #22C55E;
    --yellow: #EAB308;
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Inter', sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    height: 100vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    -webkit-font-smoothing: antialiased;
}

/* ── Top Bar ──────────────────────────────────────────────────────────── */

#topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 20px;
    height: 56px;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}

.topbar-right {
    flex: 1;
}

.topbar-right {
    display: flex;
    justify-content: flex-end;
}

.topbar-center {
    display: flex;
    align-items: center;
    gap: 16px;
}

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

.logo-img {
    height: 36px;
    width: auto;
}

.logo-text {
    font-size: 15px;
    font-weight: 400;
    letter-spacing: 0.5px;
    color: var(--text-secondary);
}

/* Record Button */
.record-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 20px;
    border: 1px solid var(--border-light);
    border-radius: 8px;
    background: var(--bg-elevated);
    color: var(--text-primary);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.record-btn:hover {
    background: var(--bg-hover);
    border-color: var(--text-muted);
}

.record-btn.recording {
    background: var(--red-glow);
    border-color: var(--red);
    color: var(--red);
}

.record-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--text-muted);
    transition: background 0.2s ease;
}

.record-btn.recording .record-dot {
    background: var(--red);
    animation: pulse 1.5s infinite;
}

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

.timer {
    font-family: 'SF Mono', 'Fira Code', 'Consolas', monospace;
    font-size: 14px;
    color: var(--text-secondary);
    min-width: 70px;
}

.icon-btn {
    background: none;
    border: 1px solid transparent;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 6px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    transition: all 0.15s ease;
}

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

/* ── Settings Panel ───────────────────────────────────────────────────── */

.settings-panel {
    position: absolute;
    top: 56px;
    right: 0;
    width: 320px;
    background: var(--bg-elevated);
    border: 1px solid var(--border-light);
    border-radius: 0 0 0 12px;
    z-index: 100;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
}

.settings-panel.hidden {
    display: none;
}

.settings-content {
    padding: 20px;
    position: relative;
}

.settings-content h3 {
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 16px;
    color: var(--text-primary);
}

.setting-group {
    margin-bottom: 16px;
}

.setting-group label {
    display: block;
    font-size: 12px;
    color: var(--text-secondary);
    margin-bottom: 6px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.setting-group select {
    width: 100%;
    padding: 8px 10px;
    background: var(--bg-primary);
    border: 1px solid var(--border-light);
    border-radius: 6px;
    color: var(--text-primary);
    font-size: 13px;
    cursor: pointer;
}

.setting-group select:focus {
    outline: none;
    border-color: var(--accent);
}

.settings-close {
    position: absolute;
    top: 12px;
    right: 16px;
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 20px;
    cursor: pointer;
}

.settings-close:hover {
    color: var(--text-primary);
}

/* ── Main Content ─────────────────────────────────────────────────────── */

#main {
    flex: 1;
    display: flex;
    overflow: hidden;
}

.panel {
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

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

.panel-header h2 {
    font-size: 13px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    color: var(--text-secondary);
}

.status-badge {
    font-size: 11px;
    padding: 2px 8px;
    border-radius: 4px;
    background: var(--bg-hover);
    color: var(--text-muted);
}

.status-badge.active {
    background: rgba(34, 197, 94, 0.15);
    color: var(--green);
}

.status-badge.loading {
    background: rgba(234, 179, 8, 0.15);
    color: var(--yellow);
}

/* ── Transcript Panel ─────────────────────────────────────────────────── */

.transcript-panel {
    flex: 6;
    border-right: 1px solid var(--border);
    background: var(--bg-panel);
}

.transcript-area {
    flex: 1;
    overflow-y: auto;
    padding: 16px 20px;
    scroll-behavior: smooth;
}

.transcript-area::-webkit-scrollbar {
    width: 6px;
}

.transcript-area::-webkit-scrollbar-track {
    background: transparent;
}

.transcript-area::-webkit-scrollbar-thumb {
    background: var(--border-light);
    border-radius: 3px;
}

.transcript-line {
    margin-bottom: 12px;
    line-height: 1.6;
    animation: fadeIn 0.3s ease;
}

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

.transcript-timestamp {
    font-family: 'SF Mono', 'Fira Code', 'Consolas', monospace;
    font-size: 11px;
    color: var(--text-muted);
    margin-right: 10px;
    user-select: none;
}

.transcript-text {
    font-size: 14px;
    color: var(--text-primary);
    line-height: 1.6;
}

.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    text-align: center;
    color: var(--text-muted);
}

.empty-state p {
    font-size: 14px;
    margin-bottom: 8px;
}

.empty-hint {
    font-size: 12px;
    color: var(--text-muted);
}

.empty-hint strong {
    color: var(--text-secondary);
}

/* ── Coach Panel ──────────────────────────────────────────────────────── */

.coach-panel {
    flex: 4;
    background: var(--bg-panel);
}

.coach-area {
    flex: 1;
    overflow-y: auto;
    padding: 16px 20px;
}

.coach-area::-webkit-scrollbar {
    width: 6px;
}

.coach-area::-webkit-scrollbar-track {
    background: transparent;
}

.coach-area::-webkit-scrollbar-thumb {
    background: var(--border-light);
    border-radius: 3px;
}

.coach-content {
    font-size: 13px;
    line-height: 1.7;
    color: var(--text-primary);
}

.coach-content.hidden {
    display: none;
}

/* Style the coaching markdown-like output */
.coach-content strong, .coach-content b {
    color: var(--accent);
    font-weight: 600;
}

.coach-content h1, .coach-content h2, .coach-content h3 {
    font-size: 13px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--accent);
    margin-top: 14px;
    margin-bottom: 6px;
}

.coach-content ul, .coach-content ol {
    padding-left: 18px;
    margin: 6px 0;
}

.coach-content li {
    margin-bottom: 4px;
}

.coach-content p {
    margin-bottom: 8px;
}

/* Coach controls */
.coach-controls {
    border-top: 1px solid var(--border);
    flex-shrink: 0;
}

.call-type-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 20px 0;
}

.call-type-row label {
    font-size: 11px;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    white-space: nowrap;
}

.call-type-row select {
    flex: 1;
    padding: 6px 10px;
    background: var(--bg-primary);
    border: 1px solid var(--border-light);
    border-radius: 6px;
    color: var(--text-primary);
    font-size: 12px;
    cursor: pointer;
}

.call-type-row select:focus {
    outline: none;
    border-color: var(--accent);
}

.coach-buttons {
    padding: 12px 20px 16px;
    display: flex;
    gap: 10px;
}

.btn {
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s ease;
    letter-spacing: 0.3px;
}

.btn:disabled {
    opacity: 0.35;
    cursor: not-allowed;
}

.btn-primary {
    background: var(--accent);
    color: white;
    box-shadow: 0 0 20px var(--accent-glow);
}

.btn-primary:hover:not(:disabled) {
    background: var(--accent-hover);
    box-shadow: 0 0 30px var(--accent-glow);
}

.btn-secondary {
    background: var(--bg-elevated);
    color: var(--text-primary);
    border: 1px solid var(--border-light);
}

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

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

.btn-coach {
    flex: 2;
    padding: 14px 24px;
    font-size: 15px;
}

.btn-pulse {
    flex: 1;
    padding: 14px 16px;
    font-size: 13px;
}

.btn.loading {
    position: relative;
    color: transparent;
}

.btn.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 18px;
    height: 18px;
    margin: -9px 0 0 -9px;
    border: 2px solid transparent;
    border-top-color: white;
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}

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

/* ── Bottom Bar ───────────────────────────────────────────────────────── */

#bottombar {
    display: flex;
    align-items: center;
    padding: 0 20px;
    height: 32px;
    background: var(--bg-secondary);
    border-top: 1px solid var(--border);
    font-size: 11px;
    color: var(--text-muted);
    gap: 6px;
    flex-shrink: 0;
}

.status-item {
    white-space: nowrap;
}

.status-divider {
    color: var(--border-light);
    margin: 0 4px;
}

/* ── Gemini edition additions ─────────────────────────────────────────── */

.hidden { display: none !important; }

.auto-toggle {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    color: var(--text-secondary);
    cursor: pointer;
}
.auto-toggle input { accent-color: var(--accent); }

/* Pre-call setup */
.setup-panel {
    flex: 1;
    overflow-y: auto;
    display: flex;
    justify-content: center;
    padding: 32px 16px;
}
.setup-content {
    width: 100%;
    max-width: 560px;
    background: var(--bg-panel);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 24px;
}
.setup-content h3 { margin-bottom: 16px; font-size: 18px; }
.setup-hint {
    margin-top: 14px;
    font-size: 12px;
    color: var(--text-secondary);
    line-height: 1.5;
}
.setting-group { margin-bottom: 14px; display: flex; flex-direction: column; gap: 6px; }
.setting-group label { font-size: 12px; color: var(--text-secondary); }
.setting-group input,
.setting-group select,
.setting-group textarea {
    background: var(--bg-elevated);
    border: 1px solid var(--border-light);
    border-radius: 8px;
    color: var(--text-primary);
    padding: 9px 11px;
    font-size: 14px;
    font-family: inherit;
    resize: vertical;
}
.setting-group input:focus,
.setting-group textarea:focus,
.setting-group select:focus {
    outline: none;
    border-color: var(--accent);
}

/* Transcript lines */
.transcript-line {
    padding: 6px 4px;
    font-size: 14px;
    line-height: 1.5;
    border-bottom: 1px solid var(--border);
}
.transcript-line .ts { color: var(--text-muted); font-size: 11px; margin-right: 6px; }

/* Coaching cards (newest on top) */
.coach-area { display: flex; flex-direction: column; gap: 10px; overflow-y: auto; }
.coach-card {
    background: var(--bg-elevated);
    border: 1px solid var(--border-light);
    border-left: 3px solid var(--accent);
    border-radius: 8px;
    padding: 12px 14px;
}
.coach-card.pulse { border-left-color: var(--yellow); }
.coach-card.full { border-left-color: var(--accent); }
.coach-card.auto { opacity: 0.96; }
.coach-card.summary { border-left-color: var(--green); }
.coach-card-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}
.coach-tag {
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.06em;
    color: var(--accent);
    background: var(--accent-glow);
    padding: 2px 7px;
    border-radius: 4px;
}
.coach-card.pulse .coach-tag { color: var(--yellow); background: rgba(234,179,8,0.15); }
.coach-tag.summary-tag { color: var(--green); background: rgba(34,197,94,0.15); }
.coach-ts { font-size: 11px; color: var(--text-muted); }
.coach-body { font-size: 14px; line-height: 1.55; color: var(--text-primary); }
.coach-body strong { color: #fff; }
.coach-body ul { margin: 6px 0 6px 18px; }
.coach-body li { margin-bottom: 3px; }
.btn-summary { margin-left: auto; }

/* Tester gate overlay */
.gate-overlay {
    position: fixed;
    inset: 0;
    z-index: 1000;
    background: rgba(8, 8, 20, 0.92);
    backdrop-filter: blur(6px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}
.gate-card {
    width: 100%;
    max-width: 380px;
    background: var(--bg-panel);
    border: 1px solid var(--border-light);
    border-radius: 14px;
    padding: 28px 24px;
    text-align: center;
}
.gate-logo { width: 56px; height: 56px; border-radius: 12px; margin-bottom: 14px; }
.gate-card h2 { font-size: 22px; margin-bottom: 8px; }
.gate-sub { font-size: 14px; color: var(--text-secondary); line-height: 1.5; margin-bottom: 18px; }
.gate-card input {
    width: 100%;
    background: var(--bg-elevated);
    border: 1px solid var(--border-light);
    border-radius: 9px;
    color: var(--text-primary);
    padding: 12px 13px;
    font-size: 15px;
    margin-bottom: 10px;
}
.gate-card input:focus { outline: none; border-color: var(--accent); }
.gate-btn { width: 100%; padding: 12px; font-size: 15px; margin-top: 4px; }
.gate-error { color: var(--red); font-size: 13px; min-height: 18px; margin-top: 8px; }
.gate-fine { font-size: 11px; color: var(--text-muted); margin-top: 10px; }

