/* ==================== ЗВОНОК ====================
   Раздел записи звонков через iPhone на MacBook.
   Переиспользует классы из app.css (.card, .btn, .form-*, .dialog-list-item, .empty-state,
   плашки .call-alert); здесь — только своё. */

/* Цвета волн на canvas (calls.js читает их при отрисовке): собеседник, я, ещё не сыгранная часть */
:root { --wave-remote: rgb(var(--brand)); --wave-local: rgb(var(--cat-teal)); --wave-idle: rgb(var(--border)); }
html.dark { --wave-remote: rgb(129 140 248); --wave-idle: rgb(71 85 105); }

.call-loading {
    display: flex;
    align-items: center;
    gap: 10px;
    color: rgb(var(--ink-faint));
    font-size: 14px;
    padding: 12px 0;
}
.call-loading::before {
    content: '';
    flex: none;
    width: 14px;
    height: 14px;
    border: 2px solid rgb(var(--border));
    border-top-color: rgb(var(--brand));
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

.call-hint {
    color: rgb(var(--ink-muted));
    font-size: 13px;
    line-height: 1.6;
    margin-top: 10px;
}

.call-form-grid {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 12px;
}

@media (max-width: 720px) {
    .call-form-grid { grid-template-columns: 1fr; }
}

.call-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
    margin-top: 4px;
}

/* ---------- проверка окружения ---------- */

.call-env { margin-bottom: 16px; }

.call-env-summary {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    cursor: pointer;
    font-weight: 500;
    font-size: 15px;
    list-style: none;
}

.call-env-summary::-webkit-details-marker { display: none; }

.call-env.bad .call-env-summary { color: rgb(var(--warning)); }
.call-env.ok .call-env-summary { color: rgb(var(--success)); }

.call-env-device {
    color: rgb(var(--ink-muted));
    font-weight: 400;
    font-size: 13px;
}

.call-env-summary .btn { margin-left: auto; }

.call-checklist {
    list-style: none;
    display: grid;
    gap: 8px;
    margin-bottom: 16px;
}

.call-checklist li {
    display: flex;
    gap: 10px;
    align-items: flex-start;
    font-size: 15px;
}

.call-check-icon {
    flex: 0 0 20px;
    height: 20px;
    margin-top: 1px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: 700;
    color: #fff;
    background: rgb(var(--ink-faint));
}
.call-check-icon .ic { width: 12px; height: 12px; stroke-width: 3; }

.call-checklist li.ok .call-check-icon { background: rgb(var(--success)); }
.call-checklist li.bad .call-check-icon { background: rgb(var(--danger)); }

.call-check-title { font-weight: 500; }

.call-check-hint {
    font-size: 13px;
    color: rgb(var(--ink-muted));
    line-height: 1.5;
    margin-top: 2px;
}

.call-setup {
    background: rgb(var(--surface-raised) / 0.5);
    border: 1px solid rgb(var(--border));
    border-radius: var(--radius-control);
    padding: 12px 14px;
    font-size: 13px;
    line-height: 1.6;
}

.call-setup-title {
    font-weight: 600;
    margin-bottom: 6px;
}

.call-setup ol { padding-left: 18px; }
.call-setup li { margin-bottom: 4px; }

/* ---------- живая запись ---------- */

.call-live { border-color: rgb(var(--danger) / 0.5); }

.call-live-head {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 16px;
    margin-bottom: 18px;
}

.call-live-rec {
    display: flex;
    align-items: center;
    gap: 8px;
    color: rgb(var(--danger));
    font-weight: 700;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.call-rec-dot {
    display: inline-block;
    flex: none;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: rgb(var(--danger));
    animation: call-rec-pulse 1.2s ease-in-out infinite;
}

@keyframes call-rec-pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.25; }
}

@media (prefers-reduced-motion: reduce) {
    .call-rec-dot { animation: none; }
}

.call-live-title {
    font-family: var(--font-wordmark);
    font-size: 22px;
    line-height: 28px;
    font-weight: 800;
    letter-spacing: -0.025em;
    margin-top: 6px;
}

.call-live-phone {
    color: rgb(var(--ink-muted));
    font-size: 15px;
    margin-top: 2px;
}

.call-timer {
    font-size: 44px;
    line-height: 48px;
    font-weight: 600;
    letter-spacing: -0.02em;
    font-variant-numeric: tabular-nums;
    color: rgb(var(--ink));
}

.call-meters {
    display: grid;
    gap: 14px;
    margin-bottom: 14px;
}

.call-meter-label {
    display: flex;
    justify-content: space-between;
    font-size: 15px;
    font-weight: 500;
    margin-bottom: 6px;
}

.call-meter-ch {
    color: rgb(var(--ink-muted));
    font-weight: 400;
    font-size: 12px;
}

.call-meter-bar {
    height: 8px;
    border-radius: 4px;
    background: rgb(var(--surface-2));
    overflow: hidden;
}

.call-meter-bar.disabled { opacity: 0.4; }

.call-meter-fill {
    height: 100%;
    width: 0;
    border-radius: 4px;
    transition: width 0.12s linear;
}

.call-meter-fill.remote { background: rgb(var(--brand)); }
.call-meter-fill.local { background: rgb(var(--cat-teal)); }

.call-wave {
    display: block;
    width: 100%;
    height: 40px;
    margin-top: 6px;
}

/* ---------- результат ---------- */

.call-result-head {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 16px;
    margin-bottom: 4px;
}
.call-result-head > div:first-child { flex: 1; min-width: 0; }

.call-title-input {
    font-family: var(--font-wordmark);
    font-size: 20px;
    line-height: 26px;
    font-weight: 800;
    letter-spacing: -0.02em;
    border: 1px solid transparent;
    border-radius: var(--radius-control);
    padding: 3px 8px;
    margin-left: -8px;
    width: 100%;
    min-width: 260px;
    background: transparent;
    color: rgb(var(--ink));
    transition: border-color 0.16s, box-shadow 0.16s, background 0.16s;
}

.call-title-input:hover { border-color: rgb(var(--border)); }
.call-title-input:focus { outline: none; border-color: rgb(var(--brand)); background: rgb(var(--surface-raised)); box-shadow: 0 0 0 2px rgb(var(--brand) / 0.4); }

.call-player audio {
    width: 100%;
    margin-top: 6px;
}

.call-files {
    display: grid;
    gap: 8px;
}

.call-file {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    padding: 8px 12px;
    border: 1px solid rgb(var(--border));
    border-radius: var(--radius-control);
    background: rgb(var(--surface-raised) / 0.4);
}

.call-file-name { font-size: 13px; }

.call-new-card { margin-bottom: 16px; }

/* ---------- плеер записи (старый раздел «Звонки») ---------- */

.cp {
    border: 1px solid rgb(var(--border));
    border-radius: var(--radius-card);
    padding: 12px 14px;
    background: rgb(var(--surface-raised) / 0.5);
}

.cp-bar {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 10px;
}

.cp-play {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    line-height: 0;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: none;
    background: rgb(var(--brand));
    color: #fff;
    font-size: 14px;
    cursor: pointer;
    flex: 0 0 auto;
    box-shadow: var(--shadow-brand);
    transition: background 0.16s, transform 0.16s;
}

.cp-play:hover { background: rgb(var(--brand-mid)); transform: translateY(-1px); }

/* сегмент-переключатель и выбор скорости (Segmented в megaboard, высота 32px) */
.cp-skip, .cp-seg button, .cp-speed {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font: inherit;
    font-size: 14px;
    height: 32px;
    padding: 0 10px;
    border: 1px solid rgb(var(--border));
    border-radius: var(--radius-control);
    background-color: rgb(var(--surface));
    color: rgb(var(--ink-muted));
    cursor: pointer;
    transition: color 0.15s, border-color 0.15s, background-color 0.15s;
}
select.cp-speed { padding-right: 28px; background-position: right 8px center; }

.cp-skip:hover, .cp-seg button:hover, .cp-speed:hover { color: rgb(var(--ink)); border-color: rgb(var(--ink-faint)); }

.cp-time {
    font-size: 14px;
    font-variant-numeric: tabular-nums;
    margin-left: 4px;
    color: rgb(var(--ink-muted));
}

.cp-spacer { flex: 1; }

.cp-seg { display: inline-flex; }
.cp-seg button { border-radius: 0; }
.cp-seg button:first-child { border-radius: var(--radius-control) 0 0 var(--radius-control); }
.cp-seg button:last-child { border-radius: 0 var(--radius-control) var(--radius-control) 0; margin-left: -1px; }

.cp-seg button.active {
    background: rgb(var(--brand-soft));
    border-color: rgb(var(--brand) / 0.4);
    color: rgb(var(--brand-strong));
    font-weight: 500;
    position: relative;
}

.cp-track { margin-top: 8px; }

.cp-track-head {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 14px;
    font-weight: 500;
    margin-bottom: 4px;
}

.cp-track-name { flex: 0 0 110px; }

.cp-live {
    flex: 1;
    height: 6px;
}

.cp-live .call-meter-fill { transition: none; }

.cp-wave {
    display: block;
    width: 100%;
    height: 56px;
    cursor: pointer;
    background: rgb(var(--surface));
    border-radius: var(--radius-control);
}

@media (max-width: 720px) {
    .cp-spacer { display: none; }
    .cp-track-name { flex-basis: auto; }
}

.call-check-row {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 15px;
    cursor: pointer;
    padding: 7px 0;
    user-select: none;
}

.call-compress-progress {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 13px;
    color: rgb(var(--ink-muted));
}

.call-compress-bar {
    width: 140px;
    height: 6px;
    border-radius: 3px;
    background: rgb(var(--surface-2));
    overflow: hidden;
}

.call-compress-bar > div {
    height: 100%;
    background: rgb(var(--brand));
    transition: width 0.3s ease;
}

/* ---------- транскрибация и собранный диалог на странице звонка ---------- */

.call-tx-box { padding: 12px 16px 0; }
.call-tx-box:empty { display: none; }

.call-tx-status {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    font-size: 15px;
    color: rgb(var(--ink));
    margin-bottom: 10px;
}

.call-tx-spinner {
    display: inline-block;
    width: 14px;
    height: 14px;
    border: 2px solid rgb(var(--border));
    border-top-color: rgb(var(--brand));
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    flex: none;
}

@media (prefers-reduced-motion: reduce) {
    .call-tx-spinner, .call-loading::before { animation-duration: 3s; }
}

.call-dialog-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    padding: 10px 16px;
    font-size: 13px;
    border-bottom: 1px solid rgb(var(--border));
}

/* Диалог из «Сборки диалога» внутри карточки звонка: рамку даёт сама карточка */
.call-dialog {
    border: none;
    border-radius: 0;
    max-height: 60vh;
}

.call-dialog-foot {
    margin: 0;
    padding: 8px 16px 12px;
    border-top: 1px solid rgb(var(--border));
}
