/* ============================================================
 * Chat Argomulyo — Feature CSS (Location, Video Call, Icons)
 * ============================================================ */

/* ===== TOPBAR ICON BUTTONS (location, video, logout) ===== */
.chat-topbar-right {
    display: flex;
    align-items: center;
    gap: 4px;
}
.chat-topbar-icon-btn {
    width: 38px;
    height: 38px;
    border-radius: 10px;
    border: none;
    background: transparent;
    color: rgba(255,255,255,0.85);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.15s ease;
    position: relative;
}
.chat-topbar-icon-btn:hover {
    background: rgba(255,255,255,0.1);
    color: white;
}
.chat-topbar-icon-btn:active {
    transform: scale(0.95);
}
.chat-topbar-icon-btn-danger:hover {
    background: rgba(239, 68, 68, 0.2);
    color: #fca5a5;
}

/* ===== SIDEBAR QUICK ACTIONS ===== */
.chat-quick-actions {
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.chat-quick-action {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 10px 12px;
    border: none;
    background: transparent;
    color: var(--text-2, #334155);
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    text-align: left;
    transition: all 0.15s ease;
    font-family: inherit;
}
.chat-quick-action:hover {
    background: var(--primary-50, #ecfdf5);
    color: var(--primary-700, #047857);
}
.chat-quick-icon {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    background: var(--primary-100, #d1fae5);
    color: var(--primary-700, #047857);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.chat-quick-action:hover .chat-quick-icon {
    background: var(--primary-500, #10b981);
    color: white;
}

/* ===== CHANNEL LIST (with hash icon) ===== */
.chat-channel-list {
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.chat-channel-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 10px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    color: var(--text-2, #334155);
    transition: all 0.15s ease;
}
.chat-channel-item:hover {
    background: var(--bg-soft, #f8fafc);
}
.chat-channel-item.active {
    background: var(--primary-50, #ecfdf5);
    color: var(--primary-700, #047857);
    font-weight: 600;
}
.chat-channel-hash {
    color: var(--text-muted, #64748b);
    display: inline-flex;
    align-items: center;
}
.chat-channel-item.active .chat-channel-hash {
    color: var(--primary-600, #059669);
}
.chat-channel-name {
    flex: 1;
}

/* ===== FEATURE MODAL (generic backdrop) ===== */
.feature-modal {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.5);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    z-index: 1000;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 16px;
    animation: fadeIn 0.2s ease;
}
.feature-modal.show {
    display: flex;
}
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}
.feature-modal-card {
    background: var(--surface, #ffffff);
    border-radius: 16px;
    width: 100%;
    max-width: 480px;
    max-height: calc(100vh - 32px);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-shadow: 0 25px 50px -12px rgba(0,0,0,0.25);
    animation: slideUp 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}
@keyframes slideUp {
    from { transform: translateY(20px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}
.feature-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border, #e2e8f0);
    background: var(--bg-soft, #f8fafc);
}
.feature-modal-title {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 600;
    color: var(--text, #0f172a);
    font-size: 16px;
}
.feature-modal-title .loc-icon,
.feature-modal-title .vid-icon {
    width: 28px;
    height: 28px;
    border-radius: 8px;
    background: var(--primary-500, #10b981);
    color: white;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}
.feature-modal-title .vid-icon {
    background: linear-gradient(135deg, #3b82f6, #1d4ed8);
}
.feature-modal-close {
    width: 32px;
    height: 32px;
    border: none;
    background: transparent;
    border-radius: 8px;
    color: var(--text-muted, #64748b);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}
.feature-modal-close:hover {
    background: var(--border, #e2e8f0);
    color: var(--text, #0f172a);
}
.feature-modal-body {
    flex: 1;
    overflow: auto;
}
.feature-modal-footer {
    display: flex;
    gap: 8px;
    padding: 14px 20px;
    border-top: 1px solid var(--border, #e2e8f0);
    background: var(--bg-soft, #f8fafc);
    flex-wrap: wrap;
    justify-content: flex-end;
}

/* ===== LOCATION MAP ===== */
.loc-map {
    width: 100%;
    height: 360px;
    background: #e0f2fe;
}
.feature-modal-card .loc-map {
    border-radius: 0;
}
.loc-status {
    padding: 10px 16px;
    font-size: 13px;
    color: var(--text-muted, #64748b);
    display: flex;
    align-items: center;
    gap: 8px;
    background: var(--bg-soft, #f8fafc);
    border-top: 1px solid var(--border, #e2e8f0);
}
.loc-status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--text-muted, #94a3b8);
    flex-shrink: 0;
}
.loc-status-loading .loc-status-dot { background: #3b82f6; animation: pulse 1.2s infinite; }
.loc-status-ready .loc-status-dot { background: var(--success, #10b981); }
.loc-status-sharing .loc-status-dot { background: var(--success, #10b981); animation: pulse 1.5s infinite; }
.loc-status-error .loc-status-dot { background: var(--danger, #ef4444); }
.loc-status-idle .loc-status-dot { background: var(--text-faint, #94a3b8); }
@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.4; }
}
.loc-spinner {
    display: inline-block;
    width: 14px;
    height: 14px;
    border: 2px solid var(--border, #e2e8f0);
    border-top-color: var(--primary-500, #10b981);
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
    flex-shrink: 0;
}
@keyframes spin {
    to { transform: rotate(360deg); }
}
.loc-btn {
    padding: 8px 14px;
    border-radius: 8px;
    border: none;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-family: inherit;
    transition: all 0.15s ease;
}
.loc-btn:active { transform: scale(0.97); }
.loc-btn-primary {
    background: var(--primary-500, #10b981);
    color: white;
}
.loc-btn-primary:hover { background: var(--primary-600, #059669); }
.loc-btn-secondary {
    background: var(--bg, #f1f5f9);
    color: var(--text, #0f172a);
}
.loc-btn-secondary:hover { background: var(--border, #e2e8f0); }
.loc-icon-start {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: white;
    display: inline-block;
    position: relative;
}
.loc-icon-start::before {
    content: '';
    position: absolute;
    inset: 3px;
    background: var(--primary-500, #10b981);
    border-radius: 50%;
}

/* Custom Leaflet marker for other users */
.loc-user-marker {
    background: transparent;
    border: none;
}
.loc-user-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: linear-gradient(135deg, #3b82f6, #1d4ed8);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 14px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.3);
    border: 2px solid white;
}

/* ===== USER LIST MODAL (for video call) ===== */
.users-card {
    max-width: 380px;
}
.users-list {
    max-height: 60vh;
    overflow-y: auto;
    padding: 8px;
}
.users-loading,
.users-empty {
    padding: 32px 16px;
    text-align: center;
    color: var(--text-muted, #64748b);
    font-size: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}
.user-list-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    border-radius: 10px;
    margin-bottom: 4px;
    transition: background 0.15s;
}
.user-list-item:hover {
    background: var(--bg-soft, #f8fafc);
}
.user-list-avatar {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    background: linear-gradient(135deg, #34d399, #10b981);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 16px;
    flex-shrink: 0;
}
.user-list-info {
    flex: 1;
    min-width: 0;
}
.user-list-name {
    font-weight: 600;
    color: var(--text, #0f172a);
    font-size: 14px;
}
.user-list-status {
    font-size: 12px;
    color: var(--success, #10b981);
    display: flex;
    align-items: center;
    gap: 4px;
}
.user-list-status::before {
    content: '';
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--success, #10b981);
}
.user-list-call-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    background: linear-gradient(135deg, #3b82f6, #1d4ed8);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    font-family: inherit;
    transition: all 0.15s;
}
.user-list-call-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.4);
}

/* ===== VIDEO CALL MODAL ===== */
.call-modal {
    padding: 0;
    background: #0a0e1a;
}
.call-modal.show {
    align-items: stretch;
    justify-content: stretch;
}
.call-stage {
    position: relative;
    width: 100%;
    height: 100%;
    min-height: 100vh;
    background: #0a0e1a;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
}
.call-remote-wrap {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #1e293b, #0a0e1a);
}
#call-remote {
    width: 100%;
    height: 100%;
    object-fit: cover;
    background: #0a0e1a;
}
.call-no-stream {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: rgba(255,255,255,0.7);
    text-align: center;
    padding: 20px;
    gap: 16px;
}
.call-avatar-big {
    width: 96px;
    height: 96px;
    border-radius: 50%;
    background: linear-gradient(135deg, #34d399, #10b981);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 42px;
    font-weight: 700;
    box-shadow: 0 8px 32px rgba(16, 185, 129, 0.4);
}
.call-status-text {
    font-size: 15px;
    color: rgba(255,255,255,0.85);
    font-weight: 500;
}
.call-local-wrap {
    position: absolute;
    top: 16px;
    right: 16px;
    width: 140px;
    height: 200px;
    border-radius: 12px;
    overflow: hidden;
    background: #1e293b;
    box-shadow: 0 4px 16px rgba(0,0,0,0.4);
    z-index: 10;
    border: 2px solid rgba(255,255,255,0.15);
}
#call-local {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transform: scaleX(-1); /* mirror */
}
.call-controls {
    position: absolute;
    bottom: 32px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 14px;
    z-index: 20;
    background: rgba(0,0,0,0.4);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    padding: 12px 16px;
    border-radius: 50px;
}
.call-btn {
    width: 52px;
    height: 52px;
    border-radius: 50%;
    border: none;
    background: rgba(255,255,255,0.15);
    color: white;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.15s ease;
}
.call-btn:hover {
    background: rgba(255,255,255,0.25);
    transform: scale(1.05);
}
.call-btn:active {
    transform: scale(0.95);
}
.call-btn.active {
    background: rgba(255,255,255,0.95);
    color: #0a0e1a;
}
.call-btn-hangup {
    background: #ef4444;
    color: white;
    width: 60px;
    height: 60px;
}
.call-btn-hangup:hover {
    background: #dc2626;
}
.call-meta {
    position: absolute;
    top: 20px;
    left: 20px;
    color: white;
    z-index: 20;
    display: flex;
    flex-direction: column;
    gap: 4px;
    background: rgba(0,0,0,0.4);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    padding: 10px 16px;
    border-radius: 12px;
}
.call-peer-name {
    font-weight: 600;
    font-size: 14px;
}
.call-timer {
    font-size: 12px;
    color: rgba(255,255,255,0.7);
    font-variant-numeric: tabular-nums;
}

/* ===== MOBILE ADJUSTMENTS ===== */
@media (max-width: 600px) {
    .feature-modal-card {
        max-width: 100%;
    }
    .loc-map {
        height: 300px;
    }
    .call-local-wrap {
        width: 100px;
        height: 140px;
        top: 12px;
        right: 12px;
    }
    .call-avatar-big {
        width: 72px;
        height: 72px;
        font-size: 32px;
    }
    .call-btn {
        width: 46px;
        height: 46px;
    }
    .call-btn-hangup {
        width: 54px;
        height: 54px;
    }
}
