/* ============================================================
   ULTRA-LUXE WEBRTC AUDIO & VIDEO CALL SYSTEM STYLES
   Frontend Design: High-Fidelity Glassmorphism, Ambient Aura,
   Dynamic Soundwaves & Responsive Ergonomics
   ============================================================ */

:root {
    --call-bg: #06080e;
    --call-card-bg: rgba(15, 19, 32, 0.82);
    --call-card-border: rgba(255, 255, 255, 0.12);
    --call-card-border-glow: rgba(56, 189, 248, 0.3);
    --call-dock-bg: rgba(14, 18, 30, 0.88);
    
    /* Vibrant curated accents */
    --call-accent-green: #10b981;
    --call-accent-green-glow: rgba(16, 185, 129, 0.45);
    --call-accent-red: #f43f5e;
    --call-accent-red-glow: rgba(244, 63, 94, 0.5);
    --call-accent-cyan: #38bdf8;
    --call-accent-cyan-glow: rgba(56, 189, 248, 0.35);
    --call-accent-gold: #f59e0b;
    --call-accent-purple: #a855f7;

    --call-text-primary: #f8fafc;
    --call-text-muted: #94a3b8;
    --call-text-subtle: #64748b;
}

/* ------------------------------------------------------------
   1. GLOBAL INCOMING CALL MODAL & AMBIENT AURA
   ------------------------------------------------------------ */
.incoming-call-backdrop {
    position: fixed;
    inset: 0;
    z-index: 999999;
    background: rgba(3, 5, 10, 0.88);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px 16px;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.4s cubic-bezier(0.16, 1, 0.3, 1), visibility 0.4s;
    overflow: hidden;
}

.incoming-call-backdrop.is-active {
    opacity: 1;
    visibility: visible;
}

.incoming-call-ambient-glow {
    position: absolute;
    inset: 0;
    pointer-events: none;
    overflow: hidden;
    z-index: 0;
}

.call-ambient-orb {
    position: absolute;
    border-radius: 50%;
    filter: blur(80px);
    opacity: 0.35;
    animation: orbFloat 12s ease-in-out infinite alternate;
}

.call-orb-1 {
    width: 320px;
    height: 320px;
    top: 20%;
    left: 20%;
    background: radial-gradient(circle, #38bdf8 0%, transparent 70%);
}

.call-orb-2 {
    width: 360px;
    height: 360px;
    bottom: 15%;
    right: 20%;
    background: radial-gradient(circle, #10b981 0%, transparent 70%);
    animation-delay: -6s;
}

@keyframes orbFloat {
    0% { transform: translate(0, 0) scale(1); }
    50% { transform: translate(40px, -30px) scale(1.15); }
    100% { transform: translate(-30px, 40px) scale(0.95); }
}

.incoming-call-card {
    position: relative;
    z-index: 2;
    width: 100%;
    max-width: 400px;
    background: var(--call-card-bg);
    border: 1px solid var(--call-card-border);
    border-radius: 32px;
    padding: 38px 24px 30px;
    text-align: center;
    box-shadow: 0 30px 60px -12px rgba(0, 0, 0, 0.75), 0 0 50px rgba(16, 185, 129, 0.12);
    transform: scale(0.9) translateY(24px);
    transition: transform 0.45s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.4s;
    overflow: hidden;
}

.incoming-call-backdrop.is-active .incoming-call-card {
    transform: scale(1) translateY(0);
}

.incoming-call-shimmer-border {
    position: absolute;
    inset: 0;
    border-radius: 32px;
    padding: 1px;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.25) 0%, transparent 40%, rgba(56, 189, 248, 0.3) 100%);
    -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
    mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
    -webkit-mask-composite: xor;
    mask-composite: exclude;
    pointer-events: none;
}

/* Pulsing Avatar */
.incoming-call-avatar-wrap {
    position: relative;
    width: 108px;
    height: 108px;
    margin: 0 auto 22px;
}

.incoming-avatar-inner {
    position: relative;
    z-index: 3;
    width: 108px;
    height: 108px;
    border-radius: 50%;
    border: 3px solid rgba(255, 255, 255, 0.2);
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.5), 0 0 30px rgba(56, 189, 248, 0.25);
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
}

.incoming-avatar-inner .call-avatar-img,
.incoming-avatar-inner .avatar-img,
.incoming-avatar-inner .avatar-letter {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
    font-size: 42px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
}

.incoming-call-pulse-ring {
    position: absolute;
    inset: -14px;
    border-radius: 50%;
    border: 2px solid var(--call-accent-green);
    opacity: 0;
    z-index: 1;
    animation: incomingPulse 2.2s cubic-bezier(0.22, 1, 0.36, 1) infinite;
}

.incoming-call-pulse-ring.ring-2 {
    animation-delay: 0.7s;
}

.incoming-call-pulse-ring.ring-3 {
    animation-delay: 1.4s;
}

@keyframes incomingPulse {
    0% { transform: scale(0.8); opacity: 0.9; }
    50% { opacity: 0.45; }
    100% { transform: scale(1.7); opacity: 0; }
}

.incoming-call-partner-tag {
    display: inline-block;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--call-accent-gold);
    margin-bottom: 4px;
}

.incoming-call-caller-name {
    font-size: 24px;
    font-weight: 800;
    color: var(--call-text-primary);
    margin: 0 0 8px;
    letter-spacing: -0.025em;
    text-shadow: 0 2px 10px rgba(0, 0, 0, 0.4);
}

.incoming-call-type-badge {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 7px 16px;
    border-radius: 9999px;
    font-size: 13px;
    font-weight: 600;
    background: rgba(56, 189, 248, 0.1);
    color: var(--call-accent-cyan);
    border: 1px solid rgba(56, 189, 248, 0.28);
    margin-bottom: 30px;
    box-shadow: 0 4px 15px rgba(56, 189, 248, 0.12);
}

.incoming-call-type-badge.is-video {
    background: rgba(168, 85, 247, 0.12);
    color: #c084fc;
    border-color: rgba(168, 85, 247, 0.35);
    box-shadow: 0 4px 15px rgba(168, 85, 247, 0.15);
}

.incoming-call-actions {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 40px;
}

.call-action-btn-group {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
}

.call-action-btn-label {
    font-size: 13px;
    font-weight: 600;
    color: var(--call-text-muted);
}

.call-btn-circle {
    width: 66px;
    height: 66px;
    border-radius: 50%;
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: transform 0.22s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.22s;
    outline: none;
}

.call-btn-circle:active {
    transform: scale(0.88);
}

.call-btn-accept {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    color: #ffffff;
    box-shadow: 0 10px 28px var(--call-accent-green-glow);
    animation: acceptShake 2.5s ease-in-out infinite;
}

.call-btn-accept:hover {
    transform: scale(1.1);
    box-shadow: 0 14px 36px var(--call-accent-green-glow);
}

@keyframes acceptShake {
    0%, 100% { transform: scale(1); }
    8%, 18% { transform: scale(1.08) rotate(-4deg); }
    13%, 23% { transform: scale(1.08) rotate(4deg); }
    28% { transform: scale(1); }
}

.call-btn-decline {
    background: linear-gradient(135deg, #f43f5e 0%, #e11d48 100%);
    color: #ffffff;
    box-shadow: 0 10px 28px var(--call-accent-red-glow);
}

.call-btn-decline:hover {
    transform: scale(1.1);
    box-shadow: 0 14px 36px var(--call-accent-red-glow);
}


/* ------------------------------------------------------------
   2. FULLSCREEN ACTIVE CALL STAGE & HERO AUDIO CARD
   ------------------------------------------------------------ */
.active-call-modal {
    position: fixed;
    inset: 0;
    z-index: 999998;
    background: var(--call-bg);
    display: flex;
    flex-direction: column;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.4s cubic-bezier(0.16, 1, 0.3, 1), visibility 0.4s;
    overflow: hidden;
    user-select: none;
}

.active-call-modal.is-active {
    opacity: 1;
    visibility: visible;
}

/* Ambient dynamic background */
.active-call-ambient-backdrop {
    position: absolute;
    inset: 0;
    pointer-events: none;
    overflow: hidden;
    z-index: 1;
}

.call-bg-orb {
    position: absolute;
    border-radius: 50%;
    filter: blur(100px);
    opacity: 0.22;
    animation: orbMotion 16s ease-in-out infinite alternate;
}

.call-bg-orb-left {
    width: 480px;
    height: 480px;
    top: -10%;
    left: -10%;
    background: radial-gradient(circle, #38bdf8 0%, transparent 70%);
}

.call-bg-orb-right {
    width: 520px;
    height: 520px;
    bottom: -10%;
    right: -10%;
    background: radial-gradient(circle, #10b981 0%, transparent 70%);
    animation-delay: -8s;
}

@keyframes orbMotion {
    0% { transform: scale(1) translate(0, 0); }
    50% { transform: scale(1.2) translate(50px, -40px); }
    100% { transform: scale(0.9) translate(-40px, 50px); }
}

.call-bg-radial-gradient {
    position: absolute;
    inset: 0;
    background: radial-gradient(circle at center, transparent 30%, rgba(6, 8, 14, 0.75) 90%);
}

/* Header */
.active-call-header {
    position: relative;
    z-index: 20;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 22px 28px;
    background: linear-gradient(180deg, rgba(6, 8, 14, 0.9) 0%, transparent 100%);
}

.active-call-header-info {
    display: flex;
    align-items: center;
    gap: 14px;
    flex-wrap: wrap;
}

.active-call-badge-wrap {
    display: flex;
    align-items: center;
    gap: 6px;
}

.active-call-type-tag {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    padding: 4px 9px;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.12);
    color: #f8fafc;
}

.active-call-hd-tag {
    font-size: 10px;
    font-weight: 800;
    letter-spacing: 0.05em;
    padding: 4px 7px;
    border-radius: 8px;
    background: rgba(16, 185, 129, 0.15);
    color: var(--call-accent-green);
    border: 1px solid rgba(16, 185, 129, 0.3);
}

.active-call-status-pill {
    display: flex;
    align-items: center;
    gap: 7px;
    font-size: 13px;
    font-weight: 600;
    color: var(--call-text-muted);
}

.active-call-live-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--call-accent-green);
    box-shadow: 0 0 12px var(--call-accent-green);
    animation: livePulse 1.8s infinite;
}

@keyframes livePulse {
    0%, 100% { transform: scale(1); opacity: 1; }
    50% { transform: scale(0.8); opacity: 0.45; }
}

.active-call-timer {
    font-family: 'JetBrains Mono', 'Fira Code', monospace;
    font-size: 15px;
    font-weight: 700;
    color: var(--call-accent-cyan);
    letter-spacing: 0.04em;
}

.active-call-hdr-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}

.active-call-hdr-btn {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid var(--call-card-border);
    color: var(--call-text-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
    outline: none;
}

.active-call-hdr-btn:hover {
    background: rgba(255, 255, 255, 0.16);
    transform: scale(1.06);
    border-color: rgba(255, 255, 255, 0.25);
}

/* Call Body */
.active-call-body {
    flex: 1;
    position: relative;
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

/* Audio Call Stage & Hero Glass Card */
.active-call-audio-stage {
    width: 100%;
    max-width: 440px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.active-call-audio-card {
    position: relative;
    width: 100%;
    background: rgba(18, 24, 40, 0.65);
    backdrop-filter: blur(28px);
    -webkit-backdrop-filter: blur(28px);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 36px;
    padding: 44px 28px 36px;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    box-shadow: 0 25px 60px -15px rgba(0, 0, 0, 0.8), 0 0 40px rgba(56, 189, 248, 0.08);
}

.active-call-avatar-container {
    position: relative;
    width: 136px;
    height: 136px;
    margin-bottom: 24px;
}

.active-call-avatar-glow-ring {
    position: absolute;
    inset: -14px;
    border-radius: 50%;
    border: 2px solid var(--call-accent-cyan);
    opacity: 0.3;
    pointer-events: none;
    transition: transform 0.3s ease, opacity 0.3s ease;
}

.active-call-avatar-glow-ring.ring-outer {
    inset: -28px;
    border-color: rgba(56, 189, 248, 0.2);
    animation: avatarBreathing 3s ease-in-out infinite alternate;
}

.active-call-avatar-glow-ring.ring-inner {
    animation: avatarBreathing 3s ease-in-out infinite alternate-reverse;
}

@keyframes avatarBreathing {
    0% { transform: scale(0.95); opacity: 0.2; }
    100% { transform: scale(1.08); opacity: 0.55; }
}

.active-call-avatar-big {
    position: relative;
    z-index: 5;
    width: 136px;
    height: 136px;
    border-radius: 50%;
    border: 3px solid rgba(255, 255, 255, 0.25);
    box-shadow: 0 16px 40px rgba(0, 0, 0, 0.6), 0 0 35px rgba(56, 189, 248, 0.3);
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
}

.active-call-avatar-big .call-avatar-img,
.active-call-avatar-big .avatar-img,
.active-call-avatar-big .avatar-letter {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
    font-size: 54px;
    font-weight: 800;
    display: flex;
    align-items: center;
    justify-content: center;
}

.active-call-details-wrap {
    margin-bottom: 20px;
}

.active-call-partner-name {
    font-size: 28px;
    font-weight: 800;
    color: var(--call-text-primary);
    margin: 0 0 6px;
    letter-spacing: -0.03em;
    text-shadow: 0 2px 12px rgba(0, 0, 0, 0.5);
}

.active-call-substatus {
    font-size: 14px;
    color: var(--call-text-muted);
    font-weight: 500;
    margin: 0;
}

/* Dynamic 14-Bar Audio Spectrum Equalizer */
.active-call-soundwaves {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    height: 38px;
    padding: 0 12px;
    margin-bottom: 24px;
}

.soundwave-bar {
    width: 4px;
    height: 6px;
    border-radius: 9999px;
    background: linear-gradient(180deg, var(--call-accent-cyan) 0%, var(--call-accent-green) 100%);
    transition: height 0.12s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.2s;
    opacity: 0.6;
}

.active-call-soundwaves.is-speaking .soundwave-bar {
    opacity: 1;
    animation: dynamicWave 1s ease-in-out infinite alternate;
    animation-delay: calc(var(--bar-idx) * 0.07s);
}

@keyframes dynamicWave {
    0% { height: 6px; }
    50% { height: 32px; }
    100% { height: 12px; }
}

/* Quick Reactions In Call (Clean transparent floating icons with no background pill/layer) */
.active-call-quick-reactions {
    display: flex;
    align-items: center;
    gap: 10px;
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
    padding: 0 !important;
    border-radius: 0 !important;
}

.call-quick-emoji-btn {
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
    font-size: 20px;
    cursor: pointer;
    padding: 2px 4px;
    border-radius: 0 !important;
    transition: transform 0.18s cubic-bezier(0.16, 1, 0.3, 1);
    outline: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.call-quick-emoji-btn .wa-emoji {
    width: 22px;
    height: 22px;
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
}

.call-quick-emoji-btn:hover {
    transform: scale(1.35) translateY(-3px);
}

.call-quick-emoji-btn:active {
    transform: scale(0.9);
}

/* Video Stage */
.active-call-video-stage {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    background: #000000;
    display: none;
}

.active-call-video-stage.is-visible {
    display: block;
}

.remote-video-element {
    width: 100%;
    height: 100%;
    object-fit: cover;
    background: #06080e;
}

.local-video-pip-container {
    position: absolute;
    top: 80px;
    right: 24px;
    width: 140px;
    height: 190px;
    border-radius: 22px;
    overflow: hidden;
    box-shadow: 0 16px 36px rgba(0, 0, 0, 0.7), 0 0 20px rgba(56, 189, 248, 0.2);
    border: 2px solid rgba(255, 255, 255, 0.25);
    background: #0f1422;
    z-index: 15;
    cursor: grab;
    touch-action: none;
    transition: transform 0.2s;
}

.local-video-pip-container:active {
    cursor: grabbing;
    transform: scale(1.03);
}

.local-video-element {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transform: scaleX(-1); /* Mirror local view */
}

/* Remote Camera-Off Overlay in Video Stage */
.video-camera-off-overlay {
    position: absolute;
    inset: 0;
    z-index: 8;
    background: radial-gradient(circle at center, #111827 0%, #06080e 100%);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 16px;
}

.camera-off-avatar-wrap {
    width: 96px;
    height: 96px;
    border-radius: 50%;
    border: 3px solid rgba(255, 255, 255, 0.15);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.6);
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
}

.camera-off-avatar-wrap .call-avatar-img,
.camera-off-avatar-wrap .avatar-img,
.camera-off-avatar-wrap .avatar-letter {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
    font-size: 38px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
}

.camera-off-label {
    font-size: 14px;
    font-weight: 600;
    color: var(--call-text-muted);
    letter-spacing: 0.02em;
}

/* Reconnecting Banner */
.active-call-reconnect-banner {
    position: absolute;
    top: calc(72px + env(safe-area-inset-top, 0px));
    left: 50%;
    transform: translateX(-50%);
    z-index: 30;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 18px;
    background: rgba(245, 158, 11, 0.22);
    border: 1px solid rgba(245, 158, 11, 0.45);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-radius: 9999px;
    color: #fbbf24;
    font-size: 13px;
    font-weight: 600;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5), 0 0 20px rgba(245, 158, 11, 0.2);
    animation: bannerPop 0.3s ease;
}

@keyframes bannerPop {
    from { opacity: 0; transform: translate(-50%, -10px); }
    to { opacity: 1; transform: translate(-50%, 0); }
}

.call-reconnect-spinner {
    width: 14px;
    height: 14px;
    border: 2px solid rgba(251, 191, 36, 0.3);
    border-top-color: #fbbf24;
    border-radius: 50%;
    animation: spinnerSpin 0.8s linear infinite;
}

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

/* Inline Permission / Error Alert */
.active-call-inline-alert {
    position: absolute;
    top: calc(80px + env(safe-area-inset-top, 0px));
    left: 20px;
    right: 20px;
    max-width: 480px;
    margin: 0 auto;
    z-index: 35;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 18px;
    background: rgba(244, 63, 94, 0.9);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 16px;
    color: #ffffff;
    font-size: 13px;
    font-weight: 600;
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.6);
    animation: bannerPop 0.3s ease;
}

.active-call-inline-alert svg {
    flex-shrink: 0;
}

.active-call-inline-alert span {
    flex: 1;
    line-height: 1.4;
}

.call-inline-alert-close {
    background: transparent;
    border: none;
    color: #ffffff;
    font-size: 20px;
    cursor: pointer;
    line-height: 1;
    padding: 0 4px;
    opacity: 0.8;
    transition: opacity 0.15s;
}

.call-inline-alert-close:hover {
    opacity: 1;
}

/* ------------------------------------------------------------
   3. BOTTOM FLOATING CONTROL DOCK
   ------------------------------------------------------------ */
.active-call-control-dock {
    position: relative;
    z-index: 25;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 20px;
    padding: 16px 32px calc(24px + env(safe-area-inset-bottom, 0px));
    margin: 0 auto;
    background: linear-gradient(0deg, rgba(6, 8, 14, 0.95) 0%, transparent 100%);
}

.call-control-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
}

.call-control-label {
    font-size: 11px;
    font-weight: 600;
    color: var(--call-text-muted);
}

.call-control-btn {
    width: 58px;
    height: 58px;
    border-radius: 50%;
    border: 1px solid var(--call-card-border);
    background: var(--call-dock-bg);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    color: var(--call-text-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.22s cubic-bezier(0.16, 1, 0.3, 1);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
    outline: none;
    -webkit-tap-highlight-color: transparent;
}

.call-control-btn:hover {
    background: rgba(255, 255, 255, 0.16);
    border-color: rgba(255, 255, 255, 0.28);
    transform: translateY(-3px) scale(1.06);
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.5);
}

.call-control-btn:active {
    transform: translateY(0) scale(0.92);
}

.call-control-btn.is-disabled-state {
    background: rgba(244, 63, 94, 0.18);
    color: var(--call-accent-red);
    border-color: rgba(244, 63, 94, 0.45);
    box-shadow: 0 8px 24px var(--call-accent-red-glow);
}

.call-control-btn.btn-end-call {
    width: 64px;
    height: 64px;
    background: linear-gradient(135deg, #f43f5e 0%, #e11d48 100%);
    color: #ffffff;
    border: none;
    box-shadow: 0 10px 30px var(--call-accent-red-glow);
}

.call-control-btn.btn-end-call:hover {
    background: linear-gradient(135deg, #fb7185 0%, #f43f5e 100%);
    transform: translateY(-4px) scale(1.08);
    box-shadow: 0 14px 40px var(--call-accent-red-glow);
}


/* ------------------------------------------------------------
   4. MINIMIZED FLOATING CALL PILL WIDGET
   ------------------------------------------------------------ */
.minimized-call-pill {
    position: fixed;
    bottom: calc(24px + env(safe-area-inset-bottom, 0px));
    left: calc(24px + env(safe-area-inset-left, 0px));
    z-index: 999990;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 16px 8px 8px;
    background: rgba(14, 18, 30, 0.94);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(56, 189, 248, 0.4);
    border-radius: 9999px;
    box-shadow: 0 14px 36px rgba(0, 0, 0, 0.6), 0 0 25px rgba(56, 189, 248, 0.25);
    cursor: pointer;
    transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.25s;
    animation: pillPop 0.35s ease;
    -webkit-tap-highlight-color: transparent;
}

@keyframes pillPop {
    from { transform: translateY(40px) scale(0.9); opacity: 0; }
    to { transform: translateY(0) scale(1); opacity: 1; }
}

.minimized-call-pill:hover {
    transform: translateY(-3px) scale(1.03);
    box-shadow: 0 18px 45px rgba(0, 0, 0, 0.7), 0 0 35px rgba(56, 189, 248, 0.35);
}

.minimized-call-avatar {
    position: relative;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: 2px solid rgba(56, 189, 248, 0.5);
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
}

.minimized-call-avatar .call-avatar-img,
.minimized-call-avatar .avatar-img,
.minimized-call-avatar .avatar-letter {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
    font-size: 14px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
}

.minimized-call-live-dot {
    position: absolute;
    bottom: 0;
    right: 0;
    width: 9px;
    height: 9px;
    border-radius: 50%;
    background: var(--call-accent-green);
    border: 2px solid #0e121e;
}

.minimized-call-info {
    display: flex;
    flex-direction: column;
}

.minimized-call-name {
    font-size: 12px;
    font-weight: 700;
    color: var(--call-text-primary);
    line-height: 1.2;
}

.minimized-call-status-row {
    display: flex;
    align-items: center;
    gap: 6px;
}

.minimized-call-timer {
    font-size: 11px;
    font-family: 'JetBrains Mono', monospace;
    color: var(--call-accent-cyan);
    font-weight: 700;
}

.minimized-audio-mini-wave {
    display: flex;
    align-items: center;
    gap: 2px;
    height: 10px;
}

.minimized-audio-mini-wave span {
    width: 2px;
    height: 4px;
    background: var(--call-accent-green);
    border-radius: 1px;
    animation: miniWave 0.8s ease-in-out infinite alternate;
}

.minimized-audio-mini-wave span:nth-child(2) { animation-delay: 0.25s; }
.minimized-audio-mini-wave span:nth-child(3) { animation-delay: 0.5s; }

@keyframes miniWave {
    from { height: 3px; }
    to { height: 10px; }
}

.minimized-call-quick-end {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    border: none;
    background: rgba(244, 63, 94, 0.2);
    color: var(--call-accent-red);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    margin-left: 2px;
    transition: all 0.18s;
}

.minimized-call-quick-end:hover {
    background: var(--call-accent-red);
    color: #ffffff;
    transform: scale(1.1);
}


/* ------------------------------------------------------------
   5. CHAT HEADER CALL ACTION BUTTONS & CHAT HISTORY BUBBLES
   ------------------------------------------------------------ */
.msg-hdr-call-btn {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--call-card-border);
    color: var(--call-text-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.22s cubic-bezier(0.16, 1, 0.3, 1);
    outline: none;
}

.msg-hdr-call-btn:hover {
    background: rgba(16, 185, 129, 0.18);
    color: var(--call-accent-green);
    border-color: rgba(16, 185, 129, 0.4);
    transform: translateY(-2px) scale(1.08);
    box-shadow: 0 4px 15px rgba(16, 185, 129, 0.25);
}

.msg-hdr-call-btn.btn-video-call:hover {
    background: rgba(56, 189, 248, 0.18);
    color: var(--call-accent-cyan);
    border-color: rgba(56, 189, 248, 0.4);
    box-shadow: 0 4px 15px rgba(56, 189, 248, 0.25);
}

/* ============================================================
   CHAT STREAM CALL EVENT CARDS (Luxury Glassmorphic Design)
   ============================================================ */

.msg-row-call-event {
    margin: 6px 0;
    max-width: 100%;
}

.msg-row-call-event .msg-bubble {
    background: transparent !important;
    border: none !important;
    padding: 0 !important;
    box-shadow: none !important;
    overflow: visible;
}

.msg-row-call-event .msg-bubble-wrap {
    max-width: 100%;
}

.msg-call-meta-bottom {
    margin-top: 4px;
    padding: 0 4px;
    font-size: 11px;
}

.msg-call-event-card {
    position: relative;
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 13px 18px;
    min-width: 290px;
    max-width: 390px;
    background: rgba(13, 16, 28, 0.82);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 20px;
    box-shadow: 0 10px 32px rgba(0, 0, 0, 0.45);
    overflow: hidden;
    transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1),
                box-shadow 0.25s ease,
                border-color 0.25s ease;
}

.msg-call-event-card:hover {
    transform: translateY(-2px);
    background: rgba(16, 20, 36, 0.92);
}

/* Glow Top Edge Accent */
.msg-call-glow-edge {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 1.5px;
    opacity: 0.85;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
}

/* Status-Specific Theme Variants */
.msg-call-event-card.call-status-completed {
    border-color: rgba(16, 185, 129, 0.3);
    box-shadow: 0 10px 32px rgba(0, 0, 0, 0.45), 0 0 24px rgba(16, 185, 129, 0.08);
}
.msg-call-event-card.call-status-completed .msg-call-glow-edge {
    background: linear-gradient(90deg, transparent, #10b981 30%, #06b6d4 70%, transparent);
}
.msg-call-event-card.call-status-completed:hover {
    border-color: rgba(16, 185, 129, 0.55);
    box-shadow: 0 14px 38px rgba(0, 0, 0, 0.55), 0 0 32px rgba(16, 185, 129, 0.2);
}

.msg-call-event-card.call-status-missed {
    border-color: rgba(244, 63, 94, 0.35);
    box-shadow: 0 10px 32px rgba(0, 0, 0, 0.45), 0 0 24px rgba(244, 63, 94, 0.12);
}
.msg-call-event-card.call-status-missed .msg-call-glow-edge {
    background: linear-gradient(90deg, transparent, #f43f5e 30%, #fb7185 70%, transparent);
}
.msg-call-event-card.call-status-missed:hover {
    border-color: rgba(244, 63, 94, 0.6);
    box-shadow: 0 14px 38px rgba(0, 0, 0, 0.55), 0 0 34px rgba(244, 63, 94, 0.24);
}

.msg-call-event-card.call-status-rejected {
    border-color: rgba(245, 158, 11, 0.3);
    box-shadow: 0 10px 32px rgba(0, 0, 0, 0.45), 0 0 20px rgba(245, 158, 11, 0.08);
}
.msg-call-event-card.call-status-rejected .msg-call-glow-edge {
    background: linear-gradient(90deg, transparent, #f59e0b 30%, #fbbf24 70%, transparent);
}
.msg-call-event-card.call-status-rejected:hover {
    border-color: rgba(245, 158, 11, 0.55);
    box-shadow: 0 14px 38px rgba(0, 0, 0, 0.55), 0 0 28px rgba(245, 158, 11, 0.18);
}

.msg-call-event-card.call-status-cancelled {
    border-color: rgba(148, 163, 184, 0.24);
    box-shadow: 0 10px 28px rgba(0, 0, 0, 0.4);
}
.msg-call-event-card.call-status-cancelled .msg-call-glow-edge {
    background: linear-gradient(90deg, transparent, #94a3b8 30%, #cbd5e1 70%, transparent);
}

/* Icon Container & Badge */
.msg-call-icon-container {
    position: relative;
    width: 44px;
    height: 44px;
    flex-shrink: 0;
}

.msg-call-icon-inner {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s ease;
}

.msg-call-event-card:hover .msg-call-icon-inner {
    transform: scale(1.08);
}

.call-status-completed .msg-call-icon-inner {
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.22) 0%, rgba(6, 182, 212, 0.16) 100%);
    color: #34d399;
    border: 1px solid rgba(16, 185, 129, 0.42);
    box-shadow: 0 0 16px rgba(16, 185, 129, 0.25);
}

.call-status-missed .msg-call-icon-inner {
    background: linear-gradient(135deg, rgba(244, 63, 94, 0.24) 0%, rgba(225, 29, 72, 0.18) 100%);
    color: #fb7185;
    border: 1px solid rgba(244, 63, 94, 0.48);
    box-shadow: 0 0 18px rgba(244, 63, 94, 0.3);
}

.call-status-rejected .msg-call-icon-inner {
    background: linear-gradient(135deg, rgba(245, 158, 11, 0.22) 0%, rgba(217, 119, 6, 0.16) 100%);
    color: #fbbf24;
    border: 1px solid rgba(245, 158, 11, 0.4);
    box-shadow: 0 0 14px rgba(245, 158, 11, 0.2);
}

.call-status-cancelled .msg-call-icon-inner {
    background: linear-gradient(135deg, rgba(148, 163, 184, 0.18) 0%, rgba(100, 116, 139, 0.12) 100%);
    color: #cbd5e1;
    border: 1px solid rgba(148, 163, 184, 0.32);
}

/* Missed Call Animated Pulse Ring */
.msg-call-pulse-ring {
    position: absolute;
    inset: -3px;
    border-radius: 50%;
    border: 1.5px solid rgba(244, 63, 94, 0.6);
    animation: msgCallPulseRingAnim 2.2s infinite cubic-bezier(0.2, 0.8, 0.4, 1);
    pointer-events: none;
}

@keyframes msgCallPulseRingAnim {
    0% { transform: scale(0.96); opacity: 0.9; }
    100% { transform: scale(1.42); opacity: 0; }
}

/* Direction Badge Indicator */
.msg-call-dir-badge {
    position: absolute;
    bottom: -2px;
    right: -2px;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #0a0d18;
    border: 1.5px solid #1a2034;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.6);
    z-index: 2;
}

.msg-call-dir-badge.dir-outgoing,
.msg-call-dir-badge.dir-incoming {
    color: #34d399;
}

.msg-call-dir-badge.dir-missed,
.msg-call-dir-badge.dir-missed-out {
    color: #f43f5e;
}

.msg-call-dir-badge.dir-rejected {
    color: #f59e0b;
}

.msg-call-dir-badge.dir-cancelled {
    color: #94a3b8;
}

/* Call Info Typography */
.msg-call-info {
    flex: 1;
    min-width: 0;
}

.msg-call-headline {
    display: flex;
    align-items: center;
    gap: 7px;
    flex-wrap: wrap;
    margin-bottom: 2px;
}

.msg-call-title {
    font-size: 13.5px;
    font-weight: 700;
    color: #f1f5f9;
    letter-spacing: -0.2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.msg-call-status-badge {
    font-size: 9.5px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    padding: 1.5px 6.5px;
    border-radius: 5px;
    line-height: 1.2;
}

.msg-call-status-badge.call-status-completed {
    background: rgba(16, 185, 129, 0.16);
    color: #34d399;
    border: 1px solid rgba(16, 185, 129, 0.32);
}

.msg-call-status-badge.call-status-missed {
    background: rgba(244, 63, 94, 0.18);
    color: #fb7185;
    border: 1px solid rgba(244, 63, 94, 0.36);
}

.msg-call-status-badge.call-status-rejected {
    background: rgba(245, 158, 11, 0.16);
    color: #fbbf24;
    border: 1px solid rgba(245, 158, 11, 0.32);
}

.msg-call-status-badge.call-status-cancelled {
    background: rgba(148, 163, 184, 0.14);
    color: #94a3b8;
    border: 1px solid rgba(148, 163, 184, 0.25);
}

.msg-call-meta-line {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 11.5px;
    color: #94a3b8;
    line-height: 1.3;
}

.msg-call-subtitle {
    color: #94a3b8;
}

.msg-call-time-dot {
    opacity: 0.4;
}

.msg-call-time-chip {
    font-size: 10.5px;
    opacity: 0.75;
}

/* Call Back Action Pill */
.msg-call-actions {
    flex-shrink: 0;
}

.msg-call-action-pill {
    padding: 6.5px 12px;
    border-radius: 11px;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.2px;
    background: linear-gradient(135deg, rgba(56, 189, 248, 0.14) 0%, rgba(14, 165, 233, 0.08) 100%);
    border: 1px solid rgba(56, 189, 248, 0.36);
    color: #38bdf8;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    transition: all 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25);
    white-space: nowrap;
}

.msg-call-action-pill:hover {
    background: linear-gradient(135deg, #0ea5e9 0%, #0284c7 100%);
    color: #ffffff;
    border-color: #38bdf8;
    transform: translateY(-1.5px) scale(1.05);
    box-shadow: 0 6px 18px rgba(14, 165, 233, 0.4);
}

.msg-call-action-pill:active {
    transform: scale(0.95);
}


/* ------------------------------------------------------------
   6. RESPONSIVE OPTIMIZATIONS ACROSS ALL MOBILE VIEWPORTS
   ------------------------------------------------------------ */

/* Tablet & Large Mobile (<= 600px) */
@media (max-width: 600px) {
    .incoming-call-card {
        padding: 30px 20px 26px;
        border-radius: 28px;
        max-width: 92vw;
    }

    .incoming-call-avatar-wrap,
    .incoming-avatar-inner {
        width: 90px;
        height: 90px;
    }

    .call-btn-circle {
        width: 60px;
        height: 60px;
        min-width: 48px;
        min-height: 48px;
    }

    .active-call-header {
        padding: calc(14px + env(safe-area-inset-top, 0px)) 16px 14px;
    }

    .active-call-audio-card {
        padding: 28px 18px 24px;
        border-radius: 28px;
        max-width: 92vw;
    }

    .active-call-avatar-container,
    .active-call-avatar-big {
        width: 108px;
        height: 108px;
    }

    .active-call-partner-name {
        font-size: 24px;
    }

    .active-call-control-dock {
        gap: 14px;
        padding: 12px 16px calc(18px + env(safe-area-inset-bottom, 0px));
    }

    .call-control-btn {
        width: 52px;
        height: 52px;
        min-width: 48px;
        min-height: 48px;
    }

    .call-control-btn.btn-end-call {
        width: 58px;
        height: 58px;
        min-width: 52px;
        min-height: 52px;
    }

    .local-video-pip-container {
        width: 104px;
        height: 145px;
        top: calc(64px + env(safe-area-inset-top, 0px));
        right: 14px;
        border-radius: 18px;
    }

    .minimized-call-pill {
        bottom: calc(16px + env(safe-area-inset-bottom, 0px));
        left: calc(16px + env(safe-area-inset-left, 0px));
    }

    .msg-call-event-card {
        min-width: 0;
        width: 100%;
        max-width: 100%;
        padding: 11px 14px;
        gap: 10px;
    }

    .msg-call-icon-container {
        width: 38px;
        height: 38px;
    }

    .msg-call-title {
        font-size: 12.5px;
    }

    .msg-call-action-pill {
        padding: 5px 10px;
        font-size: 10.5px;
    }
}

/* Standard Mobile (<= 412px - Pixel, Samsung Galaxy) */
@media (max-width: 412px) {
    .incoming-call-actions {
        gap: 28px;
    }

    .incoming-call-card {
        padding: 26px 16px 22px;
        border-radius: 24px;
    }

    .incoming-call-caller-name {
        font-size: 22px;
    }

    .active-call-audio-card {
        padding: 24px 16px 20px;
    }

    .active-call-avatar-container,
    .active-call-avatar-big {
        width: 96px;
        height: 96px;
    }

    .active-call-avatar-big .call-avatar-img,
    .active-call-avatar-big .avatar-img,
    .active-call-avatar-big .avatar-letter {
        font-size: 42px;
    }

    .active-call-partner-name {
        font-size: 22px;
    }

    .active-call-control-dock {
        gap: 10px;
        padding: 10px 12px calc(16px + env(safe-area-inset-bottom, 0px));
    }

    .call-control-btn {
        width: 48px;
        height: 48px;
    }

    .call-control-btn.btn-end-call {
        width: 54px;
        height: 54px;
    }

    .call-control-btn svg {
        width: 20px;
        height: 20px;
    }

    .active-call-soundwaves {
        gap: 3px;
        height: 32px;
    }

    .soundwave-bar {
        width: 3px;
    }

    .local-video-pip-container {
        width: 90px;
        height: 125px;
        top: calc(58px + env(safe-area-inset-top, 0px));
        right: 10px;
    }
}

/* Compact Mobile (<= 375px - iPhone SE, Small Android) */
@media (max-width: 375px) {
    .incoming-call-caller-name {
        font-size: 20px;
    }

    .incoming-call-actions {
        gap: 20px;
    }

    .call-btn-circle {
        width: 54px;
        height: 54px;
    }

    .active-call-control-dock {
        gap: 8px;
    }

    .call-control-btn {
        width: 48px;
        height: 48px;
    }

    .call-control-label {
        font-size: 10px;
    }

    .active-call-avatar-container,
    .active-call-avatar-big {
        width: 86px;
        height: 86px;
    }

    .active-call-quick-reactions {
        gap: 4px;
        padding: 4px 8px;
    }

    .call-quick-emoji-btn {
        font-size: 16px;
        padding: 2px 4px;
    }
}

/* Ultra Compact (<= 320px) */
@media (max-width: 320px) {
    .incoming-call-card {
        padding: 20px 12px 18px;
    }

    .active-call-audio-card {
        padding: 18px 12px 16px;
    }

    .active-call-partner-name {
        font-size: 18px;
    }

    .call-control-btn {
        width: 44px;
        height: 44px;
    }

    .call-control-btn.btn-end-call {
        width: 48px;
        height: 48px;
    }

    .local-video-pip-container {
        width: 78px;
        height: 108px;
    }
}

/* Landscape Mode on Mobile */
@media (max-height: 500px) and (orientation: landscape) {
    .active-call-modal {
        flex-direction: row;
    }

    .active-call-header {
        position: absolute;
        top: 0;
        left: 0;
        right: 0;
        padding: 8px 16px;
        background: rgba(6, 8, 14, 0.8);
    }

    .active-call-body {
        padding: 50px 10px 10px;
    }

    .active-call-audio-card {
        padding: 12px 20px;
        border-radius: 20px;
        max-height: 80vh;
    }

    .active-call-avatar-container,
    .active-call-avatar-big {
        width: 64px;
        height: 64px;
        margin-bottom: 8px;
    }

    .active-call-partner-name {
        font-size: 18px;
        margin-bottom: 2px;
    }

    .active-call-soundwaves {
        height: 24px;
        margin-bottom: 8px;
    }

    .active-call-control-dock {
        position: absolute;
        bottom: 0;
        left: 0;
        right: 0;
        padding: 6px 16px calc(6px + env(safe-area-inset-bottom, 0px));
        gap: 12px;
    }

    .call-control-btn {
        width: 42px;
        height: 42px;
    }

    .call-control-btn.btn-end-call {
        width: 46px;
        height: 46px;
    }

    .local-video-pip-container {
        width: 90px;
        height: 120px;
        top: 50px;
        right: 12px;
    }
}

/* ============================================================
   GLOBAL FLOATING CALL HUD TOAST
   ============================================================ */
.call-hud-toast {
    position: fixed;
    top: 24px;
    left: 50%;
    transform: translateX(-50%) translateY(-24px) scale(0.9);
    display: inline-flex;
    align-items: center;
    gap: 12px;
    padding: 10px 20px;
    background: rgba(13, 16, 28, 0.94);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 30px;
    box-shadow: 0 12px 36px rgba(0, 0, 0, 0.6), 0 0 24px rgba(56, 189, 248, 0.15);
    z-index: 10005;
    opacity: 0;
    pointer-events: none;
    transition: transform 0.35s cubic-bezier(0.34, 1.56, 0.64, 1),
                opacity 0.25s ease,
                box-shadow 0.25s ease;
}

.call-hud-toast.is-visible {
    transform: translateX(-50%) translateY(0) scale(1);
    opacity: 1;
    pointer-events: auto;
}

.call-hud-toast.call-hud-success {
    border-color: rgba(16, 185, 129, 0.45);
    box-shadow: 0 12px 36px rgba(0, 0, 0, 0.6), 0 0 24px rgba(16, 185, 129, 0.22);
}

.call-hud-toast.call-hud-danger {
    border-color: rgba(244, 63, 94, 0.45);
    box-shadow: 0 12px 36px rgba(0, 0, 0, 0.6), 0 0 24px rgba(244, 63, 94, 0.25);
}

.call-hud-toast.call-hud-info {
    border-color: rgba(56, 189, 248, 0.45);
    box-shadow: 0 12px 36px rgba(0, 0, 0, 0.6), 0 0 24px rgba(56, 189, 248, 0.22);
}

.call-hud-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.call-hud-text {
    display: flex;
    flex-direction: column;
    gap: 1px;
}

.call-hud-title {
    font-size: 13px;
    font-weight: 700;
    color: #f8fafc;
    letter-spacing: -0.2px;
}

.call-hud-subtitle {
    font-size: 11px;
    color: #94a3b8;
}


