/* ============================================
   DmApp - Voice & Video Calls Styles
   ============================================ */

* { margin: 0; padding: 0; box-sizing: border-box; }
body { font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif; background: linear-gradient(135deg, #f0fff0, #ffffff, #f0fff0); min-height: 100vh; }

/* === Calls Page === */
.calls-page { max-width: 500px; margin: 0 auto; min-height: 100vh; background: white; position: relative; }

/* Header */
.calls-header { display: flex; align-items: center; padding: 16px 20px; background: linear-gradient(135deg, #00cc00, #00ff41); color: #000; position: sticky; top: 0; z-index: 10; }
.calls-header .back-btn { background: none; border: none; font-size: 24px; cursor: pointer; margin-right: 12px; color: #000; }
.calls-title { flex: 1; font-size: 20px; font-weight: 700; }
.header-actions .icon-btn { background: rgba(0,0,0,0.1); border: none; border-radius: 50%; width: 40px; height: 40px; font-size: 18px; cursor: pointer; }

/* Tabs */
.calls-tabs { display: flex; background: #f8fff8; border-bottom: 2px solid #e0ffe0; overflow-x: auto; }
.calls-tab { flex: 1; padding: 12px 8px; border: none; background: none; font-size: 13px; font-weight: 600; cursor: pointer; color: #666; white-space: nowrap; transition: all 0.3s; border-bottom: 3px solid transparent; }
.calls-tab.active { color: #00aa00; border-bottom-color: #00cc00; background: rgba(0,255,0,0.05); }

/* Tab Content */
.calls-tab-content { display: none; padding: 16px; animation: fadeIn 0.3s ease; }
.calls-tab-content.active { display: block; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }

/* === Dial Pad === */
.dialpad-section { text-align: center; }
.dial-display { display: flex; align-items: center; margin-bottom: 20px; background: #f8fff8; border-radius: 16px; padding: 4px; border: 2px solid #e0ffe0; }
.dial-input { flex: 1; border: none; background: none; font-size: 28px; font-weight: 700; text-align: center; padding: 16px; color: #222; letter-spacing: 2px; outline: none; }
.dial-input::placeholder { color: #aaa; font-size: 16px; letter-spacing: 0; }
.dial-clear { background: none; border: none; font-size: 24px; cursor: pointer; padding: 16px; color: #888; }
.dialpad-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; max-width: 320px; margin: 0 auto 20px; }
.dial-btn { background: #f8fff8; border: 2px solid #e0ffe0; border-radius: 16px; padding: 16px; cursor: pointer; transition: all 0.15s; display: flex; flex-direction: column; align-items: center; }
.dial-btn:hover { background: #e0ffe0; transform: scale(1.05); }
.dial-btn:active { transform: scale(0.95); background: #00ff41; }
.dial-num { font-size: 24px; font-weight: 700; color: #222; }
.dial-sub { font-size: 10px; color: #888; letter-spacing: 2px; margin-top: 2px; }
.dial-actions { display: flex; gap: 12px; justify-content: center; margin-top: 8px; }
.call-action-btn { padding: 14px 28px; border: none; border-radius: 50px; font-size: 15px; font-weight: 700; cursor: pointer; transition: all 0.3s; display: flex; align-items: center; gap: 8px; }
.voice-call-btn { background: linear-gradient(135deg, #00cc00, #00ff41); color: #000; }
.voice-call-btn:hover { transform: scale(1.05); box-shadow: 0 4px 20px rgba(0,255,0,0.4); }
.video-call-btn { background: linear-gradient(135deg, #0088ff, #00bbff); color: #fff; }
.video-call-btn:hover { transform: scale(1.05); box-shadow: 0 4px 20px rgba(0,136,255,0.4); }

/* === Contacts === */
.contacts-search { display: flex; align-items: center; background: #f8fff8; border-radius: 12px; padding: 4px 12px; margin-bottom: 12px; border: 2px solid #e0ffe0; }
.contacts-search .search-icon { font-size: 18px; margin-right: 8px; }
.contacts-search-input { flex: 1; border: none; background: none; padding: 12px 0; font-size: 15px; outline: none; }
.contacts-filter, .history-filter { display: flex; gap: 8px; margin-bottom: 16px; overflow-x: auto; }
.filter-btn { padding: 8px 16px; border: 2px solid #e0ffe0; border-radius: 20px; background: white; font-size: 13px; font-weight: 600; cursor: pointer; white-space: nowrap; transition: all 0.2s; }
.filter-btn.active { background: #00cc00; color: #000; border-color: #00cc00; }
.contacts-list, .history-list, .daily-list { display: flex; flex-direction: column; gap: 4px; }

/* Contact Item */
.contact-item { display: flex; align-items: center; padding: 12px 16px; border-radius: 16px; cursor: pointer; transition: all 0.2s; border: 1px solid transparent; }
.contact-item:hover { background: #f0fff0; border-color: #e0ffe0; }
.contact-avatar { width: 48px; height: 48px; border-radius: 50%; margin-right: 12px; object-fit: cover; border: 2px solid #e0ffe0; }
.contact-avatar-placeholder { width: 48px; height: 48px; border-radius: 50%; margin-right: 12px; background: linear-gradient(135deg, #00cc00, #00ff41); display: flex; align-items: center; justify-content: center; font-size: 20px; font-weight: 700; color: #000; }
.contact-info { flex: 1; }
.contact-name { font-size: 15px; font-weight: 600; color: #222; }
.contact-id { font-size: 12px; color: #888; margin-top: 2px; }
.contact-badge { font-size: 10px; padding: 2px 8px; border-radius: 10px; font-weight: 600; }
.contact-badge.app-user { background: #e0ffe0; color: #008800; }
.contact-badge.external { background: #fff3e0; color: #e65100; }
.contact-status { width: 10px; height: 10px; border-radius: 50%; margin-left: 4px; display: inline-block; }
.contact-status.online { background: #00ff41; }
.contact-status.offline { background: #ccc; }
.contact-call-btns { display: flex; gap: 8px; }
.contact-call-btn { width: 40px; height: 40px; border-radius: 50%; border: none; cursor: pointer; font-size: 18px; transition: all 0.2s; }
.contact-call-btn.voice { background: #e0ffe0; }
.contact-call-btn.voice:hover { background: #00ff41; transform: scale(1.1); }
.contact-call-btn.video { background: #e0f0ff; }
.contact-call-btn.video:hover { background: #00bbff; color: white; transform: scale(1.1); }

/* === History === */
.history-item { display: flex; align-items: center; padding: 12px 16px; border-radius: 16px; cursor: pointer; transition: all 0.2s; }
.history-item:hover { background: #f0fff0; }
.history-icon { width: 40px; height: 40px; border-radius: 50%; display: flex; align-items: center; justify-content: center; margin-right: 12px; font-size: 18px; }
.history-icon.missed { background: #ffebee; }
.history-icon.received { background: #e0ffe0; }
.history-icon.dialed { background: #e0f0ff; }
.history-info { flex: 1; }
.history-name { font-size: 15px; font-weight: 600; color: #222; }
.history-meta { font-size: 12px; color: #888; margin-top: 2px; display: flex; align-items: center; gap: 6px; }
.history-type-badge { font-size: 10px; padding: 1px 6px; border-radius: 8px; font-weight: 600; }
.history-type-badge.missed { background: #ffebee; color: #d32f2f; }
.history-type-badge.received { background: #e0ffe0; color: #2e7d32; }
.history-type-badge.dialed { background: #e0f0ff; color: #1565c0; }
.history-time { font-size: 12px; color: #aaa; white-space: nowrap; }
.history-duration { font-size: 11px; color: #888; }
.history-call-btn { width: 36px; height: 36px; border-radius: 50%; border: none; background: #e0ffe0; cursor: pointer; font-size: 16px; margin-left: 8px; transition: all 0.2s; }
.history-call-btn:hover { background: #00ff41; transform: scale(1.1); }

/* === Daily Numbers === */
.daily-header { text-align: center; padding: 8px 0 16px; }
.daily-header h3 { font-size: 20px; }
.daily-subtitle { font-size: 13px; color: #888; margin-top: 4px; }
.daily-section { margin-bottom: 20px; }
.daily-section-title { font-size: 14px; font-weight: 700; color: #00aa00; padding: 8px 0; border-bottom: 1px solid #e0ffe0; margin-bottom: 8px; }
.daily-item { display: flex; align-items: center; padding: 10px 12px; border-radius: 12px; cursor: pointer; transition: all 0.2s; }
.daily-item:hover { background: #f0fff0; }
.daily-item .contact-avatar, .daily-item .contact-avatar-placeholder { width: 42px; height: 42px; }
.daily-call-count { font-size: 11px; color: #00aa00; font-weight: 600; background: #e0ffe0; padding: 2px 8px; border-radius: 10px; margin-left: auto; }

/* === Active Call Screen === */
.call-screen { position: fixed; inset: 0; background: linear-gradient(180deg, #001a00, #003300, #002200); display: flex; flex-direction: column; align-items: center; justify-content: center; z-index: 1000; }
.call-bg-gradient { position: absolute; inset: 0; background: radial-gradient(circle at 50% 30%, rgba(0,255,0,0.15) 0%, transparent 60%); }
.call-content { position: relative; z-index: 1; text-align: center; width: 100%; max-width: 400px; padding: 20px; }
.call-status { font-size: 16px; color: #00ff41; font-weight: 600; margin-bottom: 4px; animation: pulse 2s infinite; }
@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: 0.6; } }
.call-timer { font-size: 18px; color: rgba(255,255,255,0.7); font-weight: 300; margin-bottom: 30px; font-variant-numeric: tabular-nums; }
.caller-profile { margin-bottom: 40px; }
.caller-pic-large { width: 120px; height: 120px; border-radius: 50%; border: 4px solid #00ff41; box-shadow: 0 0 40px rgba(0,255,0,0.3); }
.caller-name { font-size: 28px; font-weight: 700; color: white; margin-top: 16px; }
.caller-id { font-size: 14px; color: rgba(255,255,255,0.6); margin-top: 4px; }

/* Call Controls */
.call-controls { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; margin-bottom: 24px; }
.call-ctrl-btn { background: rgba(255,255,255,0.1); border: 1px solid rgba(255,255,255,0.15); border-radius: 16px; padding: 16px 8px; cursor: pointer; transition: all 0.2s; display: flex; flex-direction: column; align-items: center; gap: 6px; }
.call-ctrl-btn:hover { background: rgba(255,255,255,0.2); transform: scale(1.05); }
.call-ctrl-btn.active { background: #00ff41; border-color: #00ff41; }
.call-ctrl-btn.active .ctrl-icon { filter: none; }
.call-ctrl-btn.active .ctrl-label { color: #000; }
.ctrl-icon { font-size: 24px; }
.ctrl-label { font-size: 11px; color: rgba(255,255,255,0.7); font-weight: 600; }
.call-recording-indicator { display: none; color: #ff4444; font-size: 14px; font-weight: 600; margin-bottom: 16px; animation: pulse 1s infinite; }
.call-recording-indicator.show { display: flex; align-items: center; justify-content: center; gap: 6px; }
.recording-dot { width: 10px; height: 10px; border-radius: 50%; background: #ff4444; display: inline-block; animation: pulse 1s infinite; }
.end-call-btn { background: linear-gradient(135deg, #ff4444, #cc0000); color: white; border: none; border-radius: 50px; padding: 16px 48px; font-size: 18px; font-weight: 700; cursor: pointer; transition: all 0.3s; display: flex; align-items: center; gap: 10px; margin: 0 auto; }
.end-call-btn:hover { transform: scale(1.05); box-shadow: 0 4px 30px rgba(255,0,0,0.5); }

/* === Video Call Screen === */
.video-call-screen { position: fixed; inset: 0; background: #000; z-index: 1000; }
.video-container { position: relative; width: 100%; height: 100%; }
.remote-video { width: 100%; height: 100%; background: #111; display: flex; align-items: center; justify-content: center; }
.video-placeholder { text-align: center; color: rgba(255,255,255,0.6); }
.video-placeholder-pic { width: 120px; height: 120px; border-radius: 50%; border: 3px solid #00ff41; margin-bottom: 12px; }
.video-placeholder p { font-size: 16px; }
.local-video { position: absolute; top: 80px; right: 16px; width: 120px; height: 170px; border-radius: 16px; overflow: hidden; border: 2px solid #00ff41; background: #222; z-index: 5; cursor: move; }
.local-video .video-placeholder.small { display: flex; flex-direction: column; align-items: center; justify-content: center; height: 100%; font-size: 32px; color: rgba(255,255,255,0.5); }
.local-video .video-placeholder.small p { font-size: 11px; margin-top: 4px; }

/* Team Video Grid (Split Screen) */
.team-video-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 4px; width: 100%; height: 100%; padding: 4px; }
.team-video-grid .team-video-cell { background: #111; border-radius: 12px; display: flex; align-items: center; justify-content: center; position: relative; overflow: hidden; }
.team-video-cell .cell-name { position: absolute; bottom: 8px; left: 8px; color: white; font-size: 13px; font-weight: 600; background: rgba(0,0,0,0.5); padding: 4px 10px; border-radius: 8px; }
.team-video-cell .cell-mute { position: absolute; top: 8px; right: 8px; font-size: 14px; background: rgba(0,0,0,0.5); padding: 4px 6px; border-radius: 6px; }

/* Video Call Overlay */
.video-call-overlay { position: absolute; inset: 0; z-index: 10; display: flex; flex-direction: column; justify-content: space-between; pointer-events: none; }
.video-call-top { display: flex; justify-content: space-between; align-items: flex-start; padding: 50px 20px 16px; background: linear-gradient(180deg, rgba(0,0,0,0.6), transparent); pointer-events: auto; }
.video-call-info h3 { color: white; font-size: 18px; }
.video-timer { color: #00ff41; font-size: 14px; font-variant-numeric: tabular-nums; }
.video-caller-id { color: rgba(255,255,255,0.6); font-size: 12px; }
.video-call-recording { color: #ff4444; font-weight: 600; font-size: 14px; display: flex; align-items: center; gap: 4px; }
.video-call-controls { display: flex; justify-content: center; gap: 12px; padding: 20px; padding-bottom: 40px; background: linear-gradient(0deg, rgba(0,0,0,0.6), transparent); pointer-events: auto; }
.video-ctrl-btn { width: 52px; height: 52px; border-radius: 50%; border: none; background: rgba(255,255,255,0.2); backdrop-filter: blur(8px); cursor: pointer; font-size: 22px; transition: all 0.2s; }
.video-ctrl-btn:hover { background: rgba(255,255,255,0.35); transform: scale(1.1); }
.video-ctrl-btn.active { background: #00ff41; }
.end-video-btn { background: #ff4444 !important; }
.end-video-btn:hover { background: #cc0000 !important; }

/* === Incoming Call Popup === */
.incoming-call-popup { display: none; position: fixed; top: 0; left: 0; right: 0; z-index: 2000; padding: 16px; animation: slideDown 0.4s ease; }
.incoming-call-popup.show { display: block; }
@keyframes slideDown { from { transform: translateY(-100%); } to { transform: translateY(0); } }
.incoming-call-content { background: linear-gradient(135deg, #003300, #001a00); border: 1px solid #00ff41; border-radius: 20px; padding: 20px; max-width: 420px; margin: 0 auto; box-shadow: 0 8px 40px rgba(0,0,0,0.5); }
.incoming-caller-info { display: flex; align-items: center; margin-bottom: 16px; }
.incoming-caller-pic { width: 56px; height: 56px; border-radius: 50%; border: 2px solid #00ff41; margin-right: 12px; }
.incoming-caller-details h3 { color: white; font-size: 18px; }
.incoming-caller-details p { color: #00ff41; font-size: 13px; }
.caller-id-text { color: rgba(255,255,255,0.5) !important; font-size: 12px !important; }
.incoming-call-actions { display: flex; gap: 10px; }
.incoming-btn { flex: 1; padding: 12px; border: none; border-radius: 14px; font-size: 14px; font-weight: 700; cursor: pointer; display: flex; align-items: center; justify-content: center; gap: 6px; transition: all 0.2s; }
.incoming-btn:hover { transform: scale(1.03); }
.reject-btn { background: linear-gradient(135deg, #ff4444, #cc0000); color: white; }
.mute-btn { background: rgba(255,255,255,0.15); color: white; }
.answer-btn { background: linear-gradient(135deg, #00cc00, #00ff41); color: #000; }

/* === Modal Overlays === */
.modal-overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.5); z-index: 1100; display: flex; align-items: center; justify-content: center; }
.add-call-modal, .call-dialpad-modal { background: white; border-radius: 20px; padding: 24px; width: 90%; max-width: 380px; max-height: 70vh; overflow-y: auto; }
.add-call-modal h3, .call-dialpad-modal h3 { font-size: 18px; margin-bottom: 16px; }
.add-call-search { width: 100%; padding: 12px; border: 2px solid #e0ffe0; border-radius: 12px; font-size: 15px; outline: none; margin-bottom: 12px; }
.add-call-search:focus { border-color: #00cc00; }
.modal-cancel-btn { width: 100%; padding: 12px; border: none; background: #f5f5f5; border-radius: 12px; font-size: 15px; font-weight: 600; cursor: pointer; margin-top: 12px; }
.dialpad-grid.compact { max-width: 260px; margin: 0 auto; gap: 8px; }
.compact .dial-btn { padding: 12px; }

/* === Call FAB for Chat === */
.chat-call-fab { position: fixed; bottom: 90px; right: 20px; display: flex; flex-direction: column; gap: 10px; z-index: 100; }
.call-fab-btn { width: 52px; height: 52px; border-radius: 50%; border: none; font-size: 24px; cursor: pointer; box-shadow: 0 4px 16px rgba(0,0,0,0.2); transition: all 0.3s; }
.call-fab-btn.voice-fab { background: linear-gradient(135deg, #00cc00, #00ff41); color: #000; }
.call-fab-btn.video-fab { background: linear-gradient(135deg, #0088ff, #00bbff); color: #fff; }
.call-fab-btn:hover { transform: scale(1.15); }

/* === Call Display on Home === */
.call-display-widget { display: flex; align-items: center; padding: 12px 16px; margin: 0 16px 12px; background: linear-gradient(135deg, #f0fff0, #e0ffe0); border: 2px solid #00cc00; border-radius: 16px; cursor: pointer; transition: all 0.3s; }
.call-display-widget:hover { transform: translateY(-2px); box-shadow: 0 4px 16px rgba(0,255,0,0.2); }
.call-display-pic { width: 48px; height: 48px; border-radius: 50%; margin-right: 12px; border: 2px solid #00cc00; }
.call-display-info { flex: 1; }
.call-display-title { font-size: 15px; font-weight: 600; }
.call-display-subtitle { font-size: 12px; color: #00aa00; }
.call-display-indicator { display: flex; align-items: center; gap: 4px; }
.call-progress-dot { width: 8px; height: 8px; border-radius: 50%; background: #00ff41; animation: pulse 1s infinite; }

/* Responsive */
@media (max-width: 400px) {
    .dial-num { font-size: 20px; }
    .dial-btn { padding: 12px; }
    .dialpad-grid { gap: 8px; }
    .call-action-btn { padding: 12px 20px; font-size: 13px; }
}
