/**
 * Widget Mobile Call UI - WhatsApp Style
 * مودال تماس ویجت برای موبایل
 */

@media (max-width: 768px) {
    /* مخفی کردن call UI های desktop widget */
    .celvix-call-ui {
        display: none !important;
    }
    
    /* نمایش فقط mobile call UI ها */
    .widget-mobile-audio-call,
    .widget-mobile-video-call,
    .widget-mobile-incoming,
    .widget-mobile-outgoing {
        display: flex !important;
    }
    
    /* Audio Call Modal Widget - کوچک و زیبا */
    .widget-mobile-audio-call {
        position: fixed;
        top: 50%;
        left: 50%;
        transform: translate(-50%, -50%);
        width: 320px;
        max-width: 90vw;
        background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
        border-radius: 24px;
        box-shadow: 0 20px 60px rgba(0, 0, 0, 0.4);
        z-index: 999999;
        overflow: hidden;
        transition: all 0.3s ease;
        animation: slideInScale 0.3s ease;
    }
    
    @keyframes slideInScale {
        from {
            opacity: 0;
            transform: translate(-50%, -50%) scale(0.8);
        }
        to {
            opacity: 1;
            transform: translate(-50%, -50%) scale(1);
        }
    }
    
    /* Minimized Audio */
    .widget-mobile-audio-call.minimized {
        top: 80px;
        left: 50%;
        transform: translateX(-50%);
        width: 260px;
        border-radius: 16px;
        overflow: hidden;
        box-shadow: 0 6px 20px rgba(0, 0, 0, 0.25);
    }
    
    /* Collapsed Audio */
    .widget-mobile-audio-call.collapsed {
        top: 80px;
        left: 50%;
        transform: translateX(-50%);
        width: 180px;
        height: 56px;
        border-radius: 28px;
    }
    
    /* Audio Call Header */
    .widget-audio-call-header {
        background: rgba(255, 255, 255, 0.1);
        padding: 12px 16px;
        display: flex;
        align-items: center;
        justify-content: space-between;
        backdrop-filter: blur(10px);
        color: white;
    }
    
    .collapsed .widget-audio-call-header {
        padding: 8px 16px;
    }
    
    .widget-audio-header-btns {
        display: flex;
        gap: 6px;
    }
    
    .widget-audio-header-btn {
        background: rgba(255, 255, 255, 0.15);
        border: none;
        color: white;
        width: 30px;
        height: 30px;
        border-radius: 50%;
        display: flex;
        align-items: center;
        justify-content: center;
        cursor: pointer;
        transition: all 0.2s;
        font-size: 12px;
    }
    
    .widget-audio-header-btn:active {
        background: rgba(255, 255, 255, 0.3);
        transform: scale(0.9);
    }
    
    /* Audio Call Body */
    .widget-audio-call-body {
        padding: 32px 16px;
        text-align: center;
        color: white;
    }
    
    .collapsed .widget-audio-call-body {
        display: none;
    }
    
    .widget-audio-avatar {
        width: 100px;
        height: 100px;
        border-radius: 50%;
        background: rgba(255, 255, 255, 0.2);
        margin: 0 auto 16px;
        display: flex;
        align-items: center;
        justify-content: center;
        font-size: 40px;
        font-weight: 600;
        animation: avatarPulse 2s ease-in-out infinite;
    }
    
    @keyframes avatarPulse {
        0%, 100% {
            box-shadow: 0 0 0 0 rgba(255, 255, 255, 0.4);
        }
        50% {
            box-shadow: 0 0 0 16px rgba(255, 255, 255, 0);
        }
    }
    
    .minimized .widget-audio-avatar {
        width: 70px;
        height: 70px;
        font-size: 28px;
        margin-bottom: 12px;
    }
    
    .widget-audio-caller-name {
        font-size: 20px;
        font-weight: 600;
        margin-bottom: 6px;
    }
    
    .minimized .widget-audio-caller-name {
        font-size: 16px;
    }
    
    .widget-audio-call-status,
    .widget-audio-call-timer {
        font-size: 14px;
        opacity: 0.9;
    }
    
    /* Audio Controls */
    .widget-audio-call-controls {
        padding: 16px;
        display: flex;
        justify-content: center;
        gap: 16px;
        flex-shrink: 0;
    }
    
    .collapsed .widget-audio-call-controls {
        display: none !important;
    }
    
    .minimized .widget-audio-call-controls {
        padding: 10px;
        gap: 10px;
    }
    
    .widget-audio-control-btn {
        width: 54px;
        height: 54px;
        border-radius: 50%;
        border: none;
        display: flex;
        align-items: center;
        justify-content: center;
        cursor: pointer;
        transition: all 0.2s;
        font-size: 20px;
        flex-shrink: 0;
    }
    
    .minimized .widget-audio-control-btn {
        width: 40px;
        height: 40px;
        font-size: 16px;
    }
    
    .widget-audio-control-btn.mute {
        background: rgba(255, 255, 255, 0.2);
        color: white;
    }
    
    .widget-audio-control-btn.mute.active {
        background: #ef4444;
    }
    
    .widget-audio-control-btn.end {
        background: #ef4444;
        color: white;
    }
    
    .widget-audio-control-btn:active {
        transform: scale(0.9);
    }
    
    /* Video Call Modal Widget - تمام صفحه */
    .widget-mobile-video-call {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        width: 100%;
        height: 100%;
        background: #1a1a1a;
        z-index: 999999;
        display: flex;
        flex-direction: column;
        animation: fadeIn 0.3s ease;
    }
    
    @keyframes fadeIn {
        from { opacity: 0; }
        to { opacity: 1; }
    }
    
    /* Minimized Video Widget */
    .widget-mobile-video-call.minimized {
        top: 80px;
        right: 16px;
        left: auto;
        bottom: auto;
        width: 140px;
        height: 200px;
        border-radius: 12px;
        box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
        overflow: hidden;
    }
    
    /* Collapsed Video Widget */
    .widget-mobile-video-call.collapsed {
        top: 80px;
        right: 20px;
        left: auto;
        bottom: auto;
        width: 180px;
        height: 56px;
        border-radius: 28px;
        background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    }
    
    /* Video Header */
    .widget-video-call-header {
        position: absolute;
        top: 0;
        left: 0;
        right: 0;
        padding: 16px;
        background: linear-gradient(to bottom, rgba(0, 0, 0, 0.6), transparent);
        z-index: 10;
        display: flex;
        align-items: center;
        justify-content: space-between;
        color: white;
    }
    
    .minimized .widget-video-call-header {
        padding: 8px 12px;
    }
    
    .collapsed .widget-video-call-header {
        position: relative;
        background: transparent;
        padding: 8px 16px;
    }
    
    .widget-video-caller-info h3 {
        font-size: 16px;
        font-weight: 600;
        margin: 0 0 2px 0;
    }
    
    .minimized .widget-video-caller-info h3 {
        font-size: 13px;
    }
    
    .collapsed .widget-video-caller-info h3 {
        font-size: 13px;
        margin: 0;
    }
    
    .widget-video-call-timer {
        font-size: 12px;
        opacity: 0.9;
    }
    
    .minimized .widget-video-call-timer,
    .collapsed .widget-video-call-timer {
        display: none;
    }
    
    .widget-video-header-btns {
        display: flex;
        gap: 6px;
    }
    
    .widget-video-header-btn {
        background: rgba(255, 255, 255, 0.15);
        border: none;
        color: white;
        width: 32px;
        height: 32px;
        border-radius: 50%;
        display: flex;
        align-items: center;
        justify-content: center;
        cursor: pointer;
        backdrop-filter: blur(10px);
        transition: all 0.2s;
        font-size: 12px;
    }
    
    .minimized .widget-video-header-btn {
        width: 26px;
        height: 26px;
        font-size: 10px;
    }
    
    .widget-video-header-btn:active {
        background: rgba(255, 255, 255, 0.3);
        transform: scale(0.9);
    }
    
    /* Video Streams */
    .widget-video-remote {
        position: absolute;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        width: 100%;
        height: 100%;
        object-fit: cover;
        background: #000;
    }
    
    .minimized .widget-video-remote {
        border-radius: 16px;
    }
    
    .collapsed .widget-video-remote {
        display: none;
    }
    
    .widget-video-local {
        position: absolute;
        top: 70px;
        right: 16px;
        width: 100px;
        height: 140px;
        object-fit: cover;
        border-radius: 12px;
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
        z-index: 5;
        background: #000;
    }
    
    .minimized .widget-video-local,
    .collapsed .widget-video-local {
        display: none;
    }
    
    /* Video Controls */
    .widget-video-call-controls {
        position: absolute;
        bottom: 0;
        left: 0;
        right: 0;
        padding: 20px;
        background: linear-gradient(to top, rgba(0, 0, 0, 0.8), transparent);
        display: flex;
        justify-content: center;
        gap: 14px;
        z-index: 10;
        flex-shrink: 0;
    }
    
    .minimized .widget-video-call-controls {
        padding: 8px;
        gap: 6px;
        background: linear-gradient(to top, rgba(0, 0, 0, 0.9), rgba(0, 0, 0, 0.6));
    }
    
    .collapsed .widget-video-call-controls {
        display: none !important;
    }
    
    .widget-video-control-btn {
        width: 50px;
        height: 50px;
        border-radius: 50%;
        border: none;
        display: flex;
        align-items: center;
        justify-content: center;
        cursor: pointer;
        transition: all 0.2s;
        font-size: 20px;
        backdrop-filter: blur(10px);
        flex-shrink: 0;
    }
    
    .minimized .widget-video-control-btn {
        width: 32px;
        height: 32px;
        font-size: 13px;
    }
    
    .widget-video-control-btn.mute {
        background: rgba(255, 255, 255, 0.2);
        color: white;
    }
    
    .widget-video-control-btn.mute.active {
        background: #ef4444;
    }
    
    .widget-video-control-btn.video {
        background: rgba(255, 255, 255, 0.2);
        color: white;
    }
    
    .widget-video-control-btn.video.active {
        background: #ef4444;
    }
    
    .widget-video-control-btn.end {
        background: #ef4444;
        color: white;
        width: 58px;
        height: 58px;
    }
    
    .minimized .widget-video-control-btn.end {
        width: 36px;
        height: 36px;
    }
    
    .widget-video-control-btn:active {
        transform: scale(0.9);
    }
    
    /* Incoming Call Widget */
    .widget-mobile-incoming {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        width: 100%;
        height: 100%;
        background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
        z-index: 999999;
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: space-between;
        padding: 80px 20px 60px;
        color: white;
        animation: fadeIn 0.3s ease;
    }
    
    .widget-incoming-avatar {
        width: 120px;
        height: 120px;
        border-radius: 50%;
        background: rgba(255, 255, 255, 0.2);
        display: flex;
        align-items: center;
        justify-content: center;
        font-size: 48px;
        font-weight: 600;
        animation: incomingPulse 2s ease-in-out infinite;
    }
    
    @keyframes incomingPulse {
        0%, 100% {
            box-shadow: 0 0 0 0 rgba(255, 255, 255, 0.6);
        }
        50% {
            box-shadow: 0 0 0 25px rgba(255, 255, 255, 0);
        }
    }
    
    .widget-incoming-info {
        text-align: center;
        margin-top: 24px;
    }
    
    .widget-incoming-info h2 {
        font-size: 26px;
        font-weight: 600;
        margin: 0 0 8px 0;
    }
    
    .widget-incoming-type {
        font-size: 15px;
        opacity: 0.9;
    }
    
    .widget-incoming-actions {
        display: flex;
        gap: 50px;
    }
    
    .widget-incoming-btn {
        display: flex;
        flex-direction: column;
        align-items: center;
        gap: 10px;
        cursor: pointer;
    }
    
    .widget-incoming-btn-circle {
        width: 68px;
        height: 68px;
        border-radius: 50%;
        display: flex;
        align-items: center;
        justify-content: center;
        font-size: 28px;
        transition: all 0.2s;
    }
    
    .widget-incoming-btn.accept .widget-incoming-btn-circle {
        background: #10b981;
        color: white;
    }
    
    .widget-incoming-btn.reject .widget-incoming-btn-circle {
        background: #ef4444;
        color: white;
    }
    
    .widget-incoming-btn:active .widget-incoming-btn-circle {
        transform: scale(0.85);
    }
    
    .widget-incoming-btn-label {
        font-size: 15px;
        font-weight: 500;
    }
    
    /* Outgoing Call Widget */
    .widget-mobile-outgoing {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        width: 100%;
        height: 100%;
        background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
        z-index: 999999;
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: space-between;
        padding: 80px 20px 60px;
        color: white;
        animation: fadeIn 0.3s ease;
    }
    
    .widget-outgoing-avatar {
        width: 120px;
        height: 120px;
        border-radius: 50%;
        background: rgba(255, 255, 255, 0.2);
        display: flex;
        align-items: center;
        justify-content: center;
        font-size: 48px;
        font-weight: 600;
    }
    
    .widget-outgoing-info {
        text-align: center;
        margin-top: 24px;
    }
    
    .widget-outgoing-info h2 {
        font-size: 26px;
        font-weight: 600;
        margin: 0 0 8px 0;
    }
    
    .widget-outgoing-status {
        font-size: 15px;
        opacity: 0.9;
        display: flex;
        align-items: center;
        justify-content: center;
        gap: 8px;
    }
    
    .widget-outgoing-dots {
        display: flex;
        gap: 4px;
    }
    
    .widget-outgoing-dot {
        width: 5px;
        height: 5px;
        border-radius: 50%;
        background: white;
        animation: dotPulse 1.4s ease-in-out infinite;
    }
    
    .widget-outgoing-dot:nth-child(2) {
        animation-delay: 0.2s;
    }
    
    .widget-outgoing-dot:nth-child(3) {
        animation-delay: 0.4s;
    }
    
    @keyframes dotPulse {
        0%, 60%, 100% {
            opacity: 0.3;
        }
        30% {
            opacity: 1;
        }
    }
    
    .widget-outgoing-end {
        width: 68px;
        height: 68px;
        border-radius: 50%;
        background: #ef4444;
        border: none;
        color: white;
        font-size: 28px;
        display: flex;
        align-items: center;
        justify-content: center;
        cursor: pointer;
        transition: all 0.2s;
    }
    
    .widget-outgoing-end:active {
        transform: scale(0.85);
    }
}

