/**
 * Voice Recorder & Broadcast Styles
 * أنماط مسجل الصوت والبث الجماعي
 */

/* ========================================
   زر البث الصوتي الرئيسي
======================================== */
.voice-broadcast-section {
    margin: 2rem 0;
    padding: 2rem;
    background: linear-gradient(135deg, rgba(37, 211, 102, 0.1) 0%, rgba(18, 140, 126, 0.1) 100%);
    border: 2px solid rgba(37, 211, 102, 0.3);
    border-radius: 1.5rem;
    text-align: center;
    position: relative;
    overflow: hidden;
}

.voice-broadcast-section::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(37, 211, 102, 0.05) 0%, transparent 70%);
    animation: pulse-bg 4s ease-in-out infinite;
}

@keyframes pulse-bg {
    0%, 100% { transform: scale(1); opacity: 0.5; }
    50% { transform: scale(1.1); opacity: 0.8; }
}

.broadcast-header {
    position: relative;
    z-index: 1;
    margin-bottom: 1.5rem;
}

.broadcast-header i {
    font-size: 3rem;
    color: #25d366;
    margin-bottom: 1rem;
    display: block;
    animation: broadcast-icon 2s ease-in-out infinite;
}

@keyframes broadcast-icon {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.1); }
}

.broadcast-header h3 {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary, #f1f5f9);
    margin-bottom: 0.5rem;
}

.broadcast-header p {
    color: var(--text-secondary, #94a3b8);
    font-size: 1rem;
}

.broadcast-btn {
    position: relative;
    z-index: 1;
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    padding: 1.25rem 3rem;
    background: linear-gradient(135deg, #25d366 0%, #128c7e 100%);
    color: white;
    border: none;
    border-radius: 1rem;
    font-size: 1.2rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 10px 30px rgba(37, 211, 102, 0.3);
}

.broadcast-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 15px 40px rgba(37, 211, 102, 0.4);
}

.broadcast-btn:active {
    transform: translateY(-1px);
}

.broadcast-btn i {
    font-size: 1.5rem;
}

.broadcast-btn small {
    font-size: 0.85rem;
    opacity: 0.9;
    font-weight: 500;
}

/* ========================================
   النافذة المنبثقة
======================================== */
.voice-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(10px);
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.voice-modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

.voice-modal {
    background: linear-gradient(165deg, #1a1f35 0%, #0d1025 100%);
    border-radius: 1.5rem;
    width: 100%;
    max-width: 500px;
    max-height: 90vh;
    overflow: hidden;
    position: relative;
    border: 1px solid rgba(99, 102, 241, 0.2);
    box-shadow: 0 25px 80px rgba(0, 0, 0, 0.5);
    transform: scale(0.9) translateY(20px);
    transition: transform 0.3s ease;
    /* تحريك النافذة لليمين لتجنب التداخل مع نافذة سارة */
    margin-left: 420px;
}

.voice-modal-overlay.active .voice-modal {
    transform: scale(1) translateY(0);
}

[data-theme="light"] .voice-modal {
    background: linear-gradient(165deg, #ffffff 0%, #f8fafc 100%);
    border-color: rgba(99, 102, 241, 0.15);
}

/* رأس النافذة */
.voice-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    background: linear-gradient(135deg, rgba(37, 211, 102, 0.1) 0%, rgba(18, 140, 126, 0.05) 100%);
}

[data-theme="light"] .voice-modal-header {
    border-bottom-color: rgba(0, 0, 0, 0.1);
}

.voice-modal-header h3 {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-primary, #f1f5f9);
}

.voice-modal-header h3 i {
    color: #25d366;
}

.voice-modal-close {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.1);
    border: none;
    color: var(--text-primary, #f1f5f9);
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.voice-modal-close:hover {
    background: #ef4444;
    transform: rotate(90deg);
}

/* محتوى النافذة */
.voice-modal-body {
    padding: 1.5rem;
    overflow-y: auto;
    max-height: calc(90vh - 150px);
}

/* ========================================
   الخطوات
======================================== */
.voice-step {
    display: none;
    animation: fadeIn 0.3s ease;
}

.voice-step.active {
    display: block;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* مؤشر الخطوات */
.voice-steps-indicator {
    display: flex;
    justify-content: center;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
}

.step-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.2);
    transition: all 0.3s ease;
}

.step-dot.active {
    background: #25d366;
    transform: scale(1.2);
}

.step-dot.completed {
    background: #25d366;
}

/* ========================================
   خطوة 1: إدخال البيانات
======================================== */
.voice-form-group {
    margin-bottom: 1.25rem;
}

.voice-form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 600;
    color: var(--text-primary, #f1f5f9);
}

.voice-form-group label span {
    color: #ef4444;
}

.voice-input {
    width: 100%;
    padding: 1rem 1.25rem;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 0.75rem;
    color: var(--text-primary, #f1f5f9);
    font-size: 1rem;
    font-family: inherit;
    transition: all 0.3s ease;
}

.voice-input:focus {
    outline: none;
    border-color: #25d366;
    background: rgba(37, 211, 102, 0.05);
}

.voice-input::placeholder {
    color: var(--text-secondary, #64748b);
}

[data-theme="light"] .voice-input {
    background: rgba(0, 0, 0, 0.03);
    border-color: rgba(0, 0, 0, 0.1);
    color: #1e293b;
}

/* ========================================
   خطوة 2: التسجيل
======================================== */
.voice-recorder-ui {
    text-align: center;
    padding: 1rem 0;
}

/* المؤقت */
.voice-timer {
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--text-primary, #f1f5f9);
    margin-bottom: 1rem;
    font-family: 'Courier New', monospace;
}

.voice-timer.recording {
    color: #25d366;
}

/* شريط التقدم */
.voice-progress-bar {
    height: 6px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 3px;
    margin-bottom: 1.5rem;
    overflow: hidden;
}

.voice-progress {
    height: 100%;
    background: linear-gradient(90deg, #25d366, #128c7e);
    border-radius: 3px;
    width: 0%;
    transition: width 0.1s linear;
}

.voice-progress.warning {
    background: linear-gradient(90deg, #f59e0b, #ef4444);
}

/* الموجة الصوتية */
.voice-waveform {
    height: 100px;
    margin-bottom: 1.5rem;
    background: rgba(255, 255, 255, 0.03);
    border-radius: 0.75rem;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
}

.voice-waveform canvas {
    width: 100%;
    height: 100%;
}

.voice-waveform-placeholder {
    color: var(--text-secondary, #64748b);
    font-size: 0.9rem;
}

/* أزرار التسجيل */
.voice-record-controls {
    display: flex;
    justify-content: center;
    gap: 1rem;
}

.voice-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 1rem 2rem;
    border: none;
    border-radius: 2rem;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    font-family: inherit;
}

.voice-btn-record {
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
    color: white;
    box-shadow: 0 8px 25px rgba(239, 68, 68, 0.3);
}

.voice-btn-record:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 35px rgba(239, 68, 68, 0.4);
}

.voice-btn-record.recording {
    animation: pulse-record 1s ease-in-out infinite;
}

@keyframes pulse-record {
    0%, 100% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.4); }
    50% { box-shadow: 0 0 0 15px rgba(239, 68, 68, 0); }
}

.voice-btn-stop {
    background: linear-gradient(135deg, #6366f1 0%, #4f46e5 100%);
    color: white;
}

.voice-btn-cancel {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-primary, #f1f5f9);
}

.voice-btn-cancel:hover {
    background: rgba(239, 68, 68, 0.2);
    color: #ef4444;
}

/* ========================================
   خطوة 3: المعاينة
======================================== */
.voice-preview {
    text-align: center;
}

.voice-preview-player {
    width: 100%;
    margin-bottom: 1rem;
    border-radius: 0.5rem;
}

.voice-preview-info {
    display: flex;
    justify-content: center;
    gap: 2rem;
    margin-bottom: 1.5rem;
    color: var(--text-secondary, #94a3b8);
}

.voice-preview-info span {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.voice-preview-actions {
    display: flex;
    justify-content: center;
    gap: 1rem;
}

.voice-btn-rerecord {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-primary, #f1f5f9);
}

.voice-btn-send {
    background: linear-gradient(135deg, #25d366 0%, #128c7e 100%);
    color: white;
    box-shadow: 0 8px 25px rgba(37, 211, 102, 0.3);
}

.voice-btn-send:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 35px rgba(37, 211, 102, 0.4);
}

/* ========================================
   خطوة 4: الإرسال
======================================== */
.voice-sending {
    text-align: center;
    padding: 2rem 0;
}

.voice-sending-animation {
    width: 80px;
    height: 80px;
    margin: 0 auto 1.5rem;
    border: 4px solid rgba(37, 211, 102, 0.2);
    border-top-color: #25d366;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.voice-sending-status {
    font-size: 1.1rem;
    color: var(--text-primary, #f1f5f9);
    margin-bottom: 1rem;
}

.voice-sending-progress-bar {
    height: 8px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
    overflow: hidden;
}

.voice-sending-progress {
    height: 100%;
    background: linear-gradient(90deg, #25d366, #128c7e);
    border-radius: 4px;
    width: 0%;
    transition: width 0.3s ease;
}

/* ========================================
   خطوة 5: النجاح
======================================== */
.voice-success {
    text-align: center;
    padding: 2rem 0;
}

.voice-success-icon {
    width: 100px;
    height: 100px;
    margin: 0 auto 1.5rem;
    background: linear-gradient(135deg, #25d366 0%, #128c7e 100%);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: success-pop 0.5s ease;
}

@keyframes success-pop {
    0% { transform: scale(0); }
    50% { transform: scale(1.2); }
    100% { transform: scale(1); }
}

.voice-success-icon i {
    font-size: 3rem;
    color: white;
}

.voice-success h4 {
    font-size: 1.5rem;
    color: var(--text-primary, #f1f5f9);
    margin-bottom: 0.5rem;
}

.voice-success p {
    color: var(--text-secondary, #94a3b8);
    margin-bottom: 1.5rem;
}

.voice-success-count {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    background: rgba(37, 211, 102, 0.1);
    border: 1px solid rgba(37, 211, 102, 0.3);
    border-radius: 2rem;
    color: #25d366;
    font-weight: 600;
}

.voice-btn-close {
    margin-top: 1.5rem;
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-primary, #f1f5f9);
}

/* ========================================
   رسالة الخطأ
======================================== */
.voice-error-message {
    display: none;
    padding: 1rem;
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.3);
    border-radius: 0.75rem;
    color: #ef4444;
    margin-bottom: 1rem;
    text-align: center;
}

/* ========================================
   Responsive
======================================== */
@media (max-width: 992px) {
    .voice-modal {
        margin-left: 0; /* إلغاء المسافة في الشاشات الصغيرة */
    }
}

@media (max-width: 576px) {
    .voice-modal {
        max-width: 100%;
        margin: 0.5rem;
        border-radius: 1rem;
    }
    
    .voice-timer {
        font-size: 2rem;
    }
    
    .voice-btn {
        padding: 0.875rem 1.5rem;
        font-size: 0.9rem;
    }
    
    .broadcast-btn {
        padding: 1rem 2rem;
        font-size: 1rem;
    }
    
    .voice-record-controls {
        flex-direction: column;
    }
    
    .voice-preview-actions {
        flex-direction: column;
    }
}

/* ========================================
   Light Mode Adjustments
======================================== */
[data-theme="light"] .voice-modal-header {
    background: linear-gradient(135deg, rgba(37, 211, 102, 0.08) 0%, rgba(18, 140, 126, 0.03) 100%);
}

[data-theme="light"] .voice-timer {
    color: #1e293b;
}

[data-theme="light"] .voice-waveform {
    background: rgba(0, 0, 0, 0.03);
}

[data-theme="light"] .voice-btn-cancel,
[data-theme="light"] .voice-btn-rerecord,
[data-theme="light"] .voice-btn-close {
    background: rgba(0, 0, 0, 0.05);
    color: #1e293b;
}

[data-theme="light"] .voice-broadcast-section {
    background: linear-gradient(135deg, rgba(37, 211, 102, 0.08) 0%, rgba(18, 140, 126, 0.05) 100%);
}

[data-theme="light"] .broadcast-header h3 {
    color: #1e293b;
}

/* ========================================
   زر إرفاق الوسائط (Elegant Design)
======================================== */
.voice-attachment-section {
    margin: 1.5rem 0;
    text-align: center;
}

.voice-btn-outline {
    background: rgba(255, 255, 255, 0.03);
    border: 2px dashed rgba(255, 255, 255, 0.2);
    color: var(--text-secondary, #94a3b8);
    width: 100%;
    padding: 1.25rem;
    font-size: 1rem;
    border-radius: 1rem;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
}

.voice-btn-outline:hover {
    border-color: #6366f1;
    color: white;
    background: rgba(99, 102, 241, 0.1);
    transform: translateY(-2px);
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.1);
}

.voice-btn-outline i {
    font-size: 1.4rem;
    color: #6366f1;
    transition: transform 0.3s ease;
}

.voice-btn-outline:hover i {
    transform: scale(1.2) rotate(15deg);
}

/* معاينة الوسائط */
#voiceMediaPreview {
    margin-top: 1rem;
    padding: 0.75rem;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 1rem;
    display: none;
    animation: fadeIn 0.3s ease;
}

#voiceMediaPreview img,
#voiceMediaPreview video {
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
    border-radius: 0.75rem;
    border: 1px solid rgba(255, 255, 255, 0.1);
    max-height: 150px;
    object-fit: cover;
}

/* Light Mode Support */
[data-theme="light"] .voice-btn-outline {
    background: rgba(0, 0, 0, 0.02);
    border-color: rgba(99, 102, 241, 0.3);
    color: #475569;
}

[data-theme="light"] .voice-btn-outline:hover {
    border-color: #6366f1;
    background: rgba(99, 102, 241, 0.08);
    color: #6366f1;
}

