/* ==========================================================================
   1. ЦЕНТРАЛЬНЫЙ БЛОК (ДИАЛЕР)
   ========================================================================== */
.phone-core {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: space-between;
    padding: 20px;
    background: transparent;
    position: relative;
}

.dialer-wrap {
    width: 320px;
    margin: auto;
}

.dial-display {
    margin-bottom: 15px;
}

#phone {
    width: 100%;
    background: transparent;
    border: none;
    border-bottom: 2px solid rgba(255, 255, 255, 0.1);
    color: white;
    font-size: 28px;
    font-weight: 600;
    text-align: center;
    outline: none;
    letter-spacing: 2px;
    padding: 10px 5px;
    transition: font-size 0.15s ease-out;
}

.numpad {
    display: grid;
    grid-template-columns: repeat(3, 72px);
    gap: 12px;
    justify-content: center;
}

.numpad button {
    width: 72px;
    height: 72px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: white;
    font-size: 22px;
    cursor: pointer;
    transition: 0.2s;
}

.numpad button:hover {
    background: var(--accent-alt);
    transform: scale(1.08);
}

.btn-main-call {
    width: 100%;
    margin-top: 15px;
    background: linear-gradient(to right, var(--accent), #ba54f1);
    border: none;
    color: white;
    padding: 14px;
    border-radius: 12px;
    font-weight: bold;
    font-size: 16px;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(225, 78, 202, 0.3);
}

/* ==========================================================================
   2. НИЖНЯЯ ПАНЕЛЬ (ОПЕРАТОРЫ И СКРИПТЫ)
   ========================================================================== */
.bottom-info-area {
    width: 100%;
    display: flex !important;
    flex-direction: row !important;
    justify-content: space-between;
    gap: 30px;
    margin-top: 40px;
    padding-top: 20px;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
}

.info-block {
    flex: 1;
    min-width: 0;
}

.block-label {
    font-size: 14px;
    font-weight: 600;
    color: var(--accent) !important;
    margin-bottom: 15px;
    letter-spacing: 0.5px;
    text-transform: none !important;
}

.horizontal-grid {
    display: flex !important;
    gap: 15px;
    overflow-x: auto;
    padding-bottom: 10px;
}

.card.mini {
    min-width: 140px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.08);
    padding: 12px;
    border-radius: 12px;
}

/* ==========================================================================
   3. ВХОДЯЩИЙ ВЫЗОВ (OVERLAY)
   ========================================================================== */
.incoming-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(10, 10, 25, 0.85);
    backdrop-filter: blur(10px);
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.incoming-card {
    background: #1e1e2f;
    width: 400px;
    padding: 40px;
    border-radius: 24px;
    text-align: center;
    border: 1px solid rgba(225, 78, 202, 0.3);
}

.caller-avatar {
    width: 90px;
    height: 90px;
    background: var(--accent);
    margin: 0 auto 25px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: pulse-ring 1.5s infinite;
}

.caller-avatar img {
    width: 50%;
    height: auto;
}

@keyframes pulse-ring {
    0% {
        transform: scale(0.95);
        box-shadow: 0 0 0 0 rgba(225, 78, 202, 0.7);
    }

    70% {
        transform: scale(1);
        box-shadow: 0 0 0 20px rgba(225, 78, 202, 0);
    }

    100% {
        transform: scale(0.95);
        box-shadow: 0 0 0 0 rgba(225, 78, 202, 0);
    }
}

.incoming-status {
    color: #cfcfd8;
    opacity: 0.8;
    margin: 25px 0 45px 0 !important;
    display: block !important;
}

/* ==========================================================================
   4. ПЛАВАЮЩИЙ ВИДЖЕТ (АКТИВНЫЙ ВЫЗОВ)
   ========================================================================== */
#activeCallOverlay {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 450px;
    height: auto;
    min-width: 320px;
    max-height: 80vh;
    z-index: 9999;
    resize: both;
    overflow: hidden;
    background: #1e1e2f;
    border: 2px solid var(--accent);
    border-radius: 20px;
    box-shadow: 0 10px 50px rgba(0, 0, 0, 0.7);
    display: flex;
    flex-direction: column;
}

#activeCallOverlay::after {
    content: "";
    position: absolute;
    bottom: 5px;
    right: 5px;
    width: 15px;
    height: 15px;
    background-image: linear-gradient(135deg,
            transparent 50%,
            var(--accent) 50%, var(--accent) 60%,
            transparent 60%, transparent 70%,
            var(--accent) 70%, var(--accent) 80%,
            transparent 80%);
    opacity: 0.7;
    pointer-events: none;
}

.active-call-content {
    display: flex;
    flex-direction: column;
    padding: 20px;
    box-sizing: border-box;
}

.call-header {
    cursor: move;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-bottom: 12px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    margin-bottom: 15px;
    flex-shrink: 0;
}

#activeCallNumber {
    font-size: 18px;
    font-weight: 700;
    color: #fff;
}

#callTimer {
    font-size: 18px;
    color: var(--success);
    font-family: monospace;
}

/* Секция данных контакта */
#callerContactInfo {
    margin-bottom: 15px;
}

#callerOrg {
    font-size: 12px;
    color: var(--accent);
    font-weight: 700;
    margin-bottom: 10px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Кнопка действия (Email) */
.btn-mini-action {
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, rgba(225, 78, 202, 0.2) 0%, rgba(186, 84, 241, 0.2) 100%);
    border: 1px solid var(--accent);
    color: white;
    padding: 8px 16px;
    border-radius: 10px;
    cursor: pointer;
    font-size: 12px;
    font-weight: 600;
    transition: all 0.2s ease;
    width: fit-content;
    margin: 10px 0 15px 0;
}

.btn-mini-action:hover {
    background: var(--accent);
    box-shadow: 0 0 15px rgba(225, 78, 202, 0.4);
    transform: translateY(-1px);
}

.btn-mini-action svg {
    margin-right: 8px;
    flex-shrink: 0;
}

/* Скролл-зона с деталями (Предпочтения, Коммент, Скрипт) */
.call-details-scroll {
    flex: 1;
    overflow-y: auto;
    padding-right: 8px;
}

.info-sub-block {
    margin-bottom: 15px;
    transition: all 0.3s ease;
}

.info-sub-block .block-label {
    font-size: 10px;
    font-weight: 700;
    margin-bottom: 6px;
    opacity: 0.7;
    display: block;
}

.detail-text {
    color: #e4e4e9;
    font-size: 13px;
    line-height: 1.5;
    background: rgba(255, 255, 255, 0.04);
    padding: 10px 12px;
    border-radius: 8px;
    border-left: 3px solid var(--accent);
    word-break: break-word;
    min-height: 20px;
}

/* Скроллбар */
.call-details-scroll::-webkit-scrollbar {
    width: 4px;
}

.call-details-scroll::-webkit-scrollbar-thumb {
    background: var(--accent);
    border-radius: 10px;
}

/* Скрытые элементы */
.hidden,
#callerContactInfo.hidden {
    display: none !important;
}

/* Мигающие точки для статуса "Звоню..." */
.dots::after {
    content: '...';
    display: inline-block;
    width: 20px;
    text-align: left;
    animation: dots-blink 1.5s steps(4, end) infinite;
}

@keyframes dots-blink {

    0%,
    20% {
        content: '';
    }

    40% {
        content: '.';
    }

    60% {
        content: '..';
    }

    80%,
    100% {
        content: '...';
    }
}

/* Анимация вспышки при смене статуса (ЗАВЕРШЕНО/ЗАНЯТО) */
.btn-status-active {
    animation: status-flash 0.5s ease-in-out;
}

@keyframes status-flash {
    0% {
        background: var(--accent);
    }

    50% {
        background: #fff;
        color: #000;
    }

    100% {
        background: var(--accent);
    }
}

.btn-control {
    padding: 10px 5px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    color: white;
    cursor: pointer;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    transition: 0.2s;
}

.btn-control:hover {
    background: rgba(255, 255, 255, 0.1);
}

.btn-control.active-hold {
    background: var(--accent-alt) !important;
    /* Синий цвет при удержании */
    box-shadow: 0 0 15px rgba(29, 140, 248, 0.4);
    border-color: var(--accent-alt);
}

.btn-danger-alt {
    background: rgba(253, 93, 147, 0.1);
    border: 1px solid rgba(253, 93, 147, 0.3);
    color: var(--danger);
}

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

.robot-callback-alert {
    position: fixed;
    right: 24px;
    bottom: 24px;
    z-index: 9999;
    display: flex;
    align-items: center;
    gap: 12px;
    background: rgba(20, 20, 30, 0.96);
    border: 1px solid #ffcc00;
    border-radius: 16px;
    padding: 14px 16px;
    color: #fff;
    box-shadow: 0 0 28px rgba(255, 204, 0, 0.35);
    animation: robotBlink 0.8s infinite;
}

.robot-callback-alert.hidden {
    display: none;
}

.robot-callback-icon {
    font-size: 28px;
}

.robot-callback-title {
    font-size: 11px;
    text-transform: uppercase;
    color: #ffcc00;
    font-weight: 800;
}

.robot-callback-phone {
    font-size: 16px;
    font-weight: 700;
}

.robot-callback-btn {
    border: none;
    border-radius: 10px;
    padding: 9px 12px;
    cursor: pointer;
    font-weight: 800;
    background: #00f2c3;
    color: #07110f;
}

.robot-callback-close {
    border: none;
    background: transparent;
    color: #fff;
    font-size: 24px;
    cursor: pointer;
}

@keyframes robotBlink {

    0%,
    100% {
        box-shadow: 0 0 14px rgba(255, 204, 0, 0.25);
        transform: scale(1);
    }

    50% {
        box-shadow: 0 0 34px rgba(255, 204, 0, 0.75);
        transform: scale(1.02);
    }
}

.bitrix-call-links {
    margin-top: 14px;
    padding: 12px;
    border-radius: 14px;
    background: rgba(45, 156, 219, 0.13);
    border: 1px solid rgba(0, 242, 195, 0.35);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.22);
    color: #fff;
    width: 100%;
    box-sizing: border-box;
}

.bitrix-call-head {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 10px;
    color: #8fd8ff;
    font-size: 11px;
    font-weight: 900;
    text-transform: uppercase;
}

.bitrix-call-icon {
    background: #2d9cdb;
    color: #fff;
    border-radius: 999px;
    padding: 4px 8px;
    font-size: 10px;
    font-weight: 900;
}

.bitrix-call-body {
    display: flex;
    flex-direction: column;
    gap: 8px;
    font-size: 12px;
}

.bitrix-section-title {
    color: #00f2c3;
    font-weight: 900;
    font-size: 11px;
    text-transform: uppercase;
}

.bitrix-item {
    display: block;
    padding: 10px 12px;
    border-radius: 12px;
    text-decoration: none;
    color: #fff;
    background: rgba(255, 255, 255, 0.07);
    border: 1px solid rgba(255, 255, 255, 0.12);
}

.bitrix-item:hover {
    background: rgba(45, 156, 219, 0.22);
    border-color: rgba(0, 242, 195, 0.45);
}

.bitrix-item-id {
    display: block;
    font-weight: 900;
    color: #00f2c3;
}

.bitrix-item-title {
    display: block;
    font-weight: 700;
    line-height: 1.3;
}

.bitrix-item-meta {
    display: block;
    font-size: 10px;
    opacity: 0.6;
    margin-top: 3px;
}

.bitrix-empty {
    padding: 10px 12px;
    border-radius: 12px;
    color: rgba(255, 255, 255, 0.75);
    background: rgba(255, 255, 255, 0.06);
    font-size: 12px;
    font-weight: 700;
}

.bitrix-empty.error {
    color: #fd5d93;
}