/* ── Design Tokens ──────────────────────────────────────────────────────── */
:root {
    --bg-primary: #0a0e1a;
    --bg-secondary: #111827;
    --bg-card: rgba(17, 24, 39, 0.7);
    --bg-card-border: rgba(255, 255, 255, 0.06);
    --bg-input: rgba(255, 255, 255, 0.04);
    --bg-input-focus: rgba(255, 255, 255, 0.07);

    --text-primary: #f1f5f9;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;

    --accent: #6366f1;
    --accent-glow: rgba(99, 102, 241, 0.25);
    --accent-hover: #818cf8;

    --green: #34d399;
    --green-glow: rgba(52, 211, 153, 0.3);
    --red: #f87171;
    --red-glow: rgba(248, 113, 113, 0.3);

    --radius: 12px;
    --radius-sm: 8px;
    --font: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;

    --shadow: 0 4px 24px rgba(0, 0, 0, 0.3);
    --shadow-lg: 0 8px 40px rgba(0, 0, 0, 0.4);
}

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

body {
    font-family: var(--font);
    background: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background:
        radial-gradient(ellipse at 20% 0%, rgba(99, 102, 241, 0.08) 0%, transparent 60%),
        radial-gradient(ellipse at 80% 100%, rgba(52, 211, 153, 0.05) 0%, transparent 60%);
    pointer-events: none;
    z-index: 0;
}

/* ── Container ─────────────────────────────────────────────────────────── */
.container {
    position: relative;
    z-index: 1;
    max-width: 800px;
    margin: 0 auto;
    padding: 24px 20px 60px;
}

/* ── Header ────────────────────────────────────────────────────────────── */
header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 32px;
    padding-bottom: 24px;
    border-bottom: 1px solid var(--bg-card-border);
}

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

.logo-icon {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--accent), #8b5cf6);
    border-radius: var(--radius-sm);
    color: white;
    box-shadow: 0 2px 12px var(--accent-glow);
}

.logo-icon svg {
    width: 22px;
    height: 22px;
}

header h1 {
    font-size: 1.5rem;
    font-weight: 700;
    letter-spacing: -0.02em;
}

/* ── Status Badge ──────────────────────────────────────────────────────── */
.status-badge {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 14px;
    border-radius: 20px;
    background: rgba(255, 255, 255, 0.05);
    font-size: 0.8rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    transition: all 0.3s ease;
}

.status-badge.idle {
    color: var(--text-secondary);
}

.status-badge.active {
    color: var(--green);
    background: rgba(52, 211, 153, 0.1);
}

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

.status-badge.idle .status-dot {
    background: var(--text-muted);
}

.status-badge.active .status-dot {
    background: var(--green);
    box-shadow: 0 0 8px var(--green-glow);
    animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.6; transform: scale(1.2); }
}

/* ── Cards ─────────────────────────────────────────────────────────────── */
.card {
    background: var(--bg-card);
    border: 1px solid var(--bg-card-border);
    border-radius: var(--radius);
    backdrop-filter: blur(20px);
    box-shadow: var(--shadow);
    margin-bottom: 24px;
    overflow: hidden;
    transition: border-color 0.3s ease;
}

.card:hover {
    border-color: rgba(255, 255, 255, 0.1);
}

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

.card-header h2 {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
    letter-spacing: -0.01em;
}

.card-body {
    padding: 24px;
}

/* ── Call Status ────────────────────────────────────────────────────────── */
.call-card.active-call {
    border-color: rgba(52, 211, 153, 0.2);
    box-shadow: var(--shadow), 0 0 30px rgba(52, 211, 153, 0.05);
}

.live-indicator {
    display: flex;
    align-items: center;
    gap: 6px;
    color: var(--red);
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.08em;
}

.live-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--red);
    animation: pulse 1.5s ease-in-out infinite;
}

.call-idle {
    text-align: center;
    padding: 32px 0;
}

.idle-icon {
    width: 56px;
    height: 56px;
    margin: 0 auto 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.04);
    color: var(--text-muted);
}

.idle-icon svg {
    width: 28px;
    height: 28px;
}

.call-idle p {
    color: var(--text-secondary);
    font-size: 0.95rem;
}

.call-idle .hint {
    color: var(--text-muted);
    font-size: 0.8rem;
    margin-top: 4px;
}

/* Dial form */
.dial-form {
    display: flex;
    align-items: center;
    gap: 10px;
    justify-content: center;
    flex-wrap: wrap;
    margin-top: 24px;
    padding-top: 20px;
    border-top: 1px solid var(--bg-card-border);
}

.dial-form input[type="tel"] {
    background: var(--bg-input);
    border: 1px solid var(--bg-card-border);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-family: var(--font);
    font-size: 0.95rem;
    padding: 10px 14px;
    width: 200px;
    transition: all 0.2s ease;
}

.dial-form input[type="tel"]:focus {
    outline: none;
    background: var(--bg-input-focus);
    border-color: rgba(99, 102, 241, 0.4);
    box-shadow: 0 0 0 3px var(--accent-glow);
}

.dial-status {
    font-size: 0.8rem;
    color: var(--text-muted);
    width: 100%;
    text-align: center;
}

/* Call Info Grid */
.call-info-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin-bottom: 20px;
}

.info-item {
    background: var(--bg-input);
    padding: 14px 16px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--bg-card-border);
}

.info-item label {
    display: block;
    font-size: 0.7rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-muted);
    margin-bottom: 4px;
}

.info-value {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
}

.info-value.mono {
    font-family: 'SF Mono', 'Fira Code', monospace;
    font-size: 0.85rem;
}

.info-value.timer {
    font-family: 'SF Mono', 'Fira Code', monospace;
    font-size: 1.2rem;
    color: var(--green);
}

/* Call Actions */
.call-actions {
    display: flex;
    justify-content: flex-end;
    margin-bottom: 16px;
}

/* Transcripts */
.transcripts h3 {
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-muted);
    margin-bottom: 12px;
}

.transcript-list {
    max-height: 240px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.transcript-list::-webkit-scrollbar {
    width: 4px;
}

.transcript-list::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 2px;
}

.transcript-item {
    display: flex;
    gap: 10px;
    padding: 8px 12px;
    border-radius: var(--radius-sm);
    background: var(--bg-input);
    font-size: 0.875rem;
    animation: slideIn 0.3s ease;
}

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

.transcript-item .role {
    font-weight: 600;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    white-space: nowrap;
    padding-top: 2px;
}

.transcript-item.user .role { color: var(--accent); }
.transcript-item.assistant .role { color: var(--green); }

.transcript-item .text {
    color: var(--text-secondary);
    line-height: 1.5;
}

/* ── Form Controls ─────────────────────────────────────────────────────── */
.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    font-size: 0.8rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

textarea, select {
    width: 100%;
    background: var(--bg-input);
    border: 1px solid var(--bg-card-border);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-family: var(--font);
    font-size: 0.9rem;
    padding: 12px 14px;
    transition: all 0.2s ease;
    resize: vertical;
}

textarea:focus, select:focus {
    outline: none;
    background: var(--bg-input-focus);
    border-color: rgba(99, 102, 241, 0.4);
    box-shadow: 0 0 0 3px var(--accent-glow);
}

select {
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 14px center;
    padding-right: 36px;
}

select option {
    background: var(--bg-secondary);
    color: var(--text-primary);
}

/* ── Buttons ───────────────────────────────────────────────────────────── */
.form-actions {
    display: flex;
    align-items: center;
    gap: 14px;
}

.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    border: none;
    border-radius: var(--radius-sm);
    font-family: var(--font);
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-primary {
    background: linear-gradient(135deg, var(--accent), #8b5cf6);
    color: white;
    box-shadow: 0 2px 12px var(--accent-glow);
}

.btn-primary:hover {
    background: linear-gradient(135deg, var(--accent-hover), #a78bfa);
    box-shadow: 0 4px 20px var(--accent-glow);
    transform: translateY(-1px);
}

.btn-primary:active {
    transform: translateY(0);
}

.btn-danger {
    background: linear-gradient(135deg, #ef4444, #dc2626);
    color: white;
    box-shadow: 0 2px 12px rgba(239, 68, 68, 0.3);
}

.btn-danger:hover {
    background: linear-gradient(135deg, #f87171, #ef4444);
    box-shadow: 0 4px 20px rgba(239, 68, 68, 0.4);
    transform: translateY(-1px);
}

.btn-danger:active {
    transform: translateY(0);
}

.btn-danger:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

.save-status {
    font-size: 0.8rem;
    color: var(--green);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.save-status.show {
    opacity: 1;
}

/* ── Responsive ────────────────────────────────────────────────────────── */
@media (max-width: 600px) {
    .container {
        padding: 16px 12px 40px;
    }

    header {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }

    .call-info-grid {
        grid-template-columns: 1fr;
    }

    .card-body {
        padding: 16px;
    }
}
