/* ================================== */
/* МОДАЛЬНОЕ ОКНО ЗВОНКА (WebRTC)     */
/* ================================== */

.call-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--overlay-bg);
    backdrop-filter: blur(20px);
    z-index: var(--z-max);
    display: flex;
    align-items: center;
    justify-content: center;
    animation: fadeIn var(--animation-duration) ease;
}

.call-modal-container {
    position: relative;
    width: 100%;
    max-width: 800px;
    height: 100%;
    max-height: 600px;
    background: var(--call-modal-bg, #000);
    border-radius: var(--radius-xl);
    overflow: hidden;
    box-shadow: var(--shadow-2xl);
    display: flex;
    flex-direction: column;
}

/* Основное видео (удалённый участник) */
.call-remote-video {
    flex: 1;
    background: var(--call-remote-bg, #1a1a1a);
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
}

.remote-video {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.remote-avatar-placeholder {
    text-align: center;
    color: var(--call-text-color, white);
    position: relative;
    z-index: var(--z-base);
}

.remote-avatar-img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
    border: 3px solid var(--call-avatar-border, rgba(255, 255, 255, 0.5));
}

.remote-name {
    font-size: 24px;
    font-weight: 600;
    margin-bottom: var(--spacing-sm);
    text-shadow: var(--call-name-shadow, 0 1px 2px rgba(0, 0, 0, 0.5));
    color: var(--call-text-color, white);
}

.call-status-text {
    font-size: 18px;
    font-weight: 500;
    margin-top: var(--spacing-sm);
    opacity: 0.9;
    color: var(--call-text-color, white);
}

/* Индикация качества */
.connection-quality {
    margin-top: var(--spacing-lg);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--spacing-sm);
    background: var(--call-quality-bg, rgba(0, 0, 0, 0.5));
    backdrop-filter: blur(4px);
    padding: var(--spacing-sm) var(--spacing-md);
    border-radius: var(--radius-full);
    width: fit-content;
    margin-left: auto;
    margin-right: auto;
}

.quality-text {
    font-size: 12px;
    font-weight: 500;
    color: var(--call-text-color, white);
}

/* Анимация пульсации для входящего звонка */
.pulse-animation {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 140px;
    height: 140px;
    border-radius: 50%;
    background: transparent;
    box-shadow: 0 0 0 2px rgba(76, 154, 255, 0.8);
    animation: pulse-ring 2s ease-out infinite;
    pointer-events: none;
    z-index: 1;
}

@keyframes pulse-ring {
    0% {
        box-shadow: 0 0 0 2px rgba(76, 154, 255, 0.8), 0 0 0 4px rgba(76, 154, 255, 0.4);
        opacity: 1;
    }
    70% {
        box-shadow: 0 0 0 20px rgba(76, 154, 255, 0), 0 0 0 30px rgba(76, 154, 255, 0);
        opacity: 0;
    }
    100% {
        box-shadow: 0 0 0 0 rgba(76, 154, 255, 0), 0 0 0 0 rgba(76, 154, 255, 0);
        opacity: 0;
    }
}

/* Локальное видео (картинка в картинке) */
.call-local-video {
    position: absolute;
    bottom: 80px;
    right: 20px;
    width: 120px;
    height: 160px;
    border-radius: var(--radius-lg);
    overflow: hidden;
    border: 2px solid var(--call-local-border, rgba(255, 255, 255, 0.3));
    box-shadow: var(--shadow-md);
    z-index: var(--z-sticky);
    background: var(--call-local-bg, #000);
    cursor: pointer;
    transition: transform var(--transition);
}

.call-local-video:hover {
    transform: scale(1.02);
    border-color: var(--primary);
}

.local-video {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Панель управления */
.call-controls {
    display: flex;
    justify-content: center;
    gap: var(--spacing-xl);
    padding: var(--spacing-xl);
    background: var(--call-controls-bg, rgba(0, 0, 0, 0.6));
    backdrop-filter: blur(10px);
    border-top: 1px solid var(--call-controls-border, rgba(255, 255, 255, 0.1));
}

.call-btn {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    border: none;
    background: rgba(255, 255, 255, 0.2);
    color: white;
    font-size: 24px;
    cursor: pointer;
    transition: all var(--transition);
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.call-btn:hover {
    transform: scale(1.05);
    background: rgba(255, 255, 255, 0.3);
}

.call-btn.accept {
    background: var(--success);
}

.call-btn.accept:hover {
    background: var(--success-dark);
}

.call-btn.reject,
.call-btn.hangup {
    background: var(--danger);
}

.call-btn.reject:hover,
.call-btn.hangup:hover {
    background: var(--danger-dark);
}

.call-btn.active {
    background: var(--primary);
    box-shadow: 0 0 12px var(--primary-glow);
}

/* Статусные иконки (микрофон, видео) */
.remote-avatar-wrapper {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 120px;
    height: 120px;
}

.remote-status-icons {
    position: absolute;
    bottom: 5px;
    right: 5px;
    display: flex;
    gap: 5px;
    background: var(--call-status-bg, rgba(0, 0, 0, 0.6));
    border-radius: var(--radius-full);
    padding: 4px var(--spacing-sm);
}

.status-icon {
    color: white;
    font-size: 12px;
}

.status-icon.muted i {
    color: var(--danger);
}

.status-icon.video-off i {
    color: var(--warning);
}

/* ================================== */
/* СВЕТЛАЯ ТЕМА ДЛЯ КОМПОНЕНТА ЗВОНКА */
/* ================================== */
body.light-theme {
    --call-modal-bg: #ffffff;
    --call-remote-bg: #f0f2f5;
    --call-text-color: #1e2a3a;
    --call-avatar-border: rgba(0, 0, 0, 0.2);
    --call-name-shadow: none;
    --call-quality-bg: rgba(0, 0, 0, 0.08);
    --call-local-border: rgba(0, 0, 0, 0.2);
    --call-local-bg: #e0e0e0;
    --call-controls-bg: rgba(255, 255, 255, 0.8);
    --call-controls-border: rgba(0, 0, 0, 0.1);
    --call-status-bg: rgba(0, 0, 0, 0.1);
}

body.light-theme .call-btn {
    background: rgba(0, 0, 0, 0.1);
    color: #1e2a3a;
}

body.light-theme .call-btn:hover {
    background: var(--primary);
    color: white;
}

body.light-theme .remote-status-icons {
    background: rgba(0, 0, 0, 0.15);
}

body.light-theme .status-icon {
    color: #1e2a3a;
}

/* Адаптация для мобильных устройств */
@media (max-width: 768px) {
    .call-modal-container {
        max-width: 100%;
        max-height: 100%;
        border-radius: 0;
    }
    .call-local-video {
        width: 80px;
        height: 120px;
        bottom: 80px;
        right: 12px;
    }
    .call-btn {
        width: 48px;
        height: 48px;
        font-size: 20px;
    }
    .call-controls {
        gap: var(--spacing-lg);
        padding: var(--spacing-lg);
    }
    .remote-avatar-wrapper {
        width: 80px;
        height: 80px;
    }
    .remote-name {
        font-size: 18px;
    }
    .call-status-text {
        font-size: 14px;
    }
}

/* Уважение prefers-reduced-motion */
@media (prefers-reduced-motion: reduce) {
    .call-modal-overlay,
    .call-local-video,
    .call-btn,
    .pulse-animation {
        animation: none;
        transition: none;
    }
    .call-btn:hover,
    .call-local-video:hover {
        transform: none;
    }
    .pulse-animation {
        display: none;
    }
}