/* ===== CALL UI CSS ===== */
/* Call display, avatar, timer, actions */

/* Call Display */
.call-display {
    text-align: center;
    margin-bottom: 16px;
    position: relative;
    min-width: 280px;
}

/* Call Topbar - Signal left, Timer right */
.call-topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
    padding: 0 10px;
    min-height: 28px;
    visibility: hidden;
    /* Hidden by default, preserves space */
}

.call-topbar.active {
    visibility: visible;
}

.call-avatar {
    width: 80px;
    height: 80px;
    background: linear-gradient(135deg, var(--accent), #bf5af2);
    border-radius: 50%;
    margin: 0 auto 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 0 40px var(--accent-glow);
    position: relative;
    transition: all 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}



.call-avatar svg {
    width: 40px;
    height: 40px;
    color: white;
    z-index: 2;
    position: relative;
}

.call-avatar.searching {
    animation: ring 1.5s ease-out infinite;
}

.call-avatar.in-call::after {
    content: '';
    position: absolute;
    inset: -6px;
    border: 2px solid var(--accent);
    border-radius: 50%;
    animation: ring-pulse 2s ease-out infinite;
}

.call-avatar.in-call::before {
    content: '';
    position: absolute;
    inset: -8px;
    border-radius: 50%;
    background: radial-gradient(circle, transparent 60%, rgba(10, 132, 255, 0.1) 100%);
    animation: waveform-idle 3s ease-in-out infinite;
}

@keyframes waveform-idle {

    0%,
    100% {
        transform: scale(1);
        opacity: 0.5;
    }

    50% {
        transform: scale(1.1);
        opacity: 1;
    }
}

/* Voice Activity */
.call-avatar.speaking {
    box-shadow: 0 0 0 8px rgba(48, 209, 88, 0.3), 0 0 40px var(--accent-glow);
}

.call-avatar.speaking::before {
    background: radial-gradient(circle, transparent 60%, rgba(48, 209, 88, 0.2) 100%);
    animation: waveform-speaking 0.8s ease-in-out infinite;
}

@keyframes waveform-speaking {

    0%,
    100% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.15);
    }
}

/* State animations */
.call-avatar.state-idle {
    transform: scale(1);
    box-shadow: 0 0 30px rgba(10, 132, 255, 0.2);
}

.call-avatar.state-searching {
    transform: scale(1.05);
    animation: search-pulse 1.5s ease-in-out infinite;
}

.call-avatar.state-connected {
    transform: scale(1.1);
    box-shadow: 0 0 60px rgba(48, 209, 88, 0.4);
}

@keyframes search-pulse {

    0%,
    100% {
        transform: scale(1.05);
        opacity: 1;
    }

    50% {
        transform: scale(1.1);
        opacity: 0.8;
    }
}

/* Peer Muted Indicator */
.peer-muted {
    display: none;
    position: absolute;
    bottom: -4px;
    right: -4px;
    width: 28px;
    height: 28px;
    background: var(--danger);
    border-radius: 50%;
    align-items: center;
    justify-content: center;
    border: 2px solid var(--bg);
}

.peer-muted.visible {
    display: flex;
}

.peer-muted svg {
    width: 14px;
    height: 14px;
    color: white;
}

/* Call Timer - Always visible in topbar */
.call-timer {
    font-size: 18px;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
    letter-spacing: 0.5px;
    color: var(--text-secondary);
    padding: 4px 12px;
    background: var(--surface);
    border-radius: 12px;
    transition: all 0.3s ease;
}

.call-timer.active {
    color: var(--text);
    background: linear-gradient(135deg, rgba(10, 132, 255, 0.15), rgba(191, 90, 242, 0.15));
    border: 1px solid rgba(10, 132, 255, 0.3);
}

.call-status {
    font-size: 15px;
    font-weight: 500;
    margin-bottom: 2px;
    transition: opacity 0.3s ease, transform 0.3s ease;
}

.call-subtitle {
    font-size: 12px;
    color: var(--text-secondary);
    transition: opacity 0.3s ease, transform 0.3s ease;
}

/* Mood Badge */
.mood-badge {
    display: none;
    align-items: center;
    gap: 6px;
    padding: 4px 12px;
    background: var(--surface);
    border-radius: 12px;
    font-size: 12px;
    color: var(--text-secondary);
    margin-top: 10px;
}

.mood-badge.visible {
    display: inline-flex;
}

.mood-badge svg {
    width: 14px;
    height: 14px;
}

/* Mood Match Banner */
.mood-match-banner {
    display: none;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 12px 20px;
    background: linear-gradient(135deg, rgba(10, 132, 255, 0.15), rgba(191, 90, 242, 0.15));
    border: 1px solid rgba(10, 132, 255, 0.3);
    border-radius: 16px;
    margin-top: 16px;
    animation: mood-match-in 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.mood-match-banner.visible {
    display: flex;
}

.mood-match-banner svg {
    width: 20px;
    height: 20px;
    color: var(--accent);
}

.mood-match-banner span {
    font-size: 14px;
    font-weight: 500;
    background: linear-gradient(135deg, var(--accent), #bf5af2);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

@keyframes mood-match-in {
    0% {
        opacity: 0;
        transform: translateY(20px) scale(0.8);
    }

    100% {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* Voice Indicator */
.voice-indicator {
    display: none;
    align-items: center;
    gap: 6px;
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-top: 12px;
    transition: all 0.3s ease;
}

.voice-indicator.visible {
    display: inline-flex;
}

.voice-indicator.speaking {
    background: rgba(48, 209, 88, 0.15);
    color: var(--success);
    border: 1px solid rgba(48, 209, 88, 0.3);
}

.voice-indicator.listening {
    background: rgba(10, 132, 255, 0.15);
    color: var(--accent);
    border: 1px solid rgba(10, 132, 255, 0.3);
}

.voice-indicator svg {
    width: 12px;
    height: 12px;
}

/* Connection Bar - Always visible in topbar */
.connection-bar {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 11px;
    font-weight: 500;
    color: var(--text-tertiary);
    padding: 4px 10px;
    background: var(--surface);
    border-radius: 12px;
    transition: all 0.3s ease;
}

.connection-bar.active {
    color: var(--text-secondary);
}

.signal-bars {
    display: flex;
    gap: 2px;
    align-items: flex-end;
}

.signal-bar {
    width: 3px;
    background: var(--text-tertiary);
    border-radius: 1px;
    transition: background 0.3s ease;
}

.signal-bar:nth-child(1) {
    height: 5px;
}

.signal-bar:nth-child(2) {
    height: 9px;
}

.signal-bar:nth-child(3) {
    height: 13px;
}

.signal-bar:nth-child(4) {
    height: 17px;
}

.signal-bar.good {
    background: var(--success);
}

.signal-bar.fair {
    background: var(--warning);
}

.signal-bar.poor {
    background: var(--danger);
}

/* Action Area - Fixed Layout */
.action-area {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
}

/* Action Buttons Row: Mute | Call | Report */
.action-buttons {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 20px;
}

/* Side Action Buttons (Mute & Report) */
.action-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    width: 56px;
    height: 56px;
    border-radius: 16px;
    border: none;
    background: var(--surface);
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s ease;
}

.action-btn:hover:not(:disabled) {
    background: var(--bg-elevated);
    color: var(--text);
    transform: translateY(-2px);
}

.action-btn:active:not(:disabled) {
    transform: scale(0.95);
}

.action-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

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

.action-btn-label {
    font-size: 10px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

/* Mute Button Active State */
.action-btn.mute.active {
    background: var(--danger);
    color: white;
}

/* Report Button Hover */
.action-btn.report:hover:not(:disabled) {
    background: rgba(255, 159, 10, 0.15);
    color: var(--warning);
}

/* Main Action Button */
.main-action {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    box-shadow: 0 6px 24px rgba(0, 0, 0, 0.3);
}

.main-action svg {
    width: 24px;
    height: 24px;
    color: white;
}

.main-action.call {
    background: var(--success);
}

.main-action.call:hover {
    transform: scale(1.05);
    box-shadow: 0 0 30px rgba(48, 209, 88, 0.5);
}

.main-action.end {
    background: var(--danger);
}

.main-action.end:hover {
    transform: scale(1.05);
    box-shadow: 0 0 30px rgba(255, 69, 58, 0.5);
}

.main-action:active {
    transform: scale(0.95);
}

/* Searching State - Outer Spinning Ring */
.main-action.searching {
    background: var(--danger);
    position: relative;
}

.main-action.searching::before {
    content: '';
    position: absolute;
    inset: -4px;
    border-radius: 50%;
    border: 3px solid transparent;
    border-top-color: rgba(255, 255, 255, 0.9);
    border-right-color: rgba(255, 255, 255, 0.3);
    animation: ring-spin 1s linear infinite;
}

.main-action.searching::after {
    content: '';
    position: absolute;
    inset: -8px;
    border-radius: 50%;
    border: 2px solid transparent;
    border-top-color: rgba(255, 69, 58, 0.6);
    border-left-color: rgba(255, 69, 58, 0.2);
    animation: ring-spin 1.5s linear infinite reverse;
}

@keyframes ring-spin {
    from {
        transform: rotate(0deg);
    }

    to {
        transform: rotate(360deg);
    }
}

.action-label {
    font-size: 12px;
    color: var(--text-secondary);
}

/* Auto-reconnect Toggle */
.auto-row {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 11px;
    color: var(--text-tertiary);
}

.toggle {
    width: 40px;
    height: 24px;
    background: var(--surface);
    border-radius: 12px;
    position: relative;
    cursor: pointer;
    transition: background 0.2s;
}

.toggle.active {
    background: var(--success);
}

.toggle::after {
    content: '';
    position: absolute;
    top: 2px;
    left: 2px;
    width: 20px;
    height: 20px;
    background: white;
    border-radius: 50%;
    transition: left 0.2s;
}

.toggle.active::after {
    left: 18px;
}

/* Audio Badge */
.audio-badge {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    background: rgba(48, 209, 88, 0.15);
    border: 1px solid rgba(48, 209, 88, 0.3);
    border-radius: 12px;
    font-size: 11px;
    font-weight: 500;
    color: var(--success);
}

.audio-badge svg {
    width: 12px;
    height: 12px;
}

/* Confetti Container */
.confetti-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 9999;
    overflow: hidden;
}

.confetti {
    position: absolute;
    width: 10px;
    height: 10px;
    animation: confetti-fall 3s ease-out forwards;
}

@keyframes confetti-fall {
    0% {
        opacity: 1;
        transform: translateY(-100%) rotate(0deg);
    }

    100% {
        opacity: 0;
        transform: translateY(100vh) rotate(720deg);
    }
}

/* ===== E2EE ENCRYPTION BADGE ===== */
.encryption-badge {
    display: none;
    align-items: center;
    gap: 6px;
    padding: 6px 14px;
    background: linear-gradient(135deg, rgba(48, 209, 88, 0.12), rgba(48, 209, 88, 0.06));
    border: 1px solid rgba(48, 209, 88, 0.25);
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
    color: var(--success);
    margin-top: 12px;
    cursor: pointer;
    position: relative;
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    animation: encryption-fade-in 0.5s ease-out;
}

.encryption-badge.visible {
    display: inline-flex;
}

.encryption-badge:hover {
    background: linear-gradient(135deg, rgba(48, 209, 88, 0.2), rgba(48, 209, 88, 0.1));
    border-color: rgba(48, 209, 88, 0.4);
    transform: translateY(-2px);
    box-shadow: 0 4px 20px rgba(48, 209, 88, 0.2);
}

.encryption-badge svg {
    width: 14px;
    height: 14px;
}

/* Secure pulse animation */
.encryption-badge::before {
    content: '';
    position: absolute;
    inset: -2px;
    border-radius: 22px;
    background: linear-gradient(135deg, rgba(48, 209, 88, 0.3), transparent);
    opacity: 0;
    animation: encryption-pulse 3s ease-in-out infinite;
    pointer-events: none;
}

@keyframes encryption-fade-in {
    0% {
        opacity: 0;
        transform: scale(0.8) translateY(10px);
    }

    100% {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

@keyframes encryption-pulse {

    0%,
    100% {
        opacity: 0;
        transform: scale(1);
    }

    50% {
        opacity: 0.5;
        transform: scale(1.05);
    }
}

/* Encryption Tooltip */
.encryption-tooltip {
    position: absolute;
    bottom: calc(100% + 12px);
    left: 50%;
    transform: translateX(-50%) scale(0.9);
    min-width: 260px;
    padding: 16px;
    background: var(--bg-elevated);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(48, 209, 88, 0.2);
    border-radius: 16px;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.4), 0 0 20px rgba(48, 209, 88, 0.1);
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    z-index: 100;
    pointer-events: none;
}

.encryption-badge:hover .encryption-tooltip {
    opacity: 1;
    visibility: visible;
    transform: translateX(-50%) scale(1);
    pointer-events: auto;
}

/* Tooltip Arrow */
.encryption-tooltip::after {
    content: '';
    position: absolute;
    bottom: -8px;
    left: 50%;
    transform: translateX(-50%) rotate(45deg);
    width: 16px;
    height: 16px;
    background: var(--bg-elevated);
    border-right: 1px solid rgba(48, 209, 88, 0.2);
    border-bottom: 1px solid rgba(48, 209, 88, 0.2);
}

.encryption-tooltip .tooltip-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 10px;
    color: var(--success);
    font-weight: 600;
    font-size: 14px;
}

.encryption-tooltip .tooltip-header svg {
    width: 18px;
    height: 18px;
}

.encryption-tooltip p {
    font-size: 12px;
    color: var(--text-secondary);
    line-height: 1.5;
    margin-bottom: 12px;
}

.encryption-tooltip .tooltip-details {
    background: rgba(48, 209, 88, 0.08);
    border-radius: 10px;
    padding: 10px 12px;
}

/* Simple feature items for non-tech users */
.encryption-tooltip .tooltip-features {
    display: flex;
    flex-direction: column;
    gap: 8px;
    background: rgba(48, 209, 88, 0.08);
    border-radius: 10px;
    padding: 12px;
}

.encryption-tooltip .feature-item {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 12px;
    color: var(--text);
}

.encryption-tooltip .feature-item svg {
    width: 16px;
    height: 16px;
    color: var(--success);
}

/* Encryption States */
.encryption-badge.encrypting {
    background: linear-gradient(135deg, rgba(255, 159, 10, 0.12), rgba(255, 159, 10, 0.06));
    border-color: rgba(255, 159, 10, 0.25);
    color: var(--warning);
}

.encryption-badge.encrypting::before {
    animation: none;
}

.encryption-badge.error {
    background: linear-gradient(135deg, rgba(255, 69, 58, 0.12), rgba(255, 69, 58, 0.06));
    border-color: rgba(255, 69, 58, 0.25);
    color: var(--danger);
}

/* Active state - when in an encrypted call */
.encryption-badge.active {
    background: linear-gradient(135deg, rgba(48, 209, 88, 0.18), rgba(48, 209, 88, 0.08));
    border-color: rgba(48, 209, 88, 0.4);
    box-shadow: 0 0 20px rgba(48, 209, 88, 0.15);
}

.encryption-badge.active::before {
    animation: encryption-pulse 2s ease-in-out infinite;
}